aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemita Amine <remitamine@gmail.com>2016-08-25 11:53:47 +0100
committerRemita Amine <remitamine@gmail.com>2016-08-25 11:53:47 +0100
commitd37708fc861b3534c522f2892b5cd2ee716e1035 (patch)
treeb669b7b094f79eff6915abba3d1b334fbdc82506
parent5c13c285660c2811206c5bb29acf43b114ab31e3 (diff)
downloadyoutube-dl-d37708fc861b3534c522f2892b5cd2ee716e1035.tar.xz
[YoutubeDL] check only for None Value in thumbnails sorting
-rwxr-xr-xyoutube_dl/YoutubeDL.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index c499c1da4..805733fb7 100755
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -1256,8 +1256,10 @@ class YoutubeDL(object):
info_dict['thumbnails'] = thumbnails = [{'url': thumbnail}]
if thumbnails:
thumbnails.sort(key=lambda t: (
- t.get('preference') or -1, t.get('width') or -1, t.get('height') or -1,
- t.get('id') or '', t.get('url')))
+ t.get('preference') if t.get('preference') is not None else -1,
+ t.get('width') if t.get('width') is not None else -1,
+ t.get('height') if t.get('height') is not None else -1,
+ t.get('id') if t.get('id') is not None else '', t.get('url')))
for i, t in enumerate(thumbnails):
t['url'] = sanitize_url(t['url'])
if t.get('width') and t.get('height'):