youtube-transcript-api errors

RequestBlocked and IpBlocked in youtube-transcript-api

Why youtube-transcript-api raises RequestBlocked or IpBlocked, how to confirm it in a minute, and the fixes that work in production.

Running this on a server? TranscriptFetch returns the same transcript from any IP, no proxies. Try it free →

The library raises these when YouTube refuses to serve your request. The classic symptom: it works on your laptop and fails on your server.

The error

text
youtube_transcript_api._errors.RequestBlocked:
Could not retrieve a transcript for the video https://www.youtube.com/watch?v=VIDEO_ID! This is most likely caused by:

YouTube is blocking requests from your IP. This usually is due to one of the following reasons:
- You have done too many requests and your IP has been blocked by YouTube
- You are doing requests from an IP belonging to a cloud provider (like AWS, Google Cloud Platform, Azure, etc.). Unfortunately, most IPs from cloud providers are blocked by YouTube.

What triggers it

ExceptionRaised when (version 1.2.4)
IpBlockedYouTube answers 429 Too Many Requests, or serves a reCAPTCHA page instead of the video
RequestBlockedYouTube's bot check: the video page says "Sign in to confirm you're not a bot"

IpBlocked is a subclass of RequestBlocked, so except RequestBlocked: catches both.

On versions before 1.0 the same block was raised as TooManyRequests ("YouTube is receiving too many requests from this IP and now requires solving a captcha to continue"). The causes and fixes below are the same; upgrading also gets you the proxy support in fix 1.

Confirm it in a minute

  1. Fetch the same video from your laptop. If it works there, the problem is your server's IP, not your code.

  2. On the server, run:

    bash
    python -c "from youtube_transcript_api import YouTubeTranscriptApi; print(YouTubeTranscriptApi().fetch('jNQXAC9IVRw'))"

    If that raises RequestBlocked, YouTube is blocking that IP range.

  3. If it fails on your laptop too after many requests, you are rate limited. Slow down (fix 2 below).

Fixes

1. Rotating residential proxies

This is the library's built-in route:

python
from youtube_transcript_api import YouTubeTranscriptApi
from youtube_transcript_api.proxies import WebshareProxyConfig

ytt_api = YouTubeTranscriptApi(
    proxy_config=WebshareProxyConfig(
        proxy_username="<username>",
        proxy_password="<password>",
    )
)
ytt_api.fetch(video_id)

They must be rotating residential proxies. The library's own documentation warns against "Proxy Server" and "Static Residential" plans, whose IPs get blocked too. You pay for the bandwidth and maintain the proxy account. For another provider, pass GenericProxyConfig(http_url=..., https_url=...) instead.

2. Slow down

Cache transcripts you already have, add backoff between requests and cut parallel requests. This fixes rate-limit blocks (IpBlocked from a 429). It does not fix a server whose whole IP range is blocked.

3. Cookies: don't

Signing requests in with a YouTube account's cookies keeps them working for a while, but the library itself warns that YouTube eventually bans that account permanently.

4. Use an API that handles the blocking

TranscriptFetch (our product) fetches from its own network, so it works from any server:

python
# pip install transcriptfetch-sdk
from transcriptfetch import TranscriptFetch

tf = TranscriptFetch(api_key="tf_live_...")
t = tf.transcripts.video("https://www.youtube.com/watch?v=VIDEO_ID", timestamps=False)
print(t.text)  # or leave timestamps on and read t.segments

It returns the text and timestamped segments, also covers TikTok and Instagram, and transcribes the audio with AI when a video has no captions. 50 free credits a month, and failed requests are free.

FAQ

Does RequestBlocked mean my code is wrong?

No. Your code reached YouTube and YouTube refused it. The same code works from a residential connection.

Why did it work for a while, then stop?

The blocks are partly based on volume: one IP sending many requests gets flagged, and cloud IP ranges are flagged from the start.

Will a VPN fix it?

Only if its exit IPs are residential. Most VPN exits are data-center ranges, which YouTube treats like cloud servers.

Is IpBlocked a different problem?

Same family. IpBlocked is raised for a 429 or a CAPTCHA page, RequestBlocked for the bot-check page, and the fixes are the same.

Need transcripts that work from a server?

TranscriptFetch fetches YouTube, TikTok and Instagram transcripts from its own network, with AI transcription when a video has no captions. Free credits every month, no card.