projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bc2103f
)
[youtube] Prefer videos with sound
author
Philipp Hagemeister
<phihag@phihag.de>
Mon, 23 Dec 2013 03:51:42 +0000
(
04:51
+0100)
committer
Philipp Hagemeister
<phihag@phihag.de>
Mon, 23 Dec 2013 03:51:42 +0000
(
04:51
+0100)
youtube_dl/extractor/youtube.py
patch
|
blob
|
history
diff --git
a/youtube_dl/extractor/youtube.py
b/youtube_dl/extractor/youtube.py
index 9fb07b3664dd72bfc8ebbfc6dae2a11374483051..55c345e8a8d4f2c48ff2620fa56df98cecd5db6b 100644
(file)
--- 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,
})
'height': height,
'format_note': note,
})
+
def _formats_key(f):
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,
return {
'id': video_id,