jdepoix / youtube-transcript-api

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

"Subtitles are disabled for this video" but subtitles exist #205

Closed drewmw5 closed 1 year ago

drewmw5 commented 1 year ago

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

youtube_transcript_api voD2wPDFSto

Which Python version are you using?

Python 3.10.6

Which version of youtube-transcript-api are you using?

youtube-transcript-api 0.6.0

Expected behavior

I expected to receive the english transcript

Actual behaviour

Instead I received the following error message:

Could not retrieve a transcript for the video https://www.youtube.com/watch?v=voD2wPDFSto! 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!

Hello,

Not too sure why this is happening. It just started happening recently. The subtitles are still available for the video, but still receiving this error. Not too sure if the video owner changed things recently as this isn't the only video of theirs to recently change, but it's just a handful of their videos out of hundreds.

Thanks

drewmw5 commented 1 year ago

Here are a few examples of the video having subtitles, but getting the error when attempting to retrieve them. https://www.youtube.com/watch?v=jJzEVfQznwQ https://www.youtube.com/watch?v=pgAOl7UlmGg

jdepoix commented 1 year ago

Hi @drewmw5, you can't retrieve these transcripts as these videos are age-restricted (you'll actually see that if you open them in an incognito tab in your browser). Unfortunately, there currently is no proper error message for this (see #111). However, you can still retrieve transcripts for age-restricted videos using cookies.

drewmw5 commented 1 year ago

Thank you very much!