0
0
Fork 0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-24 02:35:12 +00:00

[YoutubeIE] Sort formats by resolution

This commit is contained in:
rzhxeo 2013-12-18 21:22:37 +01:00
parent dbd1988ed9
commit e56f22ae20

View file

@ -1432,6 +1432,10 @@ def _extract_count(klass):
'height': height, 'height': height,
'format_note': note, '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 { return {
'id': video_id, 'id': video_id,