From 4557ab5e8097fb890b5cacbb7ba138c872031bea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Fri, 12 Dec 2025 16:23:32 +0100 Subject: [PATCH] [xenforo] emit AuthRequired errors for 403 downloads --- gallery_dl/extractor/xenforo.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/xenforo.py b/gallery_dl/extractor/xenforo.py index f9fe9d94..a55eda6f 100644 --- a/gallery_dl/extractor/xenforo.py +++ b/gallery_dl/extractor/xenforo.py @@ -53,6 +53,8 @@ class XenforoExtractor(BaseExtractor): yield Message.Directory, "", data id_last = None + data["_http_expected_status"] = (403,) + data["_http_validate"] = self._validate data["num"] = data["num_internal"] = data["num_external"] = 0 for video, inl1, inl2, ext in urls: if ext: @@ -100,9 +102,7 @@ class XenforoExtractor(BaseExtractor): return self.request(url) except exception.HttpError as exc: if exc.status == 403 and b">Log in<" in exc.response.content: - raise exception.AuthRequired( - ("username & password", "authenticated cookies"), None, - self._extract_error(exc.response.text)) + self._require_auth(exc.response) raise def login(self): @@ -247,6 +247,16 @@ class XenforoExtractor(BaseExtractor): return post + def _require_auth(self, response): + raise exception.AuthRequired( + ("username & password", "authenticated cookies"), None, + self._extract_error(response.text)) + + def _validate(self, response): + if response.status_code == 403 and b">Log in<" in response.content: + self._require_auth(response) + return True + BASE_PATTERN = XenforoExtractor.update({ "simpcity": {