[youtube] fix caption tracks extraction
Some checks failed
develop / build (3.10) (push) Has been cancelled
develop / build (3.11) (push) Has been cancelled
develop / build (3.12) (push) Has been cancelled
develop / build (3.13) (push) Has been cancelled
develop / build (3.7) (push) Has been cancelled
develop / build (3.8) (push) Has been cancelled
develop / build (3.9) (push) Has been cancelled
develop / build (pypy-3.10) (push) Has been cancelled
develop / build (pypy-3.8) (push) Has been cancelled
develop / build (pypy-3.9) (push) Has been cancelled

This commit is contained in:
Mort Yao 2024-12-29 13:07:53 +01:00
parent 51a7eb5efc
commit f25ddca25a
No known key found for this signature in database
GPG Key ID: 07DA00CB78203251

View File

@ -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')