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

list_transcripts working locally, but not from server #262

Closed mgoldenbe closed 3 months ago

mgoldenbe commented 3 months ago

The following works locally just fine:

from youtube_transcript_api import YouTubeTranscriptApi
YouTubeTranscriptApi.list_transcripts('JdcmfiMS-84')

When I run the same code from the console in PythonAnywhere, I get:

Could not retrieve a transcript for the video https://www.youtube.com/watch?v=JdcmfiMS-84! This is most likely caused by:

Subtitles are disabled for this video

This seems to be happening only for videos in Hebrew. What could be causing this?

jdepoix commented 3 months ago

Hi @mgoldenbe, when I try to open the video I get the error message "Video unavailable. The uploader has not made this video available in your country" (I am currently in France). It seems likely that the server you are running your code on is not located in the same country as you are and therefore is blocked due to the same reason.

The error message is a bit misleading here, as I hadn't encountered this case yet. I will try to add a more explicit error message for this in the future. I will close this issue now as there's not much we can do here to solve this specifically.

mgoldenbe commented 3 months ago

Yes, it would be great if I could determine this somehow. Interestingly, I am able to get the listing for this video using YouTube List API from the same server...

On Tue, Mar 19, 2024 at 6:46 PM Jonas Depoix @.***> wrote:

Hi @mgoldenbe https://github.com/mgoldenbe, when I try to open the video I get the error message "Video unavailable. The uploader has not made this video available in your country" (I am currently in France). It seems likely that the server you are running your code on is not located in the same country as you are and therefore is blocked due to the same reason.

The error message is a bit misleading here, as I hadn't encountered this case yet. I will try to add a more explicit error message for this in the future. I will close this issue now as there's not much we can do here to solve this specifically.

— Reply to this email directly, view it on GitHub https://github.com/jdepoix/youtube-transcript-api/issues/262#issuecomment-2007664671, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF2BZZTVYI2ODJUEPRV6O7DYZBTWPAVCNFSM6AAAAABE4GXQOSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBXGY3DINRXGE . You are receiving this because you were mentioned.Message ID: @.***>