[patreon] handle exception for suspended accounts

This commit is contained in:
Mike Fährmann
2024-10-01 07:46:07 +02:00
parent 319c3a4c9b
commit 3d4191fc0d
2 changed files with 16 additions and 21 deletions

View File

@@ -379,7 +379,15 @@ class PatreonPostExtractor(PatreonExtractor):
def posts(self):
url = "{}/posts/{}".format(self.root, self.groups[0])
page = self.request(url, notfound="post").text
post = self._extract_bootstrap(page)["post"]
bootstrap = self._extract_bootstrap(page)
try:
post = bootstrap["post"]
except KeyError:
self.log.debug(bootstrap)
if bootstrap.get("campaignDisciplinaryStatus") == "suspended":
self.log.warning("Account suspended")
return ()
included = self._transform(post["included"])
return (self._process(post["data"], included),)