projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f03b88b
)
[YT Search] No results if items is not in response
author
Juan M
<joksnet@gmail.com>
Tue, 26 Feb 2013 17:06:43 +0000
(18:06 +0100)
committer
Juan M
<joksnet@gmail.com>
Tue, 26 Feb 2013 17:06:43 +0000
(18:06 +0100)
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.
youtube_dl/InfoExtractors.py
patch
|
blob
|
history
diff --git
a/youtube_dl/InfoExtractors.py
b/youtube_dl/InfoExtractors.py
index d661d517dea96e09819ec52f58cf0205f40b0d72..a9646433ef83e9ef6725d1d3f7a3c5f31139c978 100755
(executable)
--- a/
youtube_dl/InfoExtractors.py
+++ b/
youtube_dl/InfoExtractors.py
@@
-1478,6
+1478,10
@@
class YoutubeSearchIE(InfoExtractor):
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