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

[tumblr] catch exception when updating image token (#2957)

This commit is contained in:
Mike Fährmann 2022-09-30 15:08:21 +02:00
parent e3a03f335c
commit e1d714943b
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

View File

@ -241,9 +241,13 @@ class TumblrExtractor(Extractor):
def _update_image_token(self, resized):
headers = {"Accept": "text/html,*/*;q=0.8"}
response = self.request(resized, headers=headers)
updated = text.extract(response.text, '" src="', '"')[0]
return updated, (resized == updated)
try:
response = self.request(resized, headers=headers)
except Exception:
return resized, True
else:
updated = text.extract(response.text, '" src="', '"')[0]
return updated, (resized == updated)
def _original_image_fallback(self, url, post_id):
yield self._update_image_token(url)[0]