Accounts for situations where no videos are returned.

Sometimes, Youtube will say that there is one result,
but won't return anything.
This commit is contained in:
Bryan Koroleski 2014-09-25 13:22:20 -05:00
parent f4accb15e5
commit fe3ed74057
1 changed files with 1 additions and 1 deletions

View File

@ -75,7 +75,7 @@ def youtube(inp):
if 'error' in j: if 'error' in j:
return 'error while performing the search' return 'error while performing the search'
if j['data']['totalItems'] == 0: if j['data']['totalItems'] == 0 or 'items' not in j['data']:
return 'no results found' return 'no results found'
vid_id = j['data']['items'][0]['id'] vid_id = j['data']['items'][0]['id']