Fix exception when _captions_base_url is not present

Signed-off-by: Jesús <heckyel@hyperbola.info>
This commit is contained in:
James Taylor
2022-03-23 00:34:39 -07:00
committed by Jesús
parent e8cbc5074a
commit dcd4b0f0ae
3 changed files with 9 additions and 2 deletions

View File

@@ -176,7 +176,7 @@ def make_caption_src(info, lang, auto=False, trans_lang=None):
if trans_lang:
label += ' -> ' + trans_lang
return {
'url': '/' + yt_data_extract.get_caption_url(info, lang, 'vtt', auto, trans_lang),
'url': util.prefix_url(yt_data_extract.get_caption_url(info, lang, 'vtt', auto, trans_lang)),
'label': label,
'srclang': trans_lang[0:2] if trans_lang else lang[0:2],
'on': False,
@@ -220,6 +220,8 @@ def get_subtitle_sources(info):
pref_lang (Automatic)
pref_lang (Manual)'''
sources = []
if not yt_data_extract.captions_available(info):
return []
pref_lang = settings.subtitles_language
native_video_lang = None
if info['automatic_caption_languages']: