Guide · Python · troubleshooting

Fix RequestBlocked in youtube-transcript-api

Your script works on your laptop, you deploy it, and every call fails with RequestBlocked or IpBlocked. Here's why it happens and the three ways to fix it.

The error

The exception is youtube_transcript_api._errors.RequestBlocked (or its subclass IpBlocked), and its message explains that YouTube is blocking requests from your IP, either because of too many requests or because the IP belongs to a cloud provider such as AWS, Google Cloud or Azure.

Why it happens

YouTube blocks most IP ranges that belong to cloud providers, because that's where scrapers run. It doesn't matter how few requests you make: the IP is flagged before you start. That's why the same code works at home and fails on AWS, Google Cloud, Azure, Hetzner, DigitalOcean, Vercel, Render or GitHub Actions.

Fix 1: rotating residential proxies

The library supports proxies directly, and its README recommends rotating residential ones (not "static residential" or datacenter proxies). With Webshare:

from youtube_transcript_api import YouTubeTranscriptApi
from youtube_transcript_api.proxies import WebshareProxyConfig

api = YouTubeTranscriptApi(proxy_config=WebshareProxyConfig(
    proxy_username="...", proxy_password="...",
))
api.fetch("dQw4w9WgXcQ")

Other providers work with GenericProxyConfig(http_url=..., https_url=...). Expect a monthly subscription billed by bandwidth, occasional failures that need retries, and some monitoring.

Fix 2: run it from a non-cloud IP

For small personal projects, run the job from a home machine or a Raspberry Pi and push the results to your server. Cheap, but it depends on your home connection and doesn't scale.

Fix 3: use a hosted transcript API

A hosted API runs the proxies for you. With Transkrio it's one request from anywhere, failed requests are free, and results are cached:

import os, requests

r = requests.get("https://api.transkrio.com/v1/transcript",
                 params={"url": "dQw4w9WgXcQ"},
                 headers={"x-api-key": os.environ["TRANSKRIO_API_KEY"]})
segments = r.json()["segments"]   # text, start, duration

The free key includes 100 transcripts, enough to check that it solves your problem. Compare the options in library vs hosted API or see all YouTube transcript APIs.

Which fix to choose

Try it with 100 free credits No card needed. Failed requests are free and unused credits roll over.
Get free API key

FAQ

Why does it work locally but not on my server?

YouTube treats requests from cloud provider IP ranges (AWS, GCP, Azure, DigitalOcean...) as bots and blocks them. Your home IP isn't on those lists.

Will a static or datacenter proxy work?

Usually not. Datacenter and static IPs get blocked the same way. The library's README recommends rotating residential proxies.

Is waiting enough to get unblocked?

Sometimes a ban is lifted after a while, but on cloud IPs it comes back quickly. It isn't a reliable fix for production.