[youtube] Differentiate descriptive audio by language code
Related: #2677
This commit is contained in:
parent
0c8d9e5fec
commit
ab6df717d1
1 changed files with 8 additions and 3 deletions
|
@ -3006,13 +3006,17 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
|
||||
tbr = float_or_none(
|
||||
fmt.get('averageBitrate') or fmt.get('bitrate'), 1000)
|
||||
language_preference = (
|
||||
10 if audio_track.get('audioIsDefault') and 10
|
||||
else -10 if 'descriptive' in (audio_track.get('displayName') or '').lower() and -10
|
||||
else -1)
|
||||
dct = {
|
||||
'asr': int_or_none(fmt.get('audioSampleRate')),
|
||||
'filesize': int_or_none(fmt.get('contentLength')),
|
||||
'format_id': itag,
|
||||
'format_note': join_nonempty(
|
||||
'%s%s' % (audio_track.get('displayName') or '',
|
||||
' (default)' if audio_track.get('audioIsDefault') else ''),
|
||||
' (default)' if language_preference > 0 else ''),
|
||||
fmt.get('qualityLabel') or quality.replace('audio_quality_', ''),
|
||||
throttled and 'THROTTLED', delim=', '),
|
||||
'source_preference': -10 if throttled else -1,
|
||||
|
@ -3022,8 +3026,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
|||
'tbr': tbr,
|
||||
'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,
|
||||
'language': join_nonempty(audio_track.get('id', '').split('.')[0],
|
||||
'desc' if language_preference < -1 else ''),
|
||||
'language_preference': language_preference,
|
||||
}
|
||||
mime_mobj = re.match(
|
||||
r'((?:[^/]+)/(?:[^;]+))(?:;\s*codecs="([^"]+)")?', fmt.get('mimeType') or '')
|
||||
|
|
Loading…
Reference in a new issue