Fix youtube-transcript-api RequestBlocked and IpBlocked errors
The Python package youtube-transcript-api usually works on a laptop and then starts raising RequestBlocked or IpBlocked as soon as you deploy it to AWS, GCP, Railway, Vercel, or Docker. YouTube blocks unauthenticated transcript requests coming from datacenter IP ranges.
By Subtext
Get a free API key Read API reference Try free in browser
What each exception actually means
Before changing your code, check which exception you hit. Only the first two are IP blocks; the other two happen even on a home connection.
| Exception | Cause | Fix |
|---|---|---|
RequestBlocked |
YouTube rejected the request from your server IP (common on AWS, GCP, Azure, Hetzner, DigitalOcean, Railway). | Route through rotating residential proxies or switch to a hosted transcript API. |
IpBlocked |
Your IP range is already banned or rate-limited after repeated caption fetches. | Same as above; retrying from the same server IP keeps failing. |
NoTranscriptFound |
The video has captions, but not in the language list you requested (for example requesting en on a Spanish video). |
List available tracks first and pick an existing language code. |
TranscriptsDisabled |
The video has no captions at all, or the uploader disabled them. | No caption API can read it; use speech-to-text (Whisper) on the audio instead. |
Option 1: Keep youtube-transcript-api with residential proxies
In youtube-transcript-api v1.x, you can pass a GenericProxyConfig or WebshareProxyConfig into YouTubeTranscriptApi(...) so traffic exits through residential IPs instead of your cloud host. Datacenter proxies usually hit the same RequestBlocked wall within minutes.
This works if you already pay for a residential proxy provider and want to manage retries, session rotation, and parser updates when YouTube changes its caption endpoints.
Option 2: Switch to the hosted Subtext REST API
If you do not want to buy and babysit proxies, replace the Python call with one HTTP request to GET https://youtubevideototranscript.com/api/v1/transcript. Create an API key on your account page (keys start with stx_) and export it as SUBTEXT_API_KEY.
Before (youtube-transcript-api v1.x, or YouTubeTranscriptApi.get_transcript(...) in v0.x):
from youtube_transcript_api import YouTubeTranscriptApi
api = YouTubeTranscriptApi()
transcript = api.fetch("arj7oStGLkU", languages=["en"])
for snippet in transcript:
print(snippet.start, snippet.text)
After (plain requests against Subtext):
import os, requests
resp = requests.get(
"https://youtubevideototranscript.com/api/v1/transcript",
params={"video": "arj7oStGLkU", "lang": "en", "format": "json"},
headers={"Authorization": f"Bearer {os.environ['SUBTEXT_API_KEY']}"},
timeout=60,
)
resp.raise_for_status()
for seg in resp.json()["segments"]:
print(seg["start"], seg["text"])
Each segment returns start, duration, and text, matching the fields from youtube-transcript-api. If you want plain text, Markdown, SRT, or WebVTT, change format=json to text, md, srt, or vtt.
Handling NoTranscriptFound without wasting credits
When a video does not have English captions, GET /api/v1/transcript returns HTTP 404 with error code language_not_available and an available_languages list, and charges 0 credits. You can also check tracks ahead of time with GET https://youtubevideototranscript.com/api/v1/languages?video=arj7oStGLkU, which is always free.
curl -sS "https://youtubevideototranscript.com/api/v1/languages?video=arj7oStGLkU" \
-H "Authorization: Bearer $SUBTEXT_API_KEY"
Full error codes, rate limits, and retry headers are in the YouTube Transcript API reference. If you are migrating away from youtubetranscript.com/?server_vid2= or comparing hosted providers, see the youtubetranscript.com migration guide and the comparison of YouTube transcript APIs.
When Subtext will not help
Subtext reads public YouTube caption tracks only (creator-made or auto-generated). If a video raises TranscriptsDisabled because it truly has no captions, or if the video is private or age-restricted, Subtext returns an error and charges nothing. For those videos you need an audio transcription pipeline such as Whisper. For a quick browser check on any public video, paste the URL into the free transcript generator or read why a YouTube transcript is missing.