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.82k stars 316 forks source link

Subtitles are disabled for this video #329

Closed Pratik-Kumar-Cse closed 2 weeks ago

Pratik-Kumar-Cse commented 2 weeks ago

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

Subtitles are disabled for this video


my code: 

def get_transcription_from_yt_video(video_url):

    # Extract video ID from URL
    video_id = video_url.split("v=")[-1]

    try:
        # Fetch the transcript
        transcript = YouTubeTranscriptApi.get_transcript(video_id)

        # Format the transcript with timestamps
        transcript_with_timestamps = [entry["text"] for entry in transcript]

        text = " ".join(transcript_with_timestamps)

        return text

    except Exception as e:
        print(f"An error occurred in get_transcription_from_yt_video: {str(e)}")
        raise

        version: 
        youtube-transcript-api = "^0.6.2"
TrentPierce commented 2 weeks ago

I am having the same error with every video

luketas commented 2 weeks ago

for me the error only happens in prod for some reason.. works in dev

InterstellarBeing commented 2 weeks ago

i get the same error and it drives me crazy :D

Local (Windows11) everything works fine, but on my VPS with Ubunut i always get this error

vatsal2473 commented 2 weeks ago

same issue with me, locally everything works fine but on aws server it is not working

mikewms commented 2 weeks ago

Same using a standard MB Pro - it's a bummer.

jdepoix commented 2 weeks ago

Duplicate of #303