]> git.bitcoin.ninja Git - youtube-dl/commitdiff
[YoutubeDL] add fallback value for thumbnails values in thumbnails sorting
authorRemita Amine <remitamine@gmail.com>
Thu, 25 Aug 2016 07:46:54 +0000 (08:46 +0100)
committerRemita Amine <remitamine@gmail.com>
Thu, 25 Aug 2016 07:49:44 +0000 (08:49 +0100)
youtube_dl/YoutubeDL.py

index 0b3e3da823c13351abce111be2dd8ffa105212dc..c499c1da40e652ab58df5558b67a1661459de34f 100755 (executable)
@@ -1256,8 +1256,8 @@ class YoutubeDL(object):
                 info_dict['thumbnails'] = thumbnails = [{'url': thumbnail}]
         if thumbnails:
             thumbnails.sort(key=lambda t: (
-                t.get('preference'), t.get('width'), t.get('height'),
-                t.get('id'), t.get('url')))
+                t.get('preference') or -1, t.get('width') or -1, t.get('height') or -1,
+                t.get('id') or '', t.get('url')))
             for i, t in enumerate(thumbnails):
                 t['url'] = sanitize_url(t['url'])
                 if t.get('width') and t.get('height'):