[pixiv] fix 'IndexError' for unviewable works (#7940)
This commit is contained in:
@@ -308,7 +308,12 @@ class PixivExtractor(Extractor):
|
||||
square1200 = body["userIllusts"][body["id"]]["url"]
|
||||
except Exception:
|
||||
return
|
||||
|
||||
parts = square1200.rpartition("_p0")[0].split("/")
|
||||
if len(parts) < 6:
|
||||
return self.log.warning(
|
||||
"%s: %s", body["id"], square1200.rpartition("/")[2])
|
||||
|
||||
del parts[3:5]
|
||||
parts[3] = "img-original"
|
||||
base = "/".join(parts)
|
||||
|
||||
@@ -368,6 +368,13 @@ __tests__ = (
|
||||
"#sha1_content": "aa119c27fec0a36bbd06e7491987acf5f1be6293",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/artworks/56360615",
|
||||
"#comment" : "limit_unviewable_s / unavailable without cookies (#7940)",
|
||||
"#class" : pixiv.PixivWorkExtractor,
|
||||
"#count" : 11,
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/en/artworks/966412",
|
||||
"#class" : pixiv.PixivWorkExtractor,
|
||||
|
||||
Reference in New Issue
Block a user