Skip to content

Commit

Permalink
[tumblr] catch exception when updating image token (#2957)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikf committed Sep 30, 2022
1 parent e3a03f3 commit e1d7149
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gallery_dl/extractor/tumblr.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,13 @@ def _original_video(self, url):

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]
Expand Down

0 comments on commit e1d7149

Please sign in to comment.