[pixiv] prevent exceptions during 'comments' extraction (#6965)

- wrap in try-except block
- do not attempt to fetch comments for 'sanity_level' works
This commit is contained in:
Mike Fährmann
2025-02-10 09:56:09 +01:00
parent 6c2b6d50cc
commit 587205bf68
2 changed files with 8 additions and 4 deletions

View File

@@ -71,9 +71,12 @@ class PixivExtractor(Extractor):
if self.meta_user:
work.update(self.api.user_detail(work["user"]["id"]))
if self.meta_comments:
if work["total_comments"]:
work["comments"] = list(
self.api.illust_comments(work["id"]))
if work["total_comments"] and not work.get("_ajax"):
try:
work["comments"] = list(
self.api.illust_comments(work["id"]))
except Exception:
work["comments"] = ()
else:
work["comments"] = ()
if self.meta_bookmark and work["is_bookmarked"]: