mirror of
https://github.com/viq/NewsBlur.git
synced 2025-04-13 09:38:09 +00:00
Handling YouTube client errors gracefully.
This commit is contained in:
parent
b6e1e03bd5
commit
3d92dfd0ad
1 changed files with 3 additions and 3 deletions
|
@ -172,7 +172,7 @@ class FetchFeed:
|
|||
try:
|
||||
username = channel['items'][0]['snippet']['title']
|
||||
description = channel['items'][0]['snippet']['description']
|
||||
except IndexError:
|
||||
except (IndexError, KeyError):
|
||||
return
|
||||
elif list_id:
|
||||
playlist_json = requests.get("https://www.googleapis.com/youtube/v3/playlists?part=snippet&id=%s&key=%s" %
|
||||
|
@ -181,7 +181,7 @@ class FetchFeed:
|
|||
try:
|
||||
username = playlist['items'][0]['snippet']['title']
|
||||
description = playlist['items'][0]['snippet']['description']
|
||||
except IndexError:
|
||||
except (IndexError, KeyError):
|
||||
return
|
||||
channel_url = "https://www.youtube.com/playlist?list=%s" % list_id
|
||||
elif username:
|
||||
|
@ -196,7 +196,7 @@ class FetchFeed:
|
|||
playlist = json.decode(playlist_json.content)
|
||||
try:
|
||||
video_ids = [video['snippet']['resourceId']['videoId'] for video in playlist['items']]
|
||||
except IndexError:
|
||||
except (IndexError, KeyError):
|
||||
return
|
||||
else:
|
||||
if video_ids_xml.status_code != 200:
|
||||
|
|
Loading…
Add table
Reference in a new issue