1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[patreon] use mobile UA (#6241, #6239, #6140)

This commit is contained in:
Mike Fährmann 2024-10-01 07:38:12 +02:00
parent 7d0e5877ce
commit 321161c769
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 7 additions and 6 deletions

View File

@ -627,7 +627,7 @@ Description
and use the User-Agent used by the system's default browser. and use the User-Agent used by the system's default browser.
Note: This option has no effect on 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. extractors, as these need specific values to function correctly.
@ -636,7 +636,7 @@ extractor.*.browser
Type Type
``string`` ``string``
Default Default
* ``"firefox"``: ``artstation``, ``mangasee``, ``patreon``, ``pixiv:series``, ``twitter`` * ``"firefox"``: ``artstation``, ``mangasee``, ``twitter``
* ``null``: otherwise * ``null``: otherwise
Example Example
* ``"chrome:macos"`` * ``"chrome:macos"``
@ -712,7 +712,7 @@ extractor.*.tls12
Type Type
``bool`` ``bool``
Default Default
* ``false``: ``artstation``, ``patreon``, ``pixiv:series`` * ``false``: ``artstation``
* ``true``: otherwise * ``true``: otherwise
Description Description
Allow selecting TLS 1.2 cipher suites. Allow selecting TLS 1.2 cipher suites.

View File

@ -23,16 +23,17 @@ class PatreonExtractor(Extractor):
directory_fmt = ("{category}", "{creator[full_name]}") directory_fmt = ("{category}", "{creator[full_name]}")
filename_fmt = "{id}_{title}_{num:>02}.{extension}" filename_fmt = "{id}_{title}_{num:>02}.{extension}"
archive_fmt = "{id}_{num}" archive_fmt = "{id}_{num}"
browser = "firefox"
tls12 = False
_warning = True _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 self._warning:
if not self.cookies_check(("session_id",)): if not self.cookies_check(("session_id",)):
self.log.warning("no 'session_id' cookie set") self.log.warning("no 'session_id' cookie set")
PatreonExtractor._warning = False PatreonExtractor._warning = False
def items(self):
generators = self._build_file_generators(self.config("files")) generators = self._build_file_generators(self.config("files"))
for post in self.posts(): for post in self.posts():