[patreon] extract user defined 'tags' (#1539, closes #1540)

pull/1578/head
Mike Fährmann 3 years ago
parent a7e4917ee1
commit 24dd10ac3c
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -117,12 +117,22 @@ class PatreonExtractor(Extractor):
attr = post["attributes"]
attr["id"] = text.parse_int(post["id"])
if post.get("current_user_can_view", True):
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["date"] = text.parse_datetime(
attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
user = post["relationships"]["user"]
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"]])
@ -299,6 +309,10 @@ class PatreonPostExtractor(PatreonExtractor):
("https://www.patreon.com/posts/19987002", {
"count": 4,
}),
# tags (#1539)
("https://www.patreon.com/posts/free-post-12497641", {
"keyword": {"tags": ["AWMedia"]},
}),
("https://www.patreon.com/posts/not-found-123", {
"exception": exception.NotFoundError,
}),

Loading…
Cancel
Save