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!
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
Steps to reproduce the behavior:
What code / cli command are you executing?
I am running
from youtube_transcript_api import YouTubeTranscriptApi
transcript_list = YouTubeTranscriptApi.list_transcripts('Pm0GunxFVas')
Which Python version are you using?
Python 3.8.10
Which version of youtube-transcript-api are you using?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home//venv/lib/python3.8/site-packages/youtube_transcript_api/_api.py", line 71, in list_transcripts
return TranscriptListFetcher(http_client).fetch(video_id)
File "/home//venv/lib/python3.8/site-packages/youtube_transcript_api/_transcripts.py", line 48, in fetch
self._extract_captions_json(self._fetch_video_html(video_id), video_id),
File "/home//venv/lib/python3.8/site-packages/youtube_transcript_api/_transcripts.py", line 62, in _extract_captions_json
raise TranscriptsDisabled(video_id)
youtube_transcript_api._errors.TranscriptsDisabled:
Could not retrieve a transcript for the video https://www.youtube.com/watch?v=Pm0GunxFVas! 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
Steps to reproduce the behavior:
What code / cli command are you executing?
I am running
Which Python version are you using?
Python 3.8.10
Which version of youtube-transcript-api are you using?
youtube-transcript-api 0.6.1
Expected behavior
I expected to get back machine-generated subtitles as https://www.youtube.com/watch?v=Pm0GunxFVas has subtitles associated with it.
Actual behavior
Instead, I received the following error message: