Disclosure: I made the Apify Actor mentioned in fix 3, so I'm biased. Apify links here are referral links. Fixes 1 and 2 don't need it at all.
Your transcript script works perfectly on your laptop. You deploy it to AWS, Google Cloud, Azure, or a host that runs on one of them, and every call to youtube-transcript-api now fails with:
youtube_transcript_api._errors.RequestBlocked: Could not retrieve a transcript for the video ...
or its stricter sibling, IpBlocked. Nothing is wrong with your code. Here is what is going on and three ways around it, starting with the free ones.
Why it happens
YouTube blocks most IP addresses that belong to cloud providers. The library's own README says so directly: you "will most likely run into RequestBlocked or IpBlocked exceptions when deploying your code to any cloud solutions", and the same can happen to a home IP that makes too many requests.
I saw the same pattern when testing my own transcript tool on Apify's servers on 16 November 2026:
| Route from a cloud server | Transcripts returned |
|---|---|
| No proxy | 1 of 10 |
| Data-center proxy | 8 of 10, and 25 of 30 |
| Rotating residential proxy | 10 of 10, and 30 of 30 |
Small samples, but the direction is clear: the closer your traffic looks to a normal household connection, the more YouTube lets through.
One useful detail: in version 1.2.5, IpBlocked is a subclass of RequestBlocked, so a single except RequestBlocked catches both.
Fix 1: don't fetch from the cloud (free)
If the transcripts don't have to be fetched on the server, fetch them somewhere YouTube trusts and ship the text instead:
- Run the fetch step on your own machine or a home server, save the results (JSON, CSV, a database row), and let the cloud app read those.
- Cache aggressively. A transcript rarely changes, so fetch each video once and store it by video ID.
- Slow down. Fewer, spaced-out requests are less likely to get even a home IP flagged.
This is the cheapest fix and it is enough for many hobby projects, notebooks and one-off datasets.
Fix 2: route the library through a rotating residential proxy
If the fetch has to happen on the server, youtube-transcript-api has proxy support built in. With any HTTP/HTTPS/SOCKS provider:
from youtube_transcript_api import YouTubeTranscriptApi
from youtube_transcript_api.proxies import GenericProxyConfig
ytt_api = YouTubeTranscriptApi(
proxy_config=GenericProxyConfig(
http_url="http://user:pass@my-proxy.example:port",
https_url="http://user:pass@my-proxy.example:port",
)
)
transcript = ytt_api.fetch("aircAruvnKk", languages=["en"])
print(" ".join(s.text for s in transcript.snippets)[:200])
The library also ships a WebshareProxyConfig class for Webshare's rotating residential proxies (just a username and password). Two cautions from its README: buy rotating residential proxies, not static ones or a "proxy server" plan, because YouTube eventually bans static IPs; and a proxy never guarantees you won't be blocked, so keep retries in your code.
This is the right fix when you are already paying for proxies or need full control over every request.
Fix 3: hand only the blocked videos to a hosted scraper
If you'd rather not run proxies yourself, keep the library for the calls that work and send only the blocked ones to a hosted service that handles the proxy rotation. I use my own YouTube Transcript Scraper on Apify for this. It costs $0.004 per transcript delivered, videos without captions are not charged, and it starts on a cheap data-center proxy and switches to residential when YouTube pushes back.
pip install -U youtube-transcript-api apify-client
export APIFY_TOKEN="your-token-here" # Apify Console → Settings → API & Integrations
import os
from youtube_transcript_api import YouTubeTranscriptApi, RequestBlocked
from apify_client import ApifyClient
def via_apify(video_ids, languages=("en",)):
client = ApifyClient(os.environ["APIFY_TOKEN"])
run = client.actor("logicbase_systems/youtube-transcript").call(run_input={
"videoUrls": list(video_ids),
"languages": list(languages),
"includeSegments": False, # plain text only
})
rows = client.dataset(run.default_dataset_id).iterate_items()
return {r["videoId"]: r["text"] for r in rows if r["status"] == "ok"}
def get_transcripts(video_ids, languages=("en",)):
ytt = YouTubeTranscriptApi()
out, blocked = {}, []
for vid in video_ids:
try:
t = ytt.fetch(vid, languages=list(languages))
out[vid] = " ".join(s.text for s in t.snippets)
except RequestBlocked: # also catches IpBlocked
blocked.append(vid)
if blocked:
out.update(via_apify(blocked, languages))
return out
print({k: len(v.split()) for k, v in get_transcripts(["aircAruvnKk", "dQw4w9WgXcQ"]).items()})
When I ran the via_apify part on those two videos on 17 November 2026, the run took about 5 seconds inside Apify and returned 3,357 and 487 words. On a machine YouTube doesn't block, the function never calls Apify at all, so you only pay for the videos that actually needed help.
Each result row also carries the title, channel, publish date, duration and view count. A video without captions comes back as status: "error" with a code like NO_CAPTIONS instead of an exception. The same Actor also takes playlistUrls and channelUrls if you want a whole playlist at once; there is a playlist walkthrough here.
Which one should you pick?
| Situation | Pick |
|---|---|
| Notebook, one-off dataset, or anything you can fetch ahead of time | Fix 1: fetch locally and cache |
| Production app, you already have or want a proxy provider | Fix 2: GenericProxyConfig or WebshareProxyConfig
|
| Production app, low or bursty volume, no proxy setup | Fix 3: fall back to a hosted scraper for blocked videos only |
None of these will get you age-restricted or members-only captions. The library's README notes that cookie authentication is currently broken by YouTube changes, and my Actor doesn't read those videos either.
If you hit a different error than RequestBlocked, such as NoTranscriptFound or TranscriptsDisabled, that is about the video itself, not your IP, and no proxy will change it.
Top comments (0)