[pixiv] fix artworks downloads when using expired cookies (#7987)
This commit is contained in:
@@ -446,16 +446,14 @@ class PixivArtworksExtractor(PixivExtractor):
|
||||
if self.sanity_workaround:
|
||||
body = self._request_ajax(
|
||||
f"/user/{self.user_id}/profile/all")
|
||||
if not body:
|
||||
return ()
|
||||
try:
|
||||
ajax_ids = list(map(int, body["illusts"]))
|
||||
ajax_ids.extend(map(int, body["manga"]))
|
||||
ajax_ids.sort()
|
||||
except Exception as exc:
|
||||
self.log.debug("", exc_info=exc)
|
||||
self.log.warning("u%s: Failed to collect artwork IDs "
|
||||
"using AJAX API (%s: %s)",
|
||||
self.user_id, exc.__class__.__name__, exc)
|
||||
"using AJAX API", self.user_id)
|
||||
else:
|
||||
works = self._extend_sanity(works, ajax_ids)
|
||||
|
||||
|
||||
@@ -102,6 +102,14 @@ __tests__ = (
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/en/users/173530/artworks",
|
||||
"#comment" : "Invalid PHPSESSID cookie",
|
||||
"#class" : pixiv.PixivArtworksExtractor,
|
||||
"#options" : {"cookies": {"PHPSESSID": "12345_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}},
|
||||
"#sha1_url": "852c31ad83b6840bacbce824d85f2a997889efb7",
|
||||
},
|
||||
|
||||
{
|
||||
"#url" : "https://www.pixiv.net/en/users/173530/artworks/%E6%89%8B%E3%81%B6%E3%82%8D",
|
||||
"#comment" : "illusts with specific tag",
|
||||
|
||||
Reference in New Issue
Block a user