From eacd4479a2793a6b7f3c8a584e5bcdcbb1df0f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 21 Oct 2024 14:01:31 +0200 Subject: [PATCH] [patreon] support '/c/' before creator name in URLs (#6348) and avoid '/CREATOR/posts' redirects --- gallery_dl/extractor/patreon.py | 6 +++--- test/results/patreon.py | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/gallery_dl/extractor/patreon.py b/gallery_dl/extractor/patreon.py index 8e61bf4f..0b64ea3b 100644 --- a/gallery_dl/extractor/patreon.py +++ b/gallery_dl/extractor/patreon.py @@ -311,7 +311,7 @@ class PatreonCreatorExtractor(PatreonExtractor): subcategory = "creator" pattern = (r"(?:https?://)?(?:www\.)?patreon\.com" r"/(?!(?:home|join|posts|login|signup)(?:$|[/?#]))" - r"([^/?#]+)(?:/posts)?/?(?:\?([^#]+))?") + r"(?:c/)?([^/?#]+)(?:/posts)?/?(?:\?([^#]+))?") example = "https://www.patreon.com/USER" def posts(self): @@ -341,9 +341,9 @@ class PatreonCreatorExtractor(PatreonExtractor): user_id = query.get("u") if user_id: - url = "{}/user/posts?u={}".format(self.root, user_id) + url = "{}/user?u={}".format(self.root, user_id) else: - url = "{}/{}/posts".format(self.root, creator) + url = "{}/{}".format(self.root, creator) page = self.request(url, notfound="creator").text try: diff --git a/test/results/patreon.py b/test/results/patreon.py index b8fc1bb2..f8cdaf10 100644 --- a/test/results/patreon.py +++ b/test/results/patreon.py @@ -43,6 +43,11 @@ __tests__ = ( "#exception": exception.NotFoundError, }, +{ + "#url" : "https://www.patreon.com/c/koveliana", + "#class" : patreon.PatreonCreatorExtractor, +}, + { "#url" : "https://www.patreon.com/user?u=2931440", "#class" : patreon.PatreonCreatorExtractor,