[comick] update 'buildId' on 404 errors (#8157)

This commit is contained in:
Mike Fährmann
2025-09-07 15:28:00 +02:00
parent 2ebf1ad19c
commit 67707a8bbe

View File

@@ -9,7 +9,7 @@
"""Extractors for https://comick.io/"""
from .common import GalleryExtractor, ChapterExtractor, MangaExtractor, Message
from .. import text
from .. import text, exception
from ..cache import memcache
BASE_PATTERN = r"(?:https?://)?(?:www\.)?comick\.io"
@@ -69,7 +69,23 @@ class ComickChapterExtractor(ComickBase, ChapterExtractor):
manga = _manga_info(self, slug)
while True:
props = _chapter_info(self, manga, chstr)
try:
props = _chapter_info(self, manga, chstr)
except exception.HttpError as exc:
if exc.response.status_code != 404:
raise
if exc.response.headers.get(
"Content-Type", "").startswith("text/html"):
if locals().get("_retry_buildid"):
raise
self.log.debug("Updating Next.js build ID")
_retry_buildid = True
_manga_info.cache.clear()
manga = _manga_info(self, slug)
continue
if b'"notFound":true' in exc.response.content:
raise exception.NotFoundError("chapter")
raise
if "__N_REDIRECT" in props:
path = props["__N_REDIRECT"]