Closed hatemrizk closed 1 year ago
Hi @hatemrizk, are you sure you are able to see the subtitles when opening https://www.youtube.com/watch?v=bo9hXBdTfzQ ? For me the YouTube player says that transcripts are disabled, which is in line with the error message.
You are correct. It was enabled when I tried it and displayed captions but when I try it now I see it is disabled. Looks like it is working as it should.
To Reproduce
Steps to reproduce the behavior: normal api call to download captions for https://www.youtube.com/watch?v=bo9hXBdTfzQ
Which Python version are you using?
3.7.15
Which version of youtube-transcript-api are you using?
0.5.0
What code / cli command are you executing?
video_link = 'https://www.youtube.com/watch?v=bo9hXBdTfzQ'
Extract video id
video_id = video_link.split('watch?v=')[1]
Download caption information
subtitle = YouTubeTranscriptApi.get_transcript(video_id=video_id, languages=['en'])
Expected behavior
Describe what you expected to happen. Instead of recieving caption information I get an error. I am able to display captions in the Youtube app so I don't think they are disabled.
Actual behaviour
Describe what is happening instead of the Expected behavior. Add error messages if there are any.
TranscriptsDisabled Traceback (most recent call last) in
8
9 #Download caption information
---> 10 subtitle = YouTubeTranscriptApi.get_transcript(video_id=video_id, languages=['en'])
11
12 print(subtitle)
3 frames /usr/local/lib/python3.7/dist-packages/youtube_transcript_api/_transcripts.py in _extract_captions_json(self, html, video_id) 57 raise VideoUnavailable(video_id) 58 ---> 59 raise TranscriptsDisabled(video_id) 60 61 captions_json = json.loads(
TranscriptsDisabled: Could not retrieve a transcript for the video https://www.youtube.com/watch?v=bo9hXBdTfzQ! This is most likely caused by:
Subtitles are disabled for this video