Add -f bestaudio (Fixes #2163)

This commit is contained in:
Philipp Hagemeister 2014-01-22 14:47:29 +01:00
parent a70c83768e
commit ba7678f9cc
3 changed files with 43 additions and 1 deletions

View file

@ -637,6 +637,18 @@ class YoutubeDL(object):
return available_formats[-1]
elif format_spec == 'worst':
return available_formats[0]
elif format_spec == 'bestaudio':
audio_formats = [
f for f in available_formats
if f.get('vcodec') == 'none']
if audio_formats:
return audio_formats[-1]
elif format_spec == 'worstaudio':
audio_formats = [
f for f in available_formats
if f.get('vcodec') == 'none']
if audio_formats:
return audio_formats[0]
else:
extensions = ['mp4', 'flv', 'webm', '3gp']
if format_spec in extensions: