1
0
mirror of https://github.com/mikf/gallery-dl.git synced 2024-11-22 10:42:34 +01:00

[patreon] make retrieving user info nonfatal (#508)

… and fall back to the included data if an error occurs.
This commit is contained in:
Mike Fährmann 2019-12-12 00:31:35 +01:00
parent 964dc57286
commit 9e63804347
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88
2 changed files with 9 additions and 4 deletions

View File

@ -97,8 +97,10 @@ class PatreonExtractor(Extractor):
attr["attachments"] = self._files(post, included, "attachments")
attr["date"] = text.parse_datetime(
attr["published_at"], "%Y-%m-%dT%H:%M:%S.%f%z")
uid = post["relationships"]["user"]["data"]["id"]
attr["creator"] = included["user"][uid]
user = post["relationships"]["user"]
attr["creator"] = (
self._user(user["links"]["related"]) or
included["user"][user["data"]["id"]])
return attr
@staticmethod
@ -123,7 +125,10 @@ class PatreonExtractor(Extractor):
@memcache(keyarg=1)
def _user(self, url):
"""Fetch user information"""
user = self.request(url).json()["data"]
response = self.request(url, fatal=False)
if response.status_code >= 400:
return None
user = response.json()["data"]
attr = user["attributes"]
attr["id"] = user["id"]
attr["date"] = text.parse_datetime(

View File

@ -21,7 +21,7 @@ TRAVIS_SKIP = {
"exhentai", "kissmanga", "mangafox", "dynastyscans", "nijie", "bobx",
"archivedmoe", "archiveofsins", "thebarchive", "fireden", "4plebs",
"sankaku", "idolcomplex", "mangahere", "readcomiconline", "mangadex",
"sankakucomplex", "warosu", "fuskator", "patreon",
"sankakucomplex", "warosu", "fuskator",
}
# temporary issues, etc.