Catch additional errors in site downloaders
This commit is contained in:
parent
6a20548269
commit
7fcbf623a0
2 changed files with 2 additions and 2 deletions
|
@ -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}')
|
||||
|
|
|
@ -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}')
|
||||
|
|
Loading…
Reference in a new issue