mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-17 08:24:01 +01:00
[extractor/youtube] Determine audio language using automatic captions
This commit is contained in:
parent
0a5d7c39e1
commit
ff9b0e071f
@ -4312,9 +4312,13 @@ def process_language(container, base_url, lang_code, sub_name, query):
|
||||
continue
|
||||
trans_code += f'-{lang_code}'
|
||||
trans_name += format_field(lang_name, None, ' from %s')
|
||||
# Add an "-orig" label to the original language so that it can be distinguished.
|
||||
# The subs are returned without "-orig" as well for compatibility
|
||||
if lang_code == f'a-{orig_trans_code}':
|
||||
# Set audio language based on original subtitles
|
||||
for f in formats:
|
||||
if f.get('acodec') != 'none' and not f.get('language'):
|
||||
f['language'] = orig_trans_code
|
||||
# Add an "-orig" label to the original language so that it can be distinguished.
|
||||
# The subs are returned without "-orig" as well for compatibility
|
||||
process_language(
|
||||
automatic_captions, base_url, f'{trans_code}-orig', f'{trans_name} (Original)', {})
|
||||
# Setting tlang=lang returns damaged subtitles.
|
||||
|
Loading…
Reference in New Issue
Block a user