All guides

November 10, 2026 · 3 min read

youtube-transcript-api Not Working in Google Colab

In short

youtube-transcript-api raises RequestBlocked in Google Colab and Kaggle because notebooks run on shared Google Cloud IPs that YouTube blocks. Run it locally, add a proxy, or call a transcript API from the notebook.

The notebook installs youtube-transcript-api, runs fetch(), and fails with RequestBlocked or IpBlocked, often on the very first video. Colab and Kaggle notebooks run on Google Cloud machines whose IPs are shared by thousands of other users, many of them scraping YouTube, so the addresses are blocked before you start.

Get transcripts from a notebook

Store the key with Colab's Secrets panel (the key icon) so it isn't saved in the notebook, then call the TranscriptYT API. The first 100 transcripts are free.

import requests
from google.colab import userdata

KEY = userdata.get("TRANSCRIPTYT_KEY")

def transcript(video):
    r = requests.get(
        "https://transcript-yt.com/v1/transcript",
        params={"url": video, "format": "text"},
        headers={"Authorization": f"Bearer {KEY}"},
        timeout=300,
    )
    r.raise_for_status()
    return r.text

print(transcript("https://youtu.be/5f3Pn-N6yLc")[:500])

Into pandas

For datasets, ask for JSON and keep each segment with its start time.

import pandas as pd

r = requests.get(
    "https://transcript-yt.com/v1/transcript",
    params={"url": "5f3Pn-N6yLc"},
    headers={"Authorization": f"Bearer {KEY}"},
    timeout=300,
)
df = pd.DataFrame(r.json()["segments"])  # text, start, duration

Many videos at once

POST a list of up to 500 URLs, or a playlist or channel, to /v1/transcripts and get every transcript back in one response; see channel and playlist transcripts.

Common questions

Why does youtube-transcript-api fail in Google Colab?

Colab runs on Google Cloud IP addresses that YouTube blocks for caption requests. Restarting the runtime gives you another cloud IP, which is usually blocked too.

Does it work in Kaggle notebooks?

Same problem: Kaggle notebooks also run on cloud infrastructure, and YouTube blocks those IPs.

How do I get YouTube transcripts in a Colab notebook?

Call a transcript API with requests. The request goes to the API's servers, which fetch from YouTube on residential proxies, so Colab's IP doesn't matter.

Can I use Colab's GPU to transcribe YouTube audio with Whisper?

Only if you can download the audio, and yt-dlp hits the same blocks from Colab. A transcript API with AI fallback transcribes caption-less videos for you.

Try the YouTube Transcript API

Get transcripts as JSON, text, SRT, or VTT. 100 free credits, no card required.

More guides