[patreon] extract more metadata for paywalled posts (#6582)
https://github.com/mikf/gallery-dl/issues/6582#issuecomment-3002275572
This commit is contained in:
@@ -156,35 +156,33 @@ class PatreonExtractor(Extractor):
|
|||||||
attr = post["attributes"]
|
attr = post["attributes"]
|
||||||
attr["id"] = text.parse_int(post["id"])
|
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"]
|
try:
|
||||||
attr["images"] = self._files(
|
attr["campaign"] = (included["campaign"][
|
||||||
post, included, "images")
|
relationships["campaign"]["data"]["id"]])
|
||||||
attr["attachments"] = self._files(
|
except Exception:
|
||||||
post, included, "attachments")
|
attr["campaign"] = None
|
||||||
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:
|
tags = relationships.get("user_defined_tags")
|
||||||
attr["campaign"] = (included["campaign"][
|
attr["tags"] = [
|
||||||
relationships["campaign"]["data"]["id"]])
|
tag["id"].replace("user_defined;", "")
|
||||||
except Exception:
|
for tag in tags["data"]
|
||||||
attr["campaign"] = None
|
if tag["type"] == "post_tag"
|
||||||
|
] if tags else []
|
||||||
|
|
||||||
tags = relationships.get("user_defined_tags")
|
user = relationships["user"]
|
||||||
attr["tags"] = [
|
attr["creator"] = (
|
||||||
tag["id"].replace("user_defined;", "")
|
self._user(user["links"]["related"]) or
|
||||||
for tag in tags["data"]
|
included["user"][user["data"]["id"]])
|
||||||
if tag["type"] == "post_tag"
|
|
||||||
] if tags else []
|
|
||||||
|
|
||||||
user = relationships["user"]
|
|
||||||
attr["creator"] = (
|
|
||||||
self._user(user["links"]["related"]) or
|
|
||||||
included["user"][user["data"]["id"]])
|
|
||||||
|
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user