[comick] handle chapters without chapter info (#7972)

This commit is contained in:
Mike Fährmann
2025-08-04 19:30:54 +02:00
parent 3c5eac29c3
commit ca44b6e338
2 changed files with 62 additions and 8 deletions

View File

@@ -86,7 +86,7 @@ class ComickBase():
class ComickChapterExtractor(ComickBase, ChapterExtractor):
"""Extractor for comick.io manga chapters"""
archive_fmt = "{chapter_hid}_{page}"
pattern = BASE_PATTERN + r"/comic/([\w-]+)/(\w+-chapter-[^/?#]+)"
pattern = BASE_PATTERN + r"/comic/([\w-]+)/(\w+(?:-chapter-[^/?#]+)?)"
example = "https://comick.io/comic/MANGA/ID-chapter-123-en"
def metadata(self, page):
@@ -96,7 +96,12 @@ class ComickChapterExtractor(ComickBase, ChapterExtractor):
ch = props["chapter"]
self._images = ch["md_images"]
chapter, sep, minor = ch["chap"].partition(".")
if chapter := ch["chap"]:
chapter, sep, minor = chapter.partition(".")
else:
chapter = 0
sep = minor = ""
return {
**manga,
@@ -137,15 +142,20 @@ class ComickMangaExtractor(ComickBase, MangaExtractor):
manga = self._manga_info(slug)
for ch in self.chapters(manga):
url = (f"{self.root}/comic/{slug}"
f"/{ch['hid']}-chapter-{ch['chap']}-{ch['lang']}")
ch.update(manga)
chapter, sep, minor = ch["chap"].partition(".")
ch["chapter"] = text.parse_int(chapter)
ch["chapter_minor"] = sep + minor
ch["_extractor"] = ComickChapterExtractor
if chapter := ch["chap"]:
url = (f"{self.root}/comic/{slug}"
f"/{ch['hid']}-chapter-{chapter}-{ch['lang']}")
chapter, sep, minor = chapter.partition(".")
ch["chapter"] = text.parse_int(chapter)
ch["chapter_minor"] = sep + minor
else:
url = f"{self.root}/comic/{slug}/{ch['hid']}"
ch["chapter"] = 0
ch["chapter_minor"] = ""
yield Message.Queue, url, ch
def chapters(self, manga):

View File

@@ -134,6 +134,35 @@ __tests__ = (
"title": "Yamamoto \"Đuổi\" Hayashi Đi Ư!?",
},
{
"#url" : "https://comick.io/comic/00-the-100-girlfriends-who-really-really-really-really-really-love-you/Zqu59ZKD",
"#comment" : "no chapter info (#7972)",
"#class" : comick.ComickChapterExtractor,
"#pattern" : r"https://meo.comick.pictures/\d+-[\w-]+\.(jpg|png)",
"#count" : 22,
"artist" : ["Nozawa Yukiko"],
"author" : ["Nakamura Rikito"],
"chapter" : 0,
"chapter_hid" : "Zqu59ZKD",
"chapter_id" : 3437106,
"chapter_minor" : "",
"chapter_string": "Zqu59ZKD",
"count" : 22,
"date" : "dt:2024-08-29 14:20:51",
"date_updated" : "dt:2024-08-29 14:20:51",
"group" : ["ENCHILADAS NO SEKAI"],
"lang" : "es-419",
"manga" : "The 100 Girlfriends Who Really, Really, Really, Really, Really Love You",
"manga_hid" : "grNTmie1",
"manga_id" : 37955,
"manga_slug" : "00-the-100-girlfriends-who-really-really-really-really-really-love-you",
"published" : 2019,
"publisher" : ["Shueisha"],
"title" : "MAI Y MOMOHA SE CONVIERTEN EN MAIDS CERTIFICADAS(TAL VEZ)",
"volume" : 0,
},
{
"#url" : "https://comick.io/comic/kobayashi-san-chi-no-maid-dragon",
"#comment" : "all chapters",
@@ -190,4 +219,19 @@ __tests__ = (
"lang": {"fr", "id"},
},
{
"#url" : "https://comick.io/comic/00-the-100-girlfriends-who-really-really-really-really-really-love-you?lang=es-419&chap-order=1&date-order=",
"#comment" : "chapter without chapter info (#7972)",
"#class" : comick.ComickMangaExtractor,
"#range" : "1-3",
"#results" : (
"https://comick.io/comic/00-the-100-girlfriends-who-really-really-really-really-really-love-you/Zqu59ZKD",
"https://comick.io/comic/00-the-100-girlfriends-who-really-really-really-really-really-love-you/y6kgR-chapter-1-es-419",
"https://comick.io/comic/00-the-100-girlfriends-who-really-really-really-really-really-love-you/wkMZr-chapter-1-es-419",
),
"chapter": {0, 1},
"lang" : "es-419",
},
)