aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/YoutubeDL.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-01-22 14:47:29 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-01-22 14:47:29 +0100
commitba7678f9cc1099313f3fa9221538116a24e8e627 (patch)
treee1e6d6d3ba3e72e7870392d857f102236a0ab5e2 /youtube_dl/YoutubeDL.py
parenta70c83768e30c99479af04c7cb229545743a9134 (diff)
Add -f bestaudio (Fixes #2163)
Diffstat (limited to 'youtube_dl/YoutubeDL.py')
-rw-r--r--youtube_dl/YoutubeDL.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index c6430d367..9f15616fa 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -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: