mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 03:03:01 +00:00
[YT Search] No results if items is not in response
When a query results of 0 items, the key items is not present in the api_response dictionary, raising a KeyError. Intead, look for the key and call trouble if it's not present.
This commit is contained in:
parent
f03b88b3fb
commit
9e07cf2955
1 changed files with 4 additions and 0 deletions
|
@ -1478,6 +1478,10 @@ def _download_n_results(self, query, n):
|
|||
return
|
||||
api_response = json.loads(data)['data']
|
||||
|
||||
if not 'items' in api_response:
|
||||
self._downloader.trouble(u'[youtube] No video results')
|
||||
return
|
||||
|
||||
new_ids = list(video['id'] for video in api_response['items'])
|
||||
video_ids += new_ids
|
||||
|
||||
|
|
Loading…
Reference in a new issue