1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-23 03:02:50 +01:00

[patreon] skip posts without view permission (#1316)

This commit is contained in:
Mike Fährmann 2021-02-14 16:03:11 +01:00
parent dcbd995346
commit ba693d8686
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -34,6 +34,10 @@ class PatreonExtractor(Extractor):
PatreonExtractor._warning = False
for post in self.posts():
if not post.get("current_user_can_view", True):
self.log.warning("Not allowed to view post %s", post["id"])
continue
post["num"] = 0
hashes = set()
@ -113,14 +117,17 @@ class PatreonExtractor(Extractor):
"""Process and extend a 'post' object"""
attr = post["attributes"]
attr["id"] = text.parse_int(post["id"])
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"]
attr["creator"] = (
self._user(user["links"]["related"]) or
included["user"][user["data"]["id"]])
if post.get("current_user_can_view", True):
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"]
attr["creator"] = (
self._user(user["links"]["related"]) or
included["user"][user["data"]["id"]])
return attr
@staticmethod