All guides

November 20, 2026 · 6 min read

LangChain YoutubeLoader Not Working? Every Common Error and How to Fix It

In short

Fix LangChain YoutubeLoader errors: RequestBlocked on cloud servers, empty results, NoTranscriptFound, pytube failures, and AttributeError, plus a drop-in loader.

LangChain's YoutubeLoader usually fails for one of four reasons: YouTube blocks your server's IP address, the video has no transcript in the language you asked for, add_video_info=True breaks inside pytube, or your langchain-community and youtube-transcript-api versions don't match. The fastest fix for all four is a drop-in loader that gets transcripts through the TranscriptYT API instead of scraping YouTube from your own machine. This guide matches each error message to its cause and shows how to fix it, with or without switching loaders.

Why LangChain YoutubeLoader stops working

YoutubeLoader in langchain_community is a thin wrapper. It calls the youtube-transcript-api library, which scrapes YouTube's caption endpoints from whatever machine runs your code. When you set add_video_info=True, it also calls pytube to read the title, author, and view count. So the loader breaks whenever one of three things changes: YouTube's response to your IP address, the scraping library underneath, or pytube.

That is why the same notebook works on your laptop and fails after you deploy it. Find your symptom below and go to the matching section:

  • RequestBlocked, IpBlocked, or 'YouTube is blocking requests from your IP': YouTube is refusing your server's IP address.
  • An empty list from load() with no error: the video has captions turned off.
  • NoTranscriptFound: there is no caption track in the language you asked for.
  • PytubeError, 'Exception while accessing title', or HTTP Error 400 with add_video_info=True: pytube's metadata scraping is broken.
  • AttributeError on YouTubeTranscriptApi: your langchain-community and youtube-transcript-api versions don't work together.

Fix RequestBlocked and IpBlocked errors on cloud servers

This is the most common failure, and upgrading packages won't fix it. YouTube blocks most requests from datacenter IP ranges, so a YoutubeLoader that works locally fails on AWS, Google Cloud, Azure, Google Colab, Vercel, or a CI runner. Sometimes the first few requests work, and the block starts once you load a batch of videos.

Retrying from the same IP rarely helps. With youtube-transcript-api you have two options: send its requests through rotating residential proxies that you pay for and configure yourself, or move the fetch somewhere that already handles the blocking. The RequestBlocked guide covers the proxy route in detail.

The loader in the drop-in section below takes the second route. Your code calls TranscriptYT over HTTPS, and TranscriptYT fetches from YouTube through its own rotating proxy exits. Your server never talks to YouTube directly, so its IP address can't get blocked. If YouTube blocks a request upstream anyway, the API returns a 503 BLOCKED error that is safe to retry, and the failed request is not billed.

Fix empty results, NoTranscriptFound and TranscriptsDisabled

If load() returns an empty list instead of raising an error, the video almost certainly has captions disabled. YoutubeLoader catches TranscriptsDisabled and returns no documents, which makes the problem easy to miss in a batch job. Check len(docs) after each video, and log the video IDs that come back empty.

NoTranscriptFound means the video has captions, but not in the language you asked for. The loader defaults to English, and many videos only have an auto-generated track in the spoken language. Pass a list of acceptable languages, for example language=["en", "en-US", "es"], or set translation="en" to machine-translate whatever track exists. The NoTranscriptFound guide shows how to list a video's tracks before you request one.

Some videos have no captions at all: new uploads, music, or channels that turned captions off. No caption-based loader can return text for these, because there's no text to return. The TranscriptsDisabled guide explains the cases. TranscriptYT's default mode=auto falls back to AI speech-to-text for caption-less videos on paid plans and credit packs, billed at 1 credit per started minute of audio. On the Free plan, those videos return NO_CAPTIONS and cost nothing.

Fix pytube errors with add_video_info=True

add_video_info=True is the only part of YoutubeLoader that needs pytube. pytube reads metadata by parsing YouTube's player page, and when YouTube changes that page, pytube breaks with errors like PytubeError ('Exception while accessing title') or urllib HTTP Error 400. A pytube error stops the whole load, even though the transcript itself was fine.

You have three fixes:

  • Remove add_video_info=True if you don't need the title or author in metadata. The transcript part doesn't use pytube.
  • Use YoutubeLoaderDL or the langchain-yt-dlp package, which LangChain's docs recommend for metadata because they use yt-dlp instead of pytube. yt-dlp still scrapes YouTube, so it can hit the same cloud IP blocks.
  • Use a loader whose metadata comes from the same API response as the transcript. TranscriptYTLoader returns title, author, channel_id and duration_seconds on every document, with no extra scraping.

Fix AttributeError after upgrading youtube-transcript-api

youtube-transcript-api 1.x replaced its old class methods with instance methods: you now create YouTubeTranscriptApi() and call list() and fetch() on it. An older langchain-community that still calls the removed class methods fails with an AttributeError as soon as pip installs the new library. The reverse also happens: a pinned old youtube-transcript-api can break under a newer langchain-community.

Upgrade both packages together so they match, then restart your kernel or process so the old modules aren't still loaded. The get_transcript AttributeError guide shows the before and after code for the library's new API.

pip install -U langchain-community youtube-transcript-api
pip show langchain-community youtube-transcript-api

Drop-in replacement: a YouTube loader backed by an API

If you're tired of fixing scraping errors, langchain-transcriptyt gives you a document loader with the same load() interface. It returns standard LangChain Document objects, so the rest of your pipeline (splitters, embeddings, vector store) stays the same. Get a free key from the dashboard, set it as TRANSCRIPTYT_API_KEY, and change two lines:

pip install -U langchain-transcriptyt
export TRANSCRIPTYT_API_KEY="ts_live_..."

# Before
from langchain_community.document_loaders import YoutubeLoader
docs = YoutubeLoader.from_youtube_url(url, add_video_info=True).load()

# After
from langchain_transcriptyt import TranscriptYTLoader
docs = TranscriptYTLoader([url]).load()
print(docs[0].metadata["title"], docs[0].metadata["author"])

# Timestamped paragraph chunks for RAG
docs = TranscriptYTLoader(
    ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "jNQXAC9IVRw"],
    language="en",
    chunk="paragraph",
    chunk_size=1000,
    continue_on_failure=True,
).load()
print(docs[0].metadata["source"])  # ...watch?v=ID&t=42s

# A whole playlist or channel
docs = TranscriptYTLoader(playlist="https://www.youtube.com/@3blue1brown", limit=20).load()

How the old YoutubeLoader options map to TranscriptYTLoader

Most YoutubeLoader arguments have a direct equivalent, and a few cover things the original loader can't do:

  • language: pass a language code such as "es" or "pt-BR". If the video has no track in that language, the original track is machine-translated into it.
  • translation: use translate_to, which works with 150+ target languages and keeps every segment's timing.
  • add_video_info: not needed. title, author, channel_id, language, auto_generated and duration_seconds are always in metadata.
  • transcript_format=CHUNKS with chunk_size_seconds: use chunk="paragraph" with chunk_size in characters. Chunks break on speech pauses, and each one carries start, end and a source link to that moment in the video.
  • continue_on_failure: same name, same behavior. One unavailable video doesn't stop the batch.
  • New: mode="captions" never uses AI, and mode="ai" transcribes the audio even when captions exist. The default, "auto", uses captions first.

What the replacement loader costs and its limits

Every account starts with 100 free credits and no card. The Free plan covers caption transcripts at 10 requests a minute. Paid plans start at $3 a month for 1,000 credits and allow 200 requests a minute. One transcript costs 1 credit, a cached repeat of the same video also costs 1, and failed requests are never billed. AI transcription for caption-less videos needs a paid plan or credit pack and costs 1 credit per started minute of audio.

If you don't want another dependency, you can call the REST endpoint with requests and build Document objects yourself. The RAG with LangChain guide has a complete example, and the API docs list every parameter and error code. To check a single video by hand before you debug code, paste it into the free YouTube transcript tool.

Common questions

Why does LangChain YoutubeLoader work locally but not on my server?

YouTube blocks most requests from cloud and datacenter IP addresses, so youtube-transcript-api, which YoutubeLoader is built on, gets RequestBlocked or IpBlocked on AWS, GCP, Colab or Vercel. Use rotating residential proxies or a loader that fetches through an API such as TranscriptYT.

Why does YoutubeLoader return an empty list?

The video most likely has captions disabled. YoutubeLoader catches TranscriptsDisabled and returns no documents instead of raising an error, so check the length of the result for each video.

How do I fix the pytube error in LangChain YoutubeLoader?

The error comes from add_video_info=True, which uses pytube to scrape metadata. Remove that flag, switch to YoutubeLoaderDL (yt-dlp), or use TranscriptYTLoader, which returns title and author with the transcript.

Can LangChain load a YouTube video that has no captions?

Not with YoutubeLoader, which only reads existing caption tracks. TranscriptYTLoader's default mode transcribes the audio with AI speech-to-text on paid plans and credit packs, at 1 credit per started minute.

Try the YouTube Transcript API

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

More guides