From f25ddca25afb1a779fbb5f884011da1d003b39f2 Mon Sep 17 00:00:00 2001 From: Mort Yao Date: Sun, 29 Dec 2024 13:07:53 +0100 Subject: [PATCH] [youtube] fix caption tracks extraction --- src/you_get/extractors/youtube.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/you_get/extractors/youtube.py b/src/you_get/extractors/youtube.py index 59f22c3c..8ecdc8ae 100644 --- a/src/you_get/extractors/youtube.py +++ b/src/you_get/extractors/youtube.py @@ -286,6 +286,8 @@ class YouTube(VideoExtractor): for ct in caption_tracks: ttsurl, lang = ct['baseUrl'], ct['languageCode'] + if ttsurl.startswith('/'): + ttsurl = 'https://www.youtube.com' + ttsurl tts_xml = parseString(get_content(ttsurl)) transcript = tts_xml.getElementsByTagName('transcript')[0] texts = transcript.getElementsByTagName('text')