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
3.02k stars 339 forks source link

Subtitles are disabled for this video #329

Closed Pratik-Kumar-Cse closed 2 months ago

Pratik-Kumar-Cse commented 2 months 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 months ago

I am having the same error with every video

luketas commented 2 months ago

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

InterstellarBeing commented 2 months 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 months ago

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

mikewms commented 2 months ago

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

jdepoix commented 2 months ago

Duplicate of #303