mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-08-16 20:31:05 +02:00
[youtube] Prefer videos with sound
This commit is contained in:
parent
bc2103f3bf
commit
d80044c235
@ -1432,10 +1432,17 @@ def _extract_count(klass):
|
|||||||
'height': height,
|
'height': height,
|
||||||
'format_note': note,
|
'format_note': note,
|
||||||
})
|
})
|
||||||
|
|
||||||
def _formats_key(f):
|
def _formats_key(f):
|
||||||
return (f.get('height') if f.get('height') is not None else -1,
|
note = f.get('format_note')
|
||||||
|
if note is None:
|
||||||
|
note = u''
|
||||||
|
is_dash = u'DASH' in note
|
||||||
|
return (
|
||||||
|
0 if is_dash else 1,
|
||||||
|
f.get('height') if f.get('height') is not None else -1,
|
||||||
f.get('width') if f.get('width') is not None else -1)
|
f.get('width') if f.get('width') is not None else -1)
|
||||||
formats = sorted(formats, key=_formats_key)
|
formats.sort(key=_formats_key)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
|
Loading…
Reference in New Issue
Block a user