@@ -117,12 +117,22 @@ class PatreonExtractor(Extractor):
|
|||||||
attr = post["attributes"]
|
attr = post["attributes"]
|
||||||
attr["id"] = text.parse_int(post["id"])
|
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["images"] = self._files(post, included, "images")
|
||||||
attr["attachments"] = self._files(post, included, "attachments")
|
attr["attachments"] = self._files(post, included, "attachments")
|
||||||
attr["date"] = text.parse_datetime(
|
attr["date"] = text.parse_datetime(
|
||||||
attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
|
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"] = (
|
attr["creator"] = (
|
||||||
self._user(user["links"]["related"]) or
|
self._user(user["links"]["related"]) or
|
||||||
included["user"][user["data"]["id"]])
|
included["user"][user["data"]["id"]])
|
||||||
@@ -299,6 +309,10 @@ class PatreonPostExtractor(PatreonExtractor):
|
|||||||
("https://www.patreon.com/posts/19987002", {
|
("https://www.patreon.com/posts/19987002", {
|
||||||
"count": 4,
|
"count": 4,
|
||||||
}),
|
}),
|
||||||
|
# tags (#1539)
|
||||||
|
("https://www.patreon.com/posts/free-post-12497641", {
|
||||||
|
"keyword": {"tags": ["AWMedia"]},
|
||||||
|
}),
|
||||||
("https://www.patreon.com/posts/not-found-123", {
|
("https://www.patreon.com/posts/not-found-123", {
|
||||||
"exception": exception.NotFoundError,
|
"exception": exception.NotFoundError,
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user