# YouTube Transcript API - RAG Chapters, Summary & Chunks (`webdatalabs/youtube-transcript-rag`) Actor

Turn any YouTube video, playlist, or channel into RAG-ready data: clean transcript, timestamped segments, AI chapters, summary, key quotes, and embeddings-ready chunks. Built for AI agents and RAG pipelines.

- **URL**: https://apify.com/webdatalabs/youtube-transcript-rag.md
- **Developed by:** [WebDataLabs](https://apify.com/webdatalabs) (community)
- **Categories:** AI, Agents, Videos
- **Features:** Limited permissions
- **Stats:** 1 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $7.00 / 1,000 transcript extracteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YouTube Transcript API - RAG Chapters, Summary & Chunks

**Turn any YouTube video, playlist, or channel into RAG-ready data in one call** — a clean transcript, timestamped segments, AI-generated chapters and summary, key quotes, and embeddings-ready chunks. Built for AI agents, RAG pipelines, researchers, and content teams.

[![Apify Actor](https://img.shields.io/badge/Apify-Actor-0084FF?logo=apify)](https://apify.com)
[![Maintained](https://img.shields.io/badge/Maintained-Yes-success)](https://github.com/webdatalabs)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Most YouTube transcript scrapers stop at raw captions. **This one ships the structured layer your vector database and LLM actually need** — chapters, summaries, key quotes, and token-bounded chunks with timestamps — so you can go straight from a URL to a knowledge base.

### What you get

| Feature | This Actor | Typical transcript scrapers |
|---|---|---|
| **Clean transcript** (filler/sound-cues removed) | ✅ | ⚠️ Sometimes |
| **Timestamped segments** | ✅ | ✅ |
| **AI chapters** (timestamped) | ✅ | ❌ |
| **AI summary** | ✅ | ❌ |
| **Key quotes** (timestamped) | ✅ | ❌ |
| **Embeddings-ready chunks** (token-bounded + timestamps) | ✅ | ❌ |
| **Video, playlist & channel** input (auto-detected) | ✅ | ⚠️ Often video-only |
| **SRT / VTT / JSON / plain-text / chunks** output | ✅ | ⚠️ Limited |
| **100+ languages** | ✅ | ⚠️ Varies |
| **MCP-ready for AI agents** | ✅ | ❌ |

### ✨ Key features

- **🧱 Embeddings-ready chunks** — deterministic, token-bounded (cl100k_base) chunks, each carrying `startTime`/`endTime` so retrieval links back to the exact moment in the video.
- **🤖 AI structuring** — chapters, a concise summary, and timestamped key quotes generated with a fast, low-cost model.
- **🔗 Any URL** — paste a video, a playlist, or a whole channel; playlists and channels auto-expand into their videos (capped by `maxVideos`).
- **🧹 LLM-optimized transcript** — sound cues (`[Music]`, `[Applause]`) and speaker markers stripped for cleaner embeddings.
- **🌍 100+ languages** — pick a preferred caption language; falls back to the best available track and reports the actual language used.
- **📄 Multiple formats** — `text`, `json` (timestamped segments), `srt`, `vtt`, and `chunks` — choose what you need.
- **🔁 Incremental mode** — skip already-processed videos on scheduled re-runs.
- **⚡ Fast & lightweight** — pure HTTP extraction (no browser), with residential proxy support for reliability.

### 🎯 Use cases

#### RAG pipelines & knowledge bases

Ingest a creator's entire channel into a vector store with chunks that are already sized and timestamped.

```json
{
  "urls": ["https://www.youtube.com/@channelname"],
  "outputFormats": ["chunks", "text"],
  "chunkSize": 512,
  "chunkOverlap": 64,
  "maxVideos": 100
}
```

#### AI agents (MCP)

Give an agent a tool that returns chunked, timestamped transcript context for any video.

```json
{
  "urls": ["https://www.youtube.com/watch?v=VIDEO_ID"],
  "includeChapters": true,
  "includeSummary": true,
  "includeKeyQuotes": true
}
```

#### Research & content repurposing

Searchable archives, citable quotes with timestamps, and chapter outlines for long talks and podcasts.

```json
{
  "urls": ["https://www.youtube.com/playlist?list=PLAYLIST_ID"],
  "outputFormats": ["text", "srt"],
  "includeSummary": true
}
```

### 🚀 Quick start

1. **Input** — add one or more YouTube URLs (video, playlist, or channel) or bare video IDs.
2. **Run** — the actor extracts captions, structures them with AI, and chunks them.
3. **Export** — pull results as JSON/CSV via the API or dataset, or feed the chunks straight into your embedding pipeline.

### ⚙️ Input

| Field | Type | Description |
|---|---|---|
| `urls` *(required)* | array | Video / playlist / channel URLs, or bare 11-char video IDs |
| `language` | string | Preferred caption language (ISO code, default `en`); falls back to the best available |
| `outputFormats` | array | Any of `text`, `json`, `srt`, `vtt`, `chunks` (default `text`, `json`, `chunks`) |
| `includeChapters` | boolean | Generate timestamped chapters with AI (default `true`) |
| `includeSummary` | boolean | Generate a concise summary with AI (default `true`) |
| `includeKeyQuotes` | boolean | Extract timestamped key quotes with AI (default `true`) |
| `chunkSize` | integer | Target tokens per chunk (default `512`) |
| `chunkOverlap` | integer | Token overlap between chunks (default `64`) |
| `maxVideos` | integer | Cap on videos per playlist/channel (default `50`) |
| `incrementalMode` | boolean | Skip videos processed in previous runs (default `false`) |
| `proxyConfiguration` | object | Proxy settings — **residential recommended** (default) |

### 📤 Output

One flat record per video:

```json
{
  "videoId": "UF8uR6Z6KLc",
  "url": "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
  "status": "ok",
  "title": "Steve Jobs' 2005 Stanford Commencement Address",
  "channel": { "id": "UC-EnprmCZ3OXyAoG7vjVNCA", "name": "Stanford", "url": "https://www.youtube.com/channel/UC-EnprmCZ3OXyAoG7vjVNCA" },
  "duration": 904,
  "views": 48682246,
  "publishedAt": "Mar 8, 2008",
  "language": "en",
  "transcript": "Thank you. I'm honored to be with you today...",
  "segments": [{ "text": "Thank you.", "start": 8.96, "end": 10.2 }],
  "chapters": [{ "title": "Connecting the Dots", "start": 60.76, "end": 390.84 }],
  "summary": "Steve Jobs shares three stories about life, loss, and following your intuition...",
  "keyQuotes": [{ "quote": "Stay hungry, stay foolish.", "timestamp": 841.68 }],
  "chunks": [{ "text": "Thank you. I'm honored...", "startTime": 8.96, "endTime": 195.56, "tokens": 499 }],
  "srt": null,
  "vtt": null,
  "scrapedAt": "2026-06-29T17:36:59.000Z",
  "schemaVersion": "1.0"
}
```

**Field notes**

- `status` — `ok`, `no_transcript` (captions disabled / none available), or `error` (video unavailable). `statusDetail` explains non-`ok` results.
- `transcript` / `segments` / `srt` / `vtt` are populated only when their format is selected in `outputFormats`.
- `chapters` / `summary` / `keyQuotes` are populated when the matching AI toggle is on.
- `chunks` carry `startTime`/`endTime` and an approximate `tokens` count (cl100k_base, the OpenAI embeddings tokenizer).

### 💰 Pricing (pay-per-event)

- **`transcript-extracted`** — charged per video that yields a transcript.
- **`ai-structured`** — charged per video when chapters/summary/quotes are generated.

You pay only for videos that produce output — caption-less or unavailable videos are reported and **not billed**. See current per-event prices in the Apify Console when you start a run.

### 🔍 How it works

The actor extracts captions over plain HTTP using maintained innertube clients and adds the structured layer on top — no browser, so it's fast and cheap. YouTube intermittently blocks datacenter IPs, so the actor routes its requests through **residential proxies** by default for reliable results.

### ❓ FAQ

**Which languages are supported?** 100+. Set `language` to your preferred ISO code; if that track isn't available the actor uses the best alternative and reports the actual language in the `language` field.

**Why do some videos return `no_transcript`?** The uploader disabled captions or no caption track exists. These are reported (not billed).

**Does it need proxies?** Residential proxies are the default and recommended — YouTube throttles datacenter IPs, so direct/datacenter runs are unreliable.

**Can it process an entire channel or playlist?** Yes — paste the channel or playlist URL and it auto-expands into individual videos, capped by `maxVideos`.

**Is it good for RAG / embeddings?** That's the point: `chunks` are token-bounded and timestamped, and `transcript` is cleaned of filler so embeddings stay focused.

**Is this legal?** It processes public, non-personal video captions. YouTube's Terms discourage scraping; use responsibly and at your own discretion.

**Can AI agents call it?** Yes — it's exposed via the Apify MCP server, so agents can discover and run it as a tool inside RAG workflows.

### 🔗 Related actors

- **YouTube Comments Harvester** — scrape and analyze YouTube comments
- **YouTube Shorts Scraper** — extract Shorts metadata and analytics
- **Reddit Scraper Pro** — posts, comments, and sentiment analysis

***

*Roadmap: caption translation (`targetLanguage`), Whisper speech-to-text fallback for caption-less videos, and TikTok + podcast support.*

### Related actors

- [YouTube Shorts Scraper & Data Extractor](https://apify.com/webdatalabs/youtube-shorts-scraper) — Shorts metadata and engagement
- [Reddit Scraper Pro](https://apify.com/webdatalabs/reddit-scraper-pro) — posts and full comment threads
- [Meta Threads Scraper - Posts, Replies, Profiles, Keyword Search](https://apify.com/webdatalabs/meta-threads-scraper) — Threads posts, replies, profiles and keyword search

Explore the full portfolio from [WebDataLabs](https://apify.com/webdatalabs).

### Support

Found a bug, or need a field that is missing? Open an issue on the **Issues** tab of this Actor and
it will be picked up there. You can also reach WebDataLabs through the support channel on our
[Store profile](https://apify.com/webdatalabs).

### Leave a review

Is this actor saving you time? A quick review on the Store helps other people find it — and tells us which fields to add next. **[Rate this actor →](https://apify.com/webdatalabs/youtube-transcript-rag)**

# Actor input Schema

## `urls` (type: `array`):

Video, playlist, or channel URLs (or bare 11-char video IDs). Playlists and channels are auto-expanded into their videos (up to 'Max videos per source').

## `language` (type: `string`):

ISO language code (e.g. 'en', 'es', 'de'). Falls back to the first available track.

## `outputFormats` (type: `array`):

Which serialisations to include per video. Allowed values: text, json, srt, vtt, chunks.

## `includeChapters` (type: `boolean`):

Use AI to generate timestamped chapters. Requires OPENAI_API_KEY on the actor.

## `includeSummary` (type: `boolean`):

Use AI to generate a concise summary.

## `includeKeyQuotes` (type: `boolean`):

Use AI to extract notable timestamped quotes.

## `chunkSize` (type: `integer`):

Target token count per embeddings-ready chunk (cl100k_base).

## `chunkOverlap` (type: `integer`):

Token overlap between consecutive chunks (set 0 to disable).

## `maxVideos` (type: `integer`):

Cap on how many videos each playlist/channel URL expands to.

## `incrementalMode` (type: `boolean`):

Skip videos already processed in previous runs (for scheduled re-runs).

## `proxyConfiguration` (type: `object`):

Residential proxies strongly recommended — YouTube blocks datacenter IPs.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://www.youtube.com/playlist?list=PL1234",
    "https://www.youtube.com/@SomeChannel"
  ],
  "language": "en",
  "outputFormats": [
    "text",
    "json",
    "chunks"
  ],
  "includeChapters": true,
  "includeSummary": true,
  "includeKeyQuotes": true,
  "chunkSize": 512,
  "chunkOverlap": 64,
  "maxVideos": 50,
  "incrementalMode": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `rag` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "urls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "outputFormats": [
        "text",
        "json",
        "chunks"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("webdatalabs/youtube-transcript-rag").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "urls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "outputFormats": [
        "text",
        "json",
        "chunks",
    ],
}

# Run the Actor and wait for it to finish
run = client.actor("webdatalabs/youtube-transcript-rag").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "outputFormats": [
    "text",
    "json",
    "chunks"
  ]
}' |
apify call webdatalabs/youtube-transcript-rag --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,webdatalabs/youtube-transcript-rag"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/t7P10q1MzaQ4UYFmp/builds/MgRQQA7Nu2PjhDuHw/openapi.json
