[patreon] skip posts without view permission (#1316)
This commit is contained in:
@@ -34,6 +34,10 @@ class PatreonExtractor(Extractor):
|
|||||||
PatreonExtractor._warning = False
|
PatreonExtractor._warning = False
|
||||||
|
|
||||||
for post in self.posts():
|
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
|
post["num"] = 0
|
||||||
hashes = set()
|
hashes = set()
|
||||||
|
|
||||||
@@ -113,14 +117,17 @@ class PatreonExtractor(Extractor):
|
|||||||
"""Process and extend a 'post' object"""
|
"""Process and extend a 'post' object"""
|
||||||
attr = post["attributes"]
|
attr = post["attributes"]
|
||||||
attr["id"] = text.parse_int(post["id"])
|
attr["id"] = text.parse_int(post["id"])
|
||||||
attr["images"] = self._files(post, included, "images")
|
|
||||||
attr["attachments"] = self._files(post, included, "attachments")
|
if post.get("current_user_can_view", True):
|
||||||
attr["date"] = text.parse_datetime(
|
attr["images"] = self._files(post, included, "images")
|
||||||
attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
|
attr["attachments"] = self._files(post, included, "attachments")
|
||||||
user = post["relationships"]["user"]
|
attr["date"] = text.parse_datetime(
|
||||||
attr["creator"] = (
|
attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
|
||||||
self._user(user["links"]["related"]) or
|
user = post["relationships"]["user"]
|
||||||
included["user"][user["data"]["id"]])
|
attr["creator"] = (
|
||||||
|
self._user(user["links"]["related"]) or
|
||||||
|
included["user"][user["data"]["id"]])
|
||||||
|
|
||||||
return attr
|
return attr
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user