mirror of
https://github.com/mikf/gallery-dl.git
synced 2024-11-21 18:22:30 +01:00
[pixiv] fix exception when processing deleted sanity_level work (#6339)
https://github.com/mikf/gallery-dl/issues/6339#issuecomment-2427350524
This commit is contained in:
parent
9a2bccd0d9
commit
2d15e64ea9
@ -77,7 +77,7 @@ class PixivExtractor(Extractor):
|
||||
work["tags_bookmark"] = [tag["name"] for tag in detail["tags"]
|
||||
if tag["is_registered"]]
|
||||
if self.sanity_workaround and not work.get("caption") and \
|
||||
not work.get("_mypixiv"):
|
||||
not work.get("_mypixiv") and not work.get("_ajax"):
|
||||
body = self._request_ajax("/illust/" + str(work["id"]))
|
||||
if body:
|
||||
work["caption"] = text.unescape(body["illustComment"])
|
||||
@ -186,6 +186,7 @@ class PixivExtractor(Extractor):
|
||||
return None
|
||||
|
||||
def _extract_ajax(self, work, body):
|
||||
work["_ajax"] = True
|
||||
url = self._extract_ajax_url(body)
|
||||
if not url:
|
||||
return ()
|
||||
@ -243,12 +244,12 @@ class PixivExtractor(Extractor):
|
||||
original = body["urls"]["original"]
|
||||
if original:
|
||||
return original
|
||||
except KeyError:
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
square1200 = body["userIllusts"][body["id"]]["url"]
|
||||
except KeyError:
|
||||
except Exception:
|
||||
return
|
||||
parts = square1200.rpartition("_p0")[0].split("/")
|
||||
del parts[3:5]
|
||||
|
@ -266,6 +266,13 @@ __tests__ = (
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/en/artworks/104582860",
|
||||
"#comment" : "deleted limit_sanity_level_360.png work (#6339)",
|
||||
"#class" : pixiv.PixivWorkExtractor,
|
||||
"#count" : 0,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/en/artworks/103983466",
|
||||
"#comment" : "empty 'caption' in App API response (#4327, #5191)",
|
||||
|
Loading…
Reference in New Issue
Block a user