summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorrzhxeo <[email protected]>2013-12-18 21:25:13 +0100
committerrzhxeo <[email protected]>2013-12-18 21:25:13 +0100
commit62d68c43ed76fab391eacfd52f0391936ef0a4dc (patch)
tree099c1bfdb28958e14f7232979cdef443e0ef39a8
parentbfaae0a768d455112e003f6200edfdafb22affd6 (diff)
downloadyoutube-dl-62d68c43ed76fab391eacfd52f0391936ef0a4dc.tar.gz
youtube-dl-62d68c43ed76fab391eacfd52f0391936ef0a4dc.zip
Make prefer_free_formats sorting more robust
-rw-r--r--youtube_dl/YoutubeDL.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index fd26f00b7..a93dd41a3 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -674,7 +674,9 @@ class YoutubeDL(object):
except ValueError:
ext_ord = -1
# We only compare the extension if they have the same height and width
- return (f.get('height'), f.get('width'), ext_ord)
+ 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,
+ ext_ord)
formats = sorted(formats, key=_free_formats_key)
info_dict['formats'] = formats