[YoutubeDL] format spec: Do not fail when a filter gives an empty result

For example with 'best[height<40]' we ended getting a 'IndexError: list index out of range'.
This commit is contained in:
Jaime Marquínez Ferrándiz 2015-07-04 21:41:09 +02:00
parent f5f4a27a96
commit bb8e553662
2 changed files with 11 additions and 1 deletions

View file

@ -1005,6 +1005,9 @@ class YoutubeDL(object):
format_spec = selector.selector
def selector_function(formats):
formats = list(formats)
if not formats:
return
if format_spec == 'all':
for f in formats:
yield f