Install & Compatibility
Where this runs
tested against v1.2.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.496s · 23.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.5s · import 0.464s · 24MB
22MB installed
● package 22MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
YouTubeTranscriptApi
✓ from youtube_transcript_api import YouTubeTranscriptApi
✗ from youtube_transcript_api import YouTubeTranscriptApi
YouTubeTranscriptApi.get_transcript(video_id)
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`.
NoTranscriptFound
✓ from youtube_transcript_api import NoTranscriptFound
This exception is raised if no transcript can be found for the given video ID.
TranscriptsDisabled
✓ from youtube_transcript_api import TranscriptsDisabled
This exception is raised if transcripts are explicitly disabled for the video.
NoManualTranscriptFound
✓ from youtube_transcript_api import NoManualTranscriptFound
This exception is raised if no manually created transcript is available for the video in the requested language(s).
IpBlocked
✓ from youtube_transcript_api import IpBlocked
This exception indicates that the request was blocked, often due to aggressive rate limiting or IP blocking by YouTube, especially from cloud providers.
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.
from youtube_transcript_api import YouTubeTranscriptApi, NoTranscriptFound, TranscriptsDisabled, IpBlocked
video_id = "_dQ8wY76uI8" # Example: 'Never Gonna Give You Up' by Rick Astley
try:
# Instantiate the API client
ytt_api = YouTubeTranscriptApi()
# Fetch the transcript for the video
# By default, it attempts to get English. You can specify languages=['de', 'en'] for priority.
transcript = ytt_api.fetch(video_id)
# Print the full transcript text
full_text = " ".join([item['text'] for item in transcript])
print(f"Transcript for video ID {video_id}:\n{full_text[:500]}...")
# You can also list available transcripts and their languages
# transcript_list = ytt_api.list_transcripts(video_id)
# for t in transcript_list:
# print(f"Available transcript: {t.language} ({'generated' if t.is_generated else 'manual'})")
except NoTranscriptFound:
print(f"No transcript found for video ID: {video_id}")
except TranscriptsDisabled:
print(f"Transcripts are disabled for video ID: {video_id}")
except IpBlocked:
print(f"Your IP was blocked by YouTube. Consider using a proxy.")
except Exception as e:
print(f"An unexpected error occurred: {e}")
Errors
Common errors & fixes
NoTranscriptFound: Could not find any transcripts for the video <video_id>.
This error occurs when YouTube does not provide any transcripts (manual or auto-generated) for the specified video in the requested language(s).
fixVerify 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.
VideoUnavailable: The video <video_id> is unavailable.
The specified YouTube video is private, deleted, age-restricted, or otherwise not publicly accessible through the API.
fixEnsure that the video ID corresponds to a publicly available, non-restricted YouTube video. Implement error handling to gracefully manage unavailable videos.
ModuleNotFoundError: No module named 'youtube_transcript_api'
The `youtube-transcript-api` library has not been installed in the Python environment where the script is being executed.
fixInstall the library using pip: `pip install youtube-transcript-api`
InvalidVideoId: <video_id> is no valid YouTube video ID.
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.
fixProvide 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').
Upgrade
Version history
1.2.4latest on PyPI · released Jan 29, 2026
Audit
Dependencies
No dependency data recorded yet.