From 321161c7699202e04e5017f454e803e44eb4bd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Tue, 1 Oct 2024 07:38:12 +0200 Subject: [PATCH] [patreon] use mobile UA (#6241, #6239, #6140) --- docs/configuration.rst | 6 +++--- gallery_dl/extractor/patreon.py | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/configuration.rst b/docs/configuration.rst index dbc1d1ef..1a5e11f5 100644 --- a/docs/configuration.rst +++ b/docs/configuration.rst @@ -627,7 +627,7 @@ Description and use the User-Agent used by the system's default browser. Note: This option has no effect on - `pixiv`, `e621`, and `mangadex` + `pixiv`, `e621`, `mangadex`, and `patreon` extractors, as these need specific values to function correctly. @@ -636,7 +636,7 @@ extractor.*.browser Type ``string`` Default - * ``"firefox"``: ``artstation``, ``mangasee``, ``patreon``, ``pixiv:series``, ``twitter`` + * ``"firefox"``: ``artstation``, ``mangasee``, ``twitter`` * ``null``: otherwise Example * ``"chrome:macos"`` @@ -712,7 +712,7 @@ extractor.*.tls12 Type ``bool`` Default - * ``false``: ``artstation``, ``patreon``, ``pixiv:series`` + * ``false``: ``artstation`` * ``true``: otherwise Description Allow selecting TLS 1.2 cipher suites. diff --git a/gallery_dl/extractor/patreon.py b/gallery_dl/extractor/patreon.py index eb6d6773..cbbd688e 100644 --- a/gallery_dl/extractor/patreon.py +++ b/gallery_dl/extractor/patreon.py @@ -23,16 +23,17 @@ class PatreonExtractor(Extractor): directory_fmt = ("{category}", "{creator[full_name]}") filename_fmt = "{id}_{title}_{num:>02}.{extension}" archive_fmt = "{id}_{num}" - browser = "firefox" - tls12 = False _warning = True - def items(self): + def _init(self): + self.session.headers["User-Agent"] = \ + "Patreon/72.2.28 (Android; Android 14; Scale/2.10)" if self._warning: if not self.cookies_check(("session_id",)): self.log.warning("no 'session_id' cookie set") PatreonExtractor._warning = False + def items(self): generators = self._build_file_generators(self.config("files")) for post in self.posts():