What breaks after RequestBlocked when you run YouTube transcripts in production
If you search for youtube-transcript-api RequestBlocked right now, you will find dozens of posts that stop at the same three bullets: run it locally, buy a residential proxy, or pay a scraping actor.
That is enough to get a one-off script running on AWS, GCP, or Railway, but a real service hits harder problems in its first busy week.
While building and operating Subtext, a single-process FastAPI service that serves YouTube transcripts on the web, over a REST API, and through a remote MCP server, the initial cloud IP block turned out to be the easy part. Here are five failure modes we actually hit after getting past RequestBlocked, and what fixed them.
1. Your smoke test passes on a blocked server
A classic trap when deploying a transcript fetcher is testing it with one famous video ID (almost always dQw4w9WgXcQ) in a CI health check or right after a deploy.
YouTube does not enforce anti-bot rules uniformly across every video ID and every CDN edge. Popular videos can return captions cleanly from a cloud IP that blocks 80% of normal long-tail uploads with RequestBlocked or a sign-in wall (Sign in to confirm you're not a bot, sent with a curly typographic apostrophe ’ in the playability reason string).
Test new infrastructure against a small rotating set of ordinary, recently uploaded videos, and never treat a single green smoke check as proof that your server IP is clean.
2. PoTokenRequired (&exp=xpe) does not care about your proxy
Once you move past basic datacenter IP bans, you run into a different failure class: YouTube injects &exp=xpe or &exp=xpv into the caption track baseUrl. In youtube-transcript-api v1.2+, this surfaces as PoTokenRequired.
Throwing more rotating residential proxies or browser cookies at the exact same client request will not clear a PO-token gate. You have to detect the token marker explicitly on the caption track URL before you waste retries on it:
PO_TOKEN_MARKERS = ("&exp=xpe", "&exp=xpv") def needs_po_token(caption_url: str) -> bool: return any(marker in caption_url for marker in PO_TOKEN_MARKERS) In our primary fetcher, we skip the HTML watch page and call InnerTube (POST https://www.youtube.com/youtubei/v1/player) directly, alternating client contexts (ANDROID and IOS) when a track comes back PO-token-gated or blocked. If the primary source still cannot retrieve a clean track, we hand off to a bounded secondary fallback instead of burning ten retries on the same dead path.
3. Proxy bills explode unless you drop the watch page and rotate sessions
Most developers hit two proxy traps in their first week:
- Buying the wrong proxy tier. Services like Webshare sell cheaper "Proxy Server" and "Static Residential" packages alongside "Rotating Residential" plans. Static and datacenter tiers get blocked by YouTube almost immediately or fail with
407 Proxy Authentication Requiredwhen paired withWebshareProxyConfig. - Reusing a single HTTP session across retries. Keep-alive is great for direct APIs, but if you retry a blocked YouTube request on the same
requests.Sessionagainst a sticky proxy gateway, you keep hitting YouTube from the exact same burned exit IP.
There is also a bandwidth cost most tutorials leave out. Residential proxies bill per gigabyte. Fetching a full YouTube watch page HTML document just to parse out captionTracks pulls hundreds of kilobytes per video. Calling /youtubei/v1/player with a $fields projection mask requests only the three slices you actually need:
FIELDS = ( "playabilityStatus(status,reason,errorScreen)," "captions.playerCaptionsTracklistRenderer" "(captionTracks,translationLanguages,audioTracks,defaultAudioTrackIndex)," "videoDetails(videoId,title,author,channelId,lengthSeconds)" ) One projected player response plus one caption XML download uses a fraction of the bandwidth of scraping the watch page, and opening a fresh session per proxy retry ensures each attempt exits through a new residential IP.
4. One viral video can starve your FastAPI server and melt your proxy quota
If 25 users or AI agents request the same newly published podcast at the same time on a cold cache, naive code launches 25 identical upstream fetches in parallel. Even worse, in FastAPI, running blocking requests or youtube-transcript-api calls inside default def endpoints dumps them onto AnyIO's shared 40-thread worker pool. When YouTube stalls or throttles, all 40 threads sit waiting on sockets and your entire app stops answering even cached requests and health checks.
Four small pieces keep one busy link from taking down the server:
- Coalesce concurrent requests with a single-flight lock per canonical key
(video_id, lang.lower(), translate.lower()). Only one upstream fetch runs at a time; later callers wait on that lock and read the cached row from SQLite. - Separate permanent and temporary failures. Cache
no_captions,age_restricted, andvideo_unavailableas negative results so nobody repeatedly hits YouTube for a captionless video. Put temporary failures (429, timeouts, proxy refusals) on a short 60-second cooldown instead of locking out a working video for hours. - Move slow external network I/O onto its own bounded
ThreadPoolExecutorwith a queue cap and per-request deadline, leaving AnyIO's shared pool for fast local SQLite reads, rendering, and compression. - Put a half-open circuit breaker in front of the primary source. After five temporary failures in a row, skip it for 60 seconds and let one probe thread test recovery when the cooldown expires.
Here is the minimal single-flight lock we use in Python (_Flights in our transcript service):
import threading from contextlib import contextmanager class Flights: def __init__(self) -> None: self._guard = threading.Lock() self._locks: dict[tuple[str, str, str], list] = {} @contextmanager def __call__(self, key: tuple[str, str, str]): with self._guard: entry = self._locks.setdefault(key, [threading.Lock(), 0]) entry[1] += 1 entry[0].acquire() try: yield finally: entry[0].release() with self._guard: entry[1] -= 1 if entry[1] == 0: self._locks.pop(key, None) Also watch out for NoTranscriptFound vs TranscriptsDisabled when selecting languages. A video often has en-US or en-GB instead of bare en, or only an auto-generated track. Match language prefixes before giving up, and be careful with YouTube's .translate() endpoint, which hits 429 much faster than regular caption fetches.
5. Exposing the hardened pipeline over remote MCP instead of local scripts
Once you have a cached, bounded transcript backend running cleanly, the next bottleneck shows up on the client side: people building workflows in Claude Code, Cursor, or custom agents do not want to install yt-dlp, debug residential proxies, or maintain a local Python environment just to read a lecture or conference talk.
We exposed the same backend over two thin surfaces:
- A plain REST endpoint (
GET /api/v1/transcript) returning JSON, plain text, Markdown, SRT, or WebVTT, plus a freeGET /api/v1/languageslookup. Details and OpenAPI 3.1 schema live on the Subtext API reference. - A remote Streamable HTTP MCP server at
https://youtubevideototranscript.com/mcpsupporting both OAuth 2.1 with PKCE and Bearer API keys, exposingget_transcriptandlist_languages.
In Claude Code, connecting it is one command:
claude mcp add --transport http subtext https://youtubevideototranscript.com/mcp \ --header "Authorization: Bearer $SUBTEXT_API_KEY" Because both surfaces share the exact same SQLite cache, single-flight coordinator, and credit accounting (failed fetches never charge a credit), agents never inherit local IP-block headaches or duplicate work.
Checklist before you deploy
If you only run occasional scripts from a laptop, plain youtube-transcript-api is still hard to beat. Once you deploy it behind a server or an AI agent pipeline, plan for the layers after RequestBlocked:
- Test against ordinary recent videos, not just one famous ID.
- Detect
&exp=xpe/&exp=xpvPO-token tracks early so you do not burn proxy credits retrying them. - Use rotating residential proxies with a fresh session per retry and a projected InnerTube payload to keep bandwidth low.
- Isolate blocking network I/O from AnyIO's shared pool, coalesce duplicate requests with single-flight, and split permanent negative caching from temporary cooldowns.
If you want the full checklist of Python RequestBlocked fixes or would rather not maintain proxy infrastructure yourself, we keep both a Python cloud IP-block troubleshooting guide and a YouTube MCP server setup guide up to date on Subtext.