aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/youtube.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-12-23 04:51:42 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2013-12-23 04:51:42 +0100
commitd80044c235afcbcfa905ab08a82f6f972df25268 (patch)
treed4bb3c451e5dd9202c4573e02e77ae4a3d043783 /youtube_dl/extractor/youtube.py
parentbc2103f3bf2aafdf28897a935a837e817f389626 (diff)
[youtube] Prefer videos with sound
Diffstat (limited to 'youtube_dl/extractor/youtube.py')
-rw-r--r--youtube_dl/extractor/youtube.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 9fb07b366..55c345e8a 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1432,10 +1432,17 @@ class YoutubeIE(YoutubeBaseInfoExtractor, SubtitlesInfoExtractor):
'height': height,
'format_note': note,
})
+
def _formats_key(f):
- return (f.get('height') if f.get('height') is not None else -1,
- f.get('width') if f.get('width') is not None else -1)
- formats = sorted(formats, key=_formats_key)
+ note = f.get('format_note')
+ if note is None:
+ note = u''
+ is_dash = u'DASH' in note
+ return (
+ 0 if is_dash else 1,
+ f.get('height') if f.get('height') is not None else -1,
+ f.get('width') if f.get('width') is not None else -1)
+ formats.sort(key=_formats_key)
return {
'id': video_id,