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

[instagram] make post-page extraction nonfatal

This commit is contained in:
Mike Fährmann 2019-12-15 22:56:27 +01:00
parent 922b8a9595
commit 72b8fbfbad
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -109,8 +109,14 @@ class InstagramExtractor(Extractor):
return data
def _extract_postpage(self, url):
data = self.request(url + "?__a=1").json()
media = data['graphql']['shortcode_media']
try:
with self.request(url + '?__a=1', fatal=False) as response:
media = response.json()['graphql']['shortcode_media']
except (KeyError, ValueError) as exc:
self.log.warning("Unable to fetch data from '%s': %s: %s",
url, exc.__class__.__name__, exc)
self.log.debug("Server response: %s", response.text)
return ()
common = {
'date': text.parse_timestamp(media['taken_at_timestamp']),