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:
parent
f4accb15e5
commit
fe3ed74057
|
@ -75,7 +75,7 @@ def youtube(inp):
|
|||
if 'error' in j:
|
||||
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'
|
||||
|
||||
vid_id = j['data']['items'][0]['id']
|
||||
|
|
Loading…
Reference in New Issue