[imhentai] prevent exceptions for galleries without image data (#8951)

This commit is contained in:
Mike Fährmann
2026-01-28 10:40:22 +01:00
parent 6c9dff1e29
commit aa8610c11c
2 changed files with 29 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright 2025 Mike Fährmann
# Copyright 2025-2026 Mike Fährmann
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
@@ -123,7 +123,11 @@ class ImhentaiGalleryExtractor(ImhentaiExtractor, GalleryExtractor):
return results
def images(self, page):
data = util.json_loads(text.extr(page, "$.parseJSON('", "'"))
try:
data = util.json_loads(text.extr(page, "$.parseJSON('", "'"))
except Exception:
self.log.warning("%s: Missing image data", self.gallery_id)
return ()
base = text.extr(page, 'data-src="', '"').rpartition("/")[0] + "/"
exts = {"j": "jpg", "p": "png", "g": "gif", "w": "webp", "a": "avif"}