[comick] handle redirects

This commit is contained in:
Mike Fährmann
2025-09-07 09:11:30 +02:00
parent 69f4036e29
commit 2ebf1ad19c
2 changed files with 26 additions and 2 deletions

View File

@@ -67,9 +67,19 @@ class ComickChapterExtractor(ComickBase, ChapterExtractor):
def metadata(self, page):
slug, chstr = self.groups
manga = _manga_info(self, slug)
props = _chapter_info(self, manga, chstr)
ch = props["chapter"]
while True:
props = _chapter_info(self, manga, chstr)
if "__N_REDIRECT" in props:
path = props["__N_REDIRECT"]
self.log.debug("Following redirect to %s", path)
_, slug, chstr = path.rsplit("/", 2)
continue
ch = props["chapter"]
break
self._images = ch["md_images"]
if chapter := ch["chap"]:

View File

@@ -78,6 +78,20 @@ __tests__ = (
},
},
{
"#url" : "https://comick.io/comic/neko-no-oshigoto/L7TaJB4n-chapter-10.7-xy",
"#comment" : "redirect",
"#class" : comick.ComickChapterExtractor,
"#pattern" : r"https://meo.comick.pictures/\d-\w+\.webp",
"volume" : 1,
"chapter" : 10,
"chapter_minor" : ".5",
"chapter_hid" : "L7TaJB4n",
"chapter_id" : 4105343,
"chapter_string": "L7TaJB4n-chapter-10.5-en",
},
{
"#url" : "https://comick.io/comic/koko-jidai-ni-gomandatta-jou-sama-to-no-dousei-seikatsu-wa-igaito-igokochi-ga-warukunai/aPu5CgJA-chapter-3-vi",
"#class" : comick.ComickChapterExtractor,