From a8ca947154687c540b4a8dacdb70ec2e90449650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 13 Dec 2025 15:56:50 +0100 Subject: [PATCH] [pixiv] warn about invalid 'PHPSESSID' cookie (#8689) --- gallery_dl/extractor/pixiv.py | 9 ++++++--- test/results/pixiv.py | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/pixiv.py b/gallery_dl/extractor/pixiv.py index 5be4867a..eb1a7f29 100644 --- a/gallery_dl/extractor/pixiv.py +++ b/gallery_dl/extractor/pixiv.py @@ -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 diff --git a/test/results/pixiv.py b/test/results/pixiv.py index 0e763f62..a4d08f11 100644 --- a/test/results/pixiv.py +++ b/test/results/pixiv.py @@ -107,6 +107,7 @@ __tests__ = ( "#comment" : "Invalid PHPSESSID cookie", "#class" : pixiv.PixivArtworksExtractor, "#options" : {"cookies": {"PHPSESSID": "12345_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}}, + "#log" : "Invalid 'PHPSESSID' cookie", "#sha1_url": "852c31ad83b6840bacbce824d85f2a997889efb7", },