{"id":1061,"library":"youtube-transcript-api","title":"YouTube Transcript API","description":"This is a Python API that allows you to retrieve transcripts and subtitles for a given YouTube video. It supports both manually created and automatically generated subtitles, as well as subtitle translation. Unlike older solutions, it does not require a headless browser. The library is actively maintained, currently at version 1.2.4, and receives regular updates to address YouTube's API changes.","status":"active","version":"1.2.4","language":"python","source_language":"en","source_url":"https://github.com/jdepoix/youtube-transcript-api","tags":["youtube","transcript","subtitles","api","video"],"install":[{"cmd":"pip install youtube-transcript-api","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"As of v1.2.0, the static methods `get_transcript`, `get_transcripts`, and `list_transcripts` were removed. Instantiate `YouTubeTranscriptApi` and use instance methods like `fetch`.","wrong":"from youtube_transcript_api import YouTubeTranscriptApi\nYouTubeTranscriptApi.get_transcript(video_id)","symbol":"YouTubeTranscriptApi","correct":"from youtube_transcript_api import YouTubeTranscriptApi"},{"note":"This exception is raised if no transcript can be found for the given video ID.","symbol":"NoTranscriptFound","correct":"from youtube_transcript_api import NoTranscriptFound"},{"note":"This exception is raised if transcripts are explicitly disabled for the video.","symbol":"TranscriptsDisabled","correct":"from youtube_transcript_api import TranscriptsDisabled"},{"note":"This exception is raised if no manually created transcript is available for the video in the requested language(s).","symbol":"NoManualTranscriptFound","correct":"from youtube_transcript_api import NoManualTranscriptFound"},{"note":"This exception indicates that the request was blocked, often due to aggressive rate limiting or IP blocking by YouTube, especially from cloud providers.","symbol":"IpBlocked","correct":"from youtube_transcript_api import IpBlocked"}],"quickstart":{"code":"from youtube_transcript_api import YouTubeTranscriptApi, NoTranscriptFound, TranscriptsDisabled, IpBlocked\n\nvideo_id = \"_dQ8wY76uI8\" # Example: 'Never Gonna Give You Up' by Rick Astley\n\ntry:\n    # Instantiate the API client\n    ytt_api = YouTubeTranscriptApi()\n\n    # Fetch the transcript for the video\n    # By default, it attempts to get English. You can specify languages=['de', 'en'] for priority.\n    transcript = ytt_api.fetch(video_id)\n\n    # Print the full transcript text\n    full_text = \" \".join([item['text'] for item in transcript])\n    print(f\"Transcript for video ID {video_id}:\\n{full_text[:500]}...\")\n\n    # You can also list available transcripts and their languages\n    # transcript_list = ytt_api.list_transcripts(video_id)\n    # for t in transcript_list:\n    #     print(f\"Available transcript: {t.language} ({'generated' if t.is_generated else 'manual'})\")\n\nexcept NoTranscriptFound:\n    print(f\"No transcript found for video ID: {video_id}\")\nexcept TranscriptsDisabled:\n    print(f\"Transcripts are disabled for video ID: {video_id}\")\nexcept IpBlocked:\n    print(f\"Your IP was blocked by YouTube. Consider using a proxy.\")\nexcept Exception as e:\n    print(f\"An unexpected error occurred: {e}\")","lang":"python","description":"This quickstart demonstrates how to fetch a transcript for a given YouTube video ID using the `YouTubeTranscriptApi` client. It includes error handling for common issues like missing or disabled transcripts and IP blocking. The example retrieves the 'Never Gonna Give You Up' transcript and prints its beginning."},"warnings":[{"fix":"Instead of calling static methods, instantiate the `YouTubeTranscriptApi` object and use its instance methods like `ytt_api.fetch(video_id)` or `ytt_api.list_transcripts(video_id)`.","message":"The static methods `YouTubeTranscriptApi.get_transcript`, `YouTubeTranscriptApi.get_transcripts`, and `YouTubeTranscriptApi.list_transcripts` were removed in `v1.2.0`. These methods were previously deprecated in `v1.0.0`.","severity":"breaking","affected_versions":">=1.2.0"},{"fix":"Ensure your environment and usage patterns are compatible with the Innertube API approach. Monitor for `PoTokenRequired` exceptions, which may indicate new authentication requirements, and report them to the library maintainers.","message":"In `v1.1.0`, the library refactored caption retrieval from scraping the `/watch` HTML to fetching from the Innertube API. This change initially did not support authentication, potentially causing issues for users relying on authenticated requests.","severity":"breaking","affected_versions":">=1.1.0"},{"fix":"For heavy usage or deployment on cloud platforms, consider using rotating proxy services (e.g., Webshare) configured with the `WebshareProxyConfig` class when initializing `YouTubeTranscriptApi`.","message":"YouTube frequently blocks requests from known cloud provider IPs or if a high volume of requests originates from a single IP. This can lead to `IpBlocked` exceptions.","severity":"gotcha","affected_versions":"All"},{"fix":"Extract the video ID from the URL before passing it to `fetch` or `list_transcripts`.","message":"Ensure you pass only the YouTube video ID, not the full video URL, to the API methods. For example, for `https://www.youtube.com/watch?v=VIDEO_ID`, the video ID is `VIDEO_ID`.","severity":"gotcha","affected_versions":"All"},{"fix":"Handle these exceptions gracefully in your code. You can use `list_transcripts` to check for available languages before attempting to fetch a specific one.","message":"If you encounter `NoTranscriptFound` or `TranscriptsDisabled` exceptions, it means the video either genuinely lacks captions or has them explicitly turned off by the uploader. Some automatically generated captions may also not be available.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'1.2.4':54 'activ':49 'address':60 'allow':10 'api':3,8,63,68 'automat':28 'browser':45 'chang':64 'creat':26 'current':51 'generat':29 'given':19 'headless':44 'librari':47 'maintain':50 'manual':25 'older':37 'python':7 'receiv':56 'regular':57 'requir':42 'retriev':13 'solut':38 'subtitl':16,30,34,67 'support':23 'transcript':2,14,66 'translat':35 'unlik':36 'updat':58 'version':53 'video':21,69 'well':32 'youtub':1,20,61,65","created_at":"2026-04-01T06:54:43.193038+00:00","updated_at":"2026-04-17T01:08:22.201768+00:00","problems":[{"fix":"Verify that transcripts are available for the video on YouTube. You can try requesting different languages, or catch this exception in your code to handle cases where transcripts are legitimately absent.","cause":"This error occurs when YouTube does not provide any transcripts (manual or auto-generated) for the specified video in the requested language(s).","error":"NoTranscriptFound: Could not find any transcripts for the video <video_id>."},{"fix":"Ensure that the video ID corresponds to a publicly available, non-restricted YouTube video. Implement error handling to gracefully manage unavailable videos.","cause":"The specified YouTube video is private, deleted, age-restricted, or otherwise not publicly accessible through the API.","error":"VideoUnavailable: The video <video_id> is unavailable."},{"fix":"Install the library using pip: `pip install youtube-transcript-api`","cause":"The `youtube-transcript-api` library has not been installed in the Python environment where the script is being executed.","error":"ModuleNotFoundError: No module named 'youtube_transcript_api'"},{"fix":"Provide only the 11-character YouTube video ID. If you have a full YouTube URL, extract the ID part (e.g., 'dQw4w9WgXcQ' from 'https://www.youtube.com/watch?v=dQw4w9WgXcQ').","cause":"The string provided as a video ID does not match the expected 11-character format of a YouTube video ID, or it might be a full URL instead of just the ID.","error":"InvalidVideoId: <video_id> is no valid YouTube video ID."}],"ecosystem":"pypi","meta_description":null,"install_score":100,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.2.4","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/jdepoix/youtube-transcript-api","docs":null,"changelog":null,"pypi":"https://pypi.org/project/youtube-transcript-api/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","ai-ml"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-27","next_check":"2026-07-28","install_tag":"verified"}}