mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-12-14 15:22:35 +00:00
[youtube] Prefer audio stream that YouTube considers default
Fixes: https://github.com/ytdl-org/youtube-dl/issues/29864 Related: https://github.com/clsid2/mpc-hc/issues/1268
This commit is contained in:
parent
198e3a04c9
commit
26e8e04454
1 changed files with 4 additions and 2 deletions
|
@ -2622,7 +2622,8 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
'filesize': int_or_none(fmt.get('contentLength')),
|
||||
'format_id': itag,
|
||||
'format_note': ', '.join(filter(None, (
|
||||
audio_track.get('displayName'),
|
||||
'%s%s' % (audio_track.get('displayName') or '',
|
||||
' (default)' if audio_track.get('audioIsDefault') else ''),
|
||||
fmt.get('qualityLabel') or quality.replace('audio_quality_', '')))),
|
||||
'fps': int_or_none(fmt.get('fps')),
|
||||
'height': height,
|
||||
|
@ -2631,6 +2632,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
'url': fmt_url,
|
||||
'width': int_or_none(fmt.get('width')),
|
||||
'language': audio_track.get('id', '').split('.')[0],
|
||||
'language_preference': 1 if audio_track.get('audioIsDefault') else -1,
|
||||
}
|
||||
mime_mobj = re.match(
|
||||
r'((?:[^/]+)/(?:[^;]+))(?:;\s*codecs="([^"]+)")?', fmt.get('mimeType') or '')
|
||||
|
@ -2817,7 +2819,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
|
||||
# Source is given priority since formats that throttle are given lower source_preference
|
||||
# When throttling issue is fully fixed, remove this
|
||||
self._sort_formats(formats, ('quality', 'height', 'fps', 'source'))
|
||||
self._sort_formats(formats, ('quality', 'res', 'fps', 'source', 'codec:vp9.2', 'size', 'br', 'lang'))
|
||||
|
||||
keywords = get_first(video_details, 'keywords', expected_type=list) or []
|
||||
if not keywords and webpage:
|
||||
|
|
Loading…
Reference in a new issue