[imhentai] prevent exceptions for galleries without image data (#8951)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- 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
|
# 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
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
@@ -123,7 +123,11 @@ class ImhentaiGalleryExtractor(ImhentaiExtractor, GalleryExtractor):
|
|||||||
return results
|
return results
|
||||||
|
|
||||||
def images(self, page):
|
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] + "/"
|
base = text.extr(page, 'data-src="', '"').rpartition("/")[0] + "/"
|
||||||
exts = {"j": "jpg", "p": "png", "g": "gif", "w": "webp", "a": "avif"}
|
exts = {"j": "jpg", "p": "png", "g": "gif", "w": "webp", "a": "avif"}
|
||||||
|
|
||||||
|
|||||||
@@ -109,12 +109,34 @@ __tests__ = (
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"#url" : "https://hentaienvy.com/gallery/1119432/",
|
||||||
|
"#comment" : "empty 'var g_th = $.parseJSON('');' (#8951)",
|
||||||
|
"#category": ("IMHentai", "hentaienvy", "gallery"),
|
||||||
|
"#class" : imhentai.ImhentaiGalleryExtractor,
|
||||||
|
"#metadata": "post",
|
||||||
|
"#count" : 0,
|
||||||
|
"#log" : "1119432: Missing image data",
|
||||||
|
|
||||||
|
"artist" : [],
|
||||||
|
"character" : [],
|
||||||
|
"gallery_id": 1119432,
|
||||||
|
"group" : [],
|
||||||
|
"lang" : "ja",
|
||||||
|
"language" : ["japanese"],
|
||||||
|
"parody" : ["super mario brothers"],
|
||||||
|
"tags" : list,
|
||||||
|
"title" : "hentai girls",
|
||||||
|
"title_alt" : "",
|
||||||
|
"type" : "western",
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"#url" : "https://hentaienvy.com/artist/asutora/",
|
"#url" : "https://hentaienvy.com/artist/asutora/",
|
||||||
"#category": ("IMHentai", "hentaienvy", "tag"),
|
"#category": ("IMHentai", "hentaienvy", "tag"),
|
||||||
"#class" : imhentai.ImhentaiTagExtractor,
|
"#class" : imhentai.ImhentaiTagExtractor,
|
||||||
"#pattern" : imhentai.ImhentaiGalleryExtractor.pattern,
|
"#pattern" : imhentai.ImhentaiGalleryExtractor.pattern,
|
||||||
"#count" : range(45, 50),
|
"#count" : range(45, 60),
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user