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.87k stars 326 forks source link

I've got error that said #169

Closed Nachthirsch closed 1 year ago

Nachthirsch commented 1 year ago

I only write simple code like this def transcript_video(): url = input("Enter the URL: ") transcript = YouTubeTranscriptApi.get_transcript(url, languages=['en'])

but i got an error like this:

**Could not retrieve a transcript for the video https://www.youtube.com/watch?v=https://youtu.be/n8s9DjPDBEw! This is most likely caused by:

Subtitles are disabled for this video**

when I check the video, the subtitle is not disabled, is there anything wrong with the code that I write?

jdepoix commented 1 year ago

Hi @Nachthirsch, you have to pass in the video ID, not the whole URL: https://www.youtube.com/watch?v=123456 -> 123456