aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrzhxeo <rzhxeot7z81b4700@mailcatch.com>2013-12-18 21:22:37 +0100
committerrzhxeo <rzhxeot7z81b4700@mailcatch.com>2013-12-18 21:22:37 +0100
commite56f22ae203d10ab6d3715bc2dc1c9b927294e50 (patch)
tree266ca0712f5e9d57eaeff3c24472f0397cf10f5c
parentdbd1988ed9eb2c5eeda9d16f33f4f0387ee22922 (diff)
[YoutubeIE] Sort formats by resolution
-rw-r--r--youtube_dl/extractor/youtube.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/youtube_dl/extractor/youtube.py b/youtube_dl/extractor/youtube.py
index 793df4881..58d274970 100644
--- a/youtube_dl/extractor/youtube.py
+++ b/youtube_dl/extractor/youtube.py
@@ -1432,6 +1432,10 @@ 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)
return {
'id': video_id,