From 91eb04b0d086395ad60ca87cfbf55ae6b677ca3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Sat, 21 Sep 2024 13:20:42 +0200 Subject: [PATCH] [ao3] detect member-only and adult works (#6013) --- gallery_dl/extractor/ao3.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gallery_dl/extractor/ao3.py b/gallery_dl/extractor/ao3.py index a0abce05..88f73ac6 100644 --- a/gallery_dl/extractor/ao3.py +++ b/gallery_dl/extractor/ao3.py @@ -116,7 +116,17 @@ class Ao3WorkExtractor(Ao3Extractor): work_id = self.groups[0] url = "{}/works/{}".format(self.root, work_id) - extr = text.extract_from(self.request(url).text) + response = self.request(url, notfound="work") + + if response.url.endswith("/users/login?restricted=true"): + raise exception.AuthorizationError( + "Login required to access member-only works") + page = response.text + if len(page) < 20000 and \ + '

Adult Content Warning")