aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/watch.py
diff options
context:
space:
mode:
authorJames Taylor <28744867+user234683@users.noreply.github.com>2022-03-23 00:34:39 -0700
committerJesús <heckyel@hyperbola.info>2022-03-30 00:37:43 +0800
commitdcd4b0f0aeee19755d3d732695e94c51be54522c (patch)
tree8ead59d12131b7df2cc9ce1e9ca8dca8eba09611 /youtube/watch.py
parente8cbc5074a7f25b3c513c9ce7f3a4a9797330d11 (diff)
downloadyt-local-dcd4b0f0aeee19755d3d732695e94c51be54522c.tar.lz
yt-local-dcd4b0f0aeee19755d3d732695e94c51be54522c.tar.xz
yt-local-dcd4b0f0aeee19755d3d732695e94c51be54522c.zip
Fix exception when _captions_base_url is not present
Signed-off-by: Jesús <heckyel@hyperbola.info>
Diffstat (limited to 'youtube/watch.py')
-rw-r--r--youtube/watch.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube/watch.py b/youtube/watch.py
index 886f2a4..3533f30 100644
--- a/youtube/watch.py
+++ b/youtube/watch.py
@@ -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']: