[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(
|
tbr = float_or_none(
|
||||||
fmt.get('averageBitrate') or fmt.get('bitrate'), 1000)
|
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 = {
|
dct = {
|
||||||
'asr': int_or_none(fmt.get('audioSampleRate')),
|
'asr': int_or_none(fmt.get('audioSampleRate')),
|
||||||
'filesize': int_or_none(fmt.get('contentLength')),
|
'filesize': int_or_none(fmt.get('contentLength')),
|
||||||
'format_id': itag,
|
'format_id': itag,
|
||||||
'format_note': join_nonempty(
|
'format_note': join_nonempty(
|
||||||
'%s%s' % (audio_track.get('displayName') or '',
|
'%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_', ''),
|
fmt.get('qualityLabel') or quality.replace('audio_quality_', ''),
|
||||||
throttled and 'THROTTLED', delim=', '),
|
throttled and 'THROTTLED', delim=', '),
|
||||||
'source_preference': -10 if throttled else -1,
|
'source_preference': -10 if throttled else -1,
|
||||||
|
@ -3022,8 +3026,9 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
|
||||||
'tbr': tbr,
|
'tbr': tbr,
|
||||||
'url': fmt_url,
|
'url': fmt_url,
|
||||||
'width': int_or_none(fmt.get('width')),
|
'width': int_or_none(fmt.get('width')),
|
||||||
'language': audio_track.get('id', '').split('.')[0],
|
'language': join_nonempty(audio_track.get('id', '').split('.')[0],
|
||||||
'language_preference': 1 if audio_track.get('audioIsDefault') else -1,
|
'desc' if language_preference < -1 else ''),
|
||||||
|
'language_preference': language_preference,
|
||||||
}
|
}
|
||||||
mime_mobj = re.match(
|
mime_mobj = re.match(
|
||||||
r'((?:[^/]+)/(?:[^;]+))(?:;\s*codecs="([^"]+)")?', fmt.get('mimeType') or '')
|
r'((?:[^/]+)/(?:[^;]+))(?:;\s*codecs="([^"]+)")?', fmt.get('mimeType') or '')
|
||||||
|
|
Loading…
Reference in a new issue