This is a python API which allows you to get the transcript/subtitles for a given YouTube video. It also works for automatically generated subtitles and it does not require an API key nor a headless browser, like other selenium based solutions do!
MIT License
2.55k
stars
280
forks
source link
TranscriptsDisabled: Could not retrieve a transcript for the video https://www.youtube.com/watch?v=v=v6sF8Ed3nTE! This is most likely caused by: Subtitles are disabled for this video #207
DO NOT DELETE THIS! Please take the time to fill this out properly. I am not able to help you if I do not know what you are executing and what error messages you are getting. If you are having problems with a specific video make sure to include the video id.
To Reproduce
from youtube_transcript_api import YouTubeTranscriptApi
Get the transcript for a YouTube video by video ID
from youtube_transcript_api import YouTubeTranscriptApi
# Get the transcript for a YouTube video by video ID
video_id = 'v=v6sF8Ed3nTE'
transcript = YouTubeTranscriptApi.get_transcript(video_id)
# Print out the transcript
for line in transcript:
print(line['text'])
Which Python version are you using?
Python 3.10
Which version of youtube-transcript-api are you using?
youtube_transcript_api-0.6.0
Expected behavior
The package should retrive the transcript from the youtube video.
For example: I expected to receive the english transcript . I have checked the video in Youtube .The subtitle option is not disabled
Youtube URL " https://www.youtube.com/watch?v=v6sF8Ed3nTE
Actual behaviour
Describe what is happening instead of the Expected behavior. Add error messages if there are any.
For example: Instead I received the following error message:
TranscriptsDisabled Traceback (most recent call last)
[<ipython-input-3-c6040c6c8a54>](https://localhost:8080/#) in <cell line: 5>()
3 # Get the transcript for a YouTube video by video ID
4 video_id = 'v=v6sF8Ed3nTE'
----> 5 transcript = YouTubeTranscriptApi.get_transcript(video_id)
6
7 # Print out the transcript
3 frames
[/usr/local/lib/python3.10/dist-packages/youtube_transcript_api/_transcripts.py](https://localhost:8080/#) in _extract_captions_json(self, html, video_id)
60 raise VideoUnavailable(video_id)
61
---> 62 raise TranscriptsDisabled(video_id)
63
64 captions_json = json.loads(
TranscriptsDisabled:
Could not retrieve a transcript for the video https://www.youtube.com/watch?v=v=v6sF8Ed3nTE! This is most likely caused by:
Subtitles are disabled for this video
If you are sure that the described cause is not responsible for this error and that a transcript should be retrievable, please create an issue at https://github.com/jdepoix/youtube-transcript-api/issues. Please add which version of youtube_transcript_api you are using and provide the information needed to replicate the error. Also make sure that there are no open issues which already describe your problem!
DO NOT DELETE THIS! Please take the time to fill this out properly. I am not able to help you if I do not know what you are executing and what error messages you are getting. If you are having problems with a specific video make sure to include the video id.
To Reproduce
from youtube_transcript_api import YouTubeTranscriptApi
Get the transcript for a YouTube video by video ID
video_id = 'v=v6sF8Ed3nTE' transcript = YouTubeTranscriptApi.get_transcript(video_id)
Print out the transcript
for line in transcript: print(line['text'])
What code / cli command are you executing?
For example: I am running
Which Python version are you using?
Python 3.10
Which version of youtube-transcript-api are you using?
youtube_transcript_api-0.6.0
Expected behavior
The package should retrive the transcript from the youtube video. For example: I expected to receive the english transcript . I have checked the video in Youtube .The subtitle option is not disabled Youtube URL " https://www.youtube.com/watch?v=v6sF8Ed3nTE
Actual behaviour
Describe what is happening instead of the Expected behavior. Add error messages if there are any.
For example: Instead I received the following error message: