[pixiv] warn about invalid 'PHPSESSID' cookie (#8689)

This commit is contained in:
Mike Fährmann
2025-12-13 15:56:50 +01:00
parent db8dd525f3
commit a8ca947154
2 changed files with 7 additions and 3 deletions

View File

@@ -237,10 +237,13 @@ class PixivExtractor(Extractor):
return data["body"]
self.log.debug("Server response: %s", util.json_dumps(data))
return self.log.error(
"'%s'", data.get("message") or "General Error")
if (msg := data.get("message")) == "An unknown error occurred":
msg = "Invalid 'PHPSESSID' cookie"
else:
msg = f"'{msg or 'General Error'}'"
self.log.error("%s", msg)
except Exception:
return None
pass
def _extract_ajax(self, work, body):
work["_ajax"] = True

View File

@@ -107,6 +107,7 @@ __tests__ = (
"#comment" : "Invalid PHPSESSID cookie",
"#class" : pixiv.PixivArtworksExtractor,
"#options" : {"cookies": {"PHPSESSID": "12345_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}},
"#log" : "Invalid 'PHPSESSID' cookie",
"#sha1_url": "852c31ad83b6840bacbce824d85f2a997889efb7",
},