1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-25 04:02:32 +01:00

[tcbscans] support other domains

This commit is contained in:
enduser420 2024-06-21 21:29:11 +05:30
parent f58b0e6fc7
commit 5adbfe526d
2 changed files with 38 additions and 6 deletions

View File

@ -4,19 +4,23 @@
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
"""Extractors for https://tcbscans.com/"""
"""Extractors for https://tcbscans.me/"""
from .common import ChapterExtractor, MangaExtractor
from .. import text
BASE_PATTERN = r"(?:https?://)?(?:tcbscans|onepiecechapters)\.com"
BASE_PATTERN = (r"(?:https?://)?(?:tcb(?:-backup\.bihar-mirchi|scans)"
r"|onepiecechapters)\.(?:com|me)")
class TcbscansChapterExtractor(ChapterExtractor):
category = "tcbscans"
root = "https://tcbscans.com"
pattern = BASE_PATTERN + r"(/chapters/\d+/[^/?#]+)"
example = "https://tcbscans.com/chapters/12345/MANGA-chapter-123"
example = "https://tcbscans.me/chapters/12345/MANGA-chapter-123"
def __init__(self, match):
self.root = text.root_from_url(match.group(0))
ChapterExtractor.__init__(self, match)
def images(self, page):
return [
@ -39,10 +43,13 @@ class TcbscansChapterExtractor(ChapterExtractor):
class TcbscansMangaExtractor(MangaExtractor):
category = "tcbscans"
root = "https://tcbscans.com"
chapterclass = TcbscansChapterExtractor
pattern = BASE_PATTERN + r"(/mangas/\d+/[^/?#]+)"
example = "https://tcbscans.com/mangas/123/MANGA"
example = "https://tcbscans.me/mangas/123/MANGA"
def __init__(self, match):
self.root = text.root_from_url(match.group(0))
MangaExtractor.__init__(self, match)
def chapters(self, page):
data = {

View File

@ -5,6 +5,7 @@
# published by the Free Software Foundation.
from gallery_dl.extractor import tcbscans
from gallery_dl import exception
__tests__ = (
@ -34,12 +35,28 @@ __tests__ = (
"chapter_minor": "",
"lang" : "en",
"language" : "English",
"#exception" : exception.HttpError,
},
{
"#url" : "https://onepiecechapters.com/chapters/44/ace-novel-manga-adaptation-chapter-1",
"#category": ("", "tcbscans", "chapter"),
"#class" : tcbscans.TcbscansChapterExtractor,
"#exception": exception.HttpError,
},
{
"#url" : "https://tcb-backup.bihar-mirchi.com/chapters/7719/jujutsu-kaisen-chapter-258",
"#category": ("", "tcbscans", "chapter"),
"#class" : tcbscans.TcbscansChapterExtractor,
"#pattern" : r"https://cdn\.[^/]+/(file|attachments/[^/]+)/[^/]+/[^.]+\.\w+",
"#count" : 15,
"manga" : "Jujutsu Kaisen",
"chapter" : 258,
"chapter_minor": "",
"lang" : "en",
"language" : "English",
},
{
@ -58,12 +75,20 @@ __tests__ = (
"#pattern" : tcbscans.TcbscansChapterExtractor.pattern,
"#range" : "1-50",
"#count" : 50,
"#exception": exception.HttpError,
},
{
"#url" : "https://onepiecechapters.com/mangas/15/hunter-x-hunter",
"#category": ("", "tcbscans", "manga"),
"#class" : tcbscans.TcbscansMangaExtractor,
"#exception": exception.HttpError,
},
{
"#url" : "https://tcbscans.me/mangas/4/jujutsu-kaisen",
"#category": ("", "tcbscans", "manga"),
"#class" : tcbscans.TcbscansMangaExtractor,
},
)