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:
parent
e3a03f335c
commit
e1d714943b
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user