mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-10 09:07:58 +01:00
[extractor/youtube] Parse translated subtitles only when requested
Closes #4274
This commit is contained in:
parent
4f547d6d2c
commit
07b47084ba
1 changed files with 4 additions and 1 deletions
|
@ -3621,6 +3621,9 @@ def process_language(container, base_url, lang_code, sub_name, query):
|
||||||
'name': sub_name,
|
'name': sub_name,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# NB: Constructing the full subtitle dictionary is slow
|
||||||
|
get_translated_subs = 'translated_subs' not in self._configuration_arg('skip') and (
|
||||||
|
self.get_param('writeautomaticsub', False) or self.get_param('listsubtitles'))
|
||||||
subtitles, automatic_captions = {}, {}
|
subtitles, automatic_captions = {}, {}
|
||||||
for lang_code, caption_track in captions.items():
|
for lang_code, caption_track in captions.items():
|
||||||
base_url = caption_track.get('baseUrl')
|
base_url = caption_track.get('baseUrl')
|
||||||
|
@ -3640,7 +3643,7 @@ def process_language(container, base_url, lang_code, sub_name, query):
|
||||||
continue
|
continue
|
||||||
orig_trans_code = trans_code
|
orig_trans_code = trans_code
|
||||||
if caption_track.get('kind') != 'asr':
|
if caption_track.get('kind') != 'asr':
|
||||||
if 'translated_subs' in self._configuration_arg('skip'):
|
if not get_translated_subs:
|
||||||
continue
|
continue
|
||||||
trans_code += f'-{lang_code}'
|
trans_code += f'-{lang_code}'
|
||||||
trans_name += format_field(lang_name, None, ' from %s')
|
trans_name += format_field(lang_name, None, ' from %s')
|
||||||
|
|
Loading…
Reference in a new issue