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.54k stars 279 forks source link

get_transcript works on my laptop but not on my Virtual Private Server anymore #291

Closed TheSpaceSheep closed 3 weeks ago

TheSpaceSheep commented 3 weeks ago

What code / cli command are you executing?

I am running

from youtube_transcript_api import YouTubeTranscriptApi

transcript = YouTubeTranscriptApi.get_transcript("dg9H_fHNFD8", languages=["fr"])
print(transcript)

Which Python version are you using?

Python 3.11.2

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

youtube-transcript-api 0.6.2

Expected behavior

This exact same code works like a charm on my laptop, and it had been working on my VPS for weeks. Since yesterday, it has stopped working, raising the error below. It does not work for any video or language. On my laptop it still works flawlessly.

I was worried my VPS's IP address may have been blocked, but I changed my VPS's IP and I still get the same error.

Any idea where this problem could come from ?

The Error I get

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

TheSpaceSheep commented 3 weeks ago

I got it working again ! by connecting my VPS to a VPN.

Asking my VPS provider to change my IP was not enough apparently (maybe youtube blocked all requests coming from my provider ?)