# 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, Automation
- **Stats:** 2 total users, 1 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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# 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.

### 🆚 Why choose this YouTube Transcript API?

| 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.*

### 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("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=webdatalabs/youtube-transcript-rag",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

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