From bd410fab033a7ea29af379ca950f945818d505a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 25 Jun 2025 07:18:59 +0200 Subject: [PATCH] [patreon] extract more metadata for paywalled posts (#6582) https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3002275572 --- gallery_dl/extractor/patreon.py | 50 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/gallery_dl/extractor/patreon.py b/gallery_dl/extractor/patreon.py index 8d453a96..d36f01f1 100644 --- a/gallery_dl/extractor/patreon.py +++ b/gallery_dl/extractor/patreon.py @@ -156,35 +156,33 @@ class PatreonExtractor(Extractor): attr = post["attributes"] attr["id"] = text.parse_int(post["id"]) - if attr.get("current_user_can_view", True): + relationships = post["relationships"] + attr["images"] = self._files( + post, included, "images") + attr["attachments"] = self._files( + post, included, "attachments") + attr["attachments_media"] = self._files( + post, included, "attachments_media") + attr["date"] = text.parse_datetime( + attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z") - relationships = post["relationships"] - attr["images"] = self._files( - post, included, "images") - attr["attachments"] = self._files( - post, included, "attachments") - attr["attachments_media"] = self._files( - post, included, "attachments_media") - attr["date"] = text.parse_datetime( - attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z") + try: + attr["campaign"] = (included["campaign"][ + relationships["campaign"]["data"]["id"]]) + except Exception: + attr["campaign"] = None - try: - attr["campaign"] = (included["campaign"][ - relationships["campaign"]["data"]["id"]]) - except Exception: - attr["campaign"] = None + tags = relationships.get("user_defined_tags") + attr["tags"] = [ + tag["id"].replace("user_defined;", "") + for tag in tags["data"] + if tag["type"] == "post_tag" + ] if tags else [] - tags = relationships.get("user_defined_tags") - attr["tags"] = [ - tag["id"].replace("user_defined;", "") - for tag in tags["data"] - if tag["type"] == "post_tag" - ] if tags else [] - - user = relationships["user"] - attr["creator"] = ( - self._user(user["links"]["related"]) or - included["user"][user["data"]["id"]]) + user = relationships["user"] + attr["creator"] = ( + self._user(user["links"]["related"]) or + included["user"][user["data"]["id"]]) return attr