1
0
Fork 0
mirror of synced 2024-06-21 11:40:21 +12:00

Catch additional errors in site downloaders

This commit is contained in:
Serene-Arc 2021-04-28 15:17:21 +10:00 committed by Serene
parent 6a20548269
commit 7fcbf623a0
2 changed files with 2 additions and 2 deletions

View file

@ -34,7 +34,7 @@ class Gfycat(GifDeliveryNetwork):
try:
out = json.loads(content.contents[0])['video']['contentUrl']
except (IndexError, KeyError) as e:
except (IndexError, KeyError, AttributeError) as e:
raise SiteDownloaderError(f'Failed to download Gfycat link {url}: {e}')
except json.JSONDecodeError as e:
raise SiteDownloaderError(f'Did not receive valid JSON data: {e}')

View file

@ -44,7 +44,7 @@ class Redgifs(GifDeliveryNetwork):
try:
out = json.loads(content.contents[0])['video']['contentUrl']
except (IndexError, KeyError):
except (IndexError, KeyError, AttributeError):
raise SiteDownloaderError('Failed to find JSON data in page')
except json.JSONDecodeError as e:
raise SiteDownloaderError(f'Received data was not valid JSON: {e}')