Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tcbscans] support other domains #5774

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/supportedsites.md
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ Consider all listed sites to potentially be NSFW.
</tr>
<tr>
<td>TCB Scans</td>
<td>https://tcbscans.com/</td>
<td>https://tcbscans.me/</td>
<td>Chapters, Manga</td>
<td></td>
</tr>
Expand Down
19 changes: 13 additions & 6 deletions gallery_dl/extractor/tcbscans.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -39,10 +43,13 @@ def metadata(self, page):

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 = {
Expand Down
25 changes: 25 additions & 0 deletions test/results/tcbscans.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# published by the Free Software Foundation.

from gallery_dl.extractor import tcbscans
from gallery_dl import exception


__tests__ = (
Expand Down Expand Up @@ -34,12 +35,28 @@
"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",
},

{
Expand All @@ -58,12 +75,20 @@
"#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,
},

)
Loading