# YouTube Transcripts for Channels & Playlists (RAG-ready) (`antndev/youtube-transcript-rag`) Actor

Fetch YouTube transcripts by video, channel or playlist with no API key. Output timestamped segments, plain text, SRT, or overlapping chunks sized for embeddings. Monitor mode transcribes only newly published videos.

- **URL**: https://apify.com/antndev/youtube-transcript-rag.md
- **Developed by:** [Anton König](https://apify.com/antndev) (community)
- **Categories:** AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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 Transcripts for Channels & Playlists (RAG-ready)

Fetch YouTube transcripts **by video, by channel or by playlist**, with **no API key**, and get them back in the shape your pipeline actually wants: overlapping timestamped chunks for embeddings, raw segments, plain text, or SRT.

Built for people feeding video content into RAG pipelines, search indexes and summarisers, rather than copy-pasting one transcript at a time.

### Why this one

- **Channels and playlists, not just single videos.** Give it `@veritasium` or a playlist URL and it expands to the most recent videos through YouTube's own public feeds. Mix video IDs, channel handles and playlists in one run.
- **RAG-ready output.** The default format returns overlapping chunks with `start` and `end` timestamps, sized by characters, so each chunk is embeddable *and* still traceable back to a moment in the video. No post-processing.
- **Monitor mode.** Scheduled runs remember which videos were already transcribed and process only newly published ones. A daily "transcribe whatever these 10 channels post" job costs nothing on quiet days.
- **Language handling that degrades sensibly.** Preferred language list, human-written captions preferred over auto-generated, optional translation using YouTube's own translation of the track.
- **Proxy-backed by default.** YouTube throttles transcript requests from datacenter addresses; runs are routed through the Apify proxy so batches do not die halfway.

### Output (chunks format)

```json
{
  "video_id": "abc123XYZ_0",
  "video_url": "https://www.youtube.com/watch?v=abc123XYZ_0",
  "title": "Example video title",
  "channel": "Example Channel",
  "published": "2026-07-28T15:04:00+00:00",
  "language": "en",
  "is_auto_generated": true,
  "segment_count": 397,
  "duration_seconds": 842.1,
  "chunk_count": 13,
  "chunks": [
    { "index": 0, "start": 0.0, "end": 84.88, "chars": 1220, "text": "..." }
  ],
  "is_new": true
}
```

Switch `outputFormat` to `segments` for raw timestamped lines, `plain` for a single text field, or `srt` for subtitle-file content.

### Typical setups

**Build a searchable index of a channel**
`urls: ["@channelname"]`, `maxVideosPerSource: 15`, `outputFormat: "chunks"`, `chunkChars: 1200`.

**Keep an index fresh**
Same input plus `monitorMode: true`, scheduled daily. Only new uploads are transcribed.

**Subtitles for a specific video**
`urls: ["https://www.youtube.com/watch?v=..."]`, `outputFormat: "srt"`.

**Non-English source, English index**
`languages: ["de"]`, `translateTo: "en"`.

### Input

| Field | Default | Meaning |
|---|---|---|
| `urls` | sample channel | videos, channels (`@handle`, `UC...`), playlists |
| `maxVideosPerSource` | 10 | most recent N per channel/playlist |
| `outputFormat` | `chunks` | `chunks`, `segments`, `plain`, `srt` |
| `chunkChars` / `chunkOverlap` | 1200 / 150 | chunking for embeddings |
| `languages` | `["en"]` | preference order |
| `allowAutoGenerated` | true | most videos only have auto captions |
| `translateTo` | none | translate the track |
| `monitorMode` | false | only newly published videos |
| `webhookUrl` | none | POST the processed list as JSON |
| `useApifyProxy` | true | recommended for reliability |

### Honest limitations

- **Only videos that actually have captions.** Many videos have none at all; those are reported in the log as failures rather than silently dropped, and you are not charged a transcript event for them.
- **Channel and playlist expansion uses YouTube's public feeds, which return roughly the 15 most recent items.** For deep back-catalogues, pass video IDs or playlist IDs directly.
- Auto-generated captions contain recognition errors, no punctuation guarantees and no speaker labels. That is the source, not this actor.
- Transcripts belong to the video creators. This actor retrieves publicly available caption tracks; how you use them is your responsibility.

### Keywords

youtube transcript, youtube transcript api, youtube subtitles, youtube captions scraper, transcript for rag, youtube channel transcripts, playlist transcripts, srt export, video to text, llm context, embeddings chunking, youtube monitoring

# Actor input Schema

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

Mix freely: video URLs or 11-character IDs, channel URLs or @handles or UC ids, and playlist URLs or ids. Channels and playlists are expanded through YouTube's own public feeds.

## `maxVideosPerSource` (type: `integer`):

How many of the most recent videos to take from each channel or playlist. Direct video inputs are never limited.

## `outputFormat` (type: `string`):

chunks = overlapping timestamped chunks sized for embeddings (best for RAG); segments = raw timestamped lines; plain = one text field; srt = subtitle file content.

## `chunkChars` (type: `integer`):

Target size per chunk when the output format is chunks. Roughly 1200 characters is a comfortable embedding window.

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

How much text to repeat between consecutive chunks so sentences are not cut mid-thought.

## `languages` (type: `array`):

Language codes in order of preference, for example en, de, fr. Manually created captions are preferred over auto-generated ones.

## `allowAutoGenerated` (type: `boolean`):

Most videos only have auto-generated captions. Turn this off to accept human-written captions only.

## `translateTo` (type: `string`):

Language code to translate the transcript into, using YouTube's own translation of the track, for example en or de.

## `monitorMode` (type: `boolean`):

For scheduled runs: remembers which videos were already transcribed and processes only newly published ones.

## `webhookUrl` (type: `string`):

POSTs the list of transcribed videos as JSON to this URL.

## `useApifyProxy` (type: `boolean`):

Recommended. YouTube throttles transcript requests from datacenter addresses, so the run is routed through the Apify proxy.

## `concurrency` (type: `integer`):

How many transcripts to fetch at the same time.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/@veritasium"
  ],
  "maxVideosPerSource": 10,
  "outputFormat": "chunks",
  "chunkChars": 1200,
  "chunkOverlap": 150,
  "languages": [
    "en"
  ],
  "allowAutoGenerated": true,
  "monitorMode": false,
  "useApifyProxy": true,
  "concurrency": 4
}
```

# 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/@veritasium"
    ],
    "languages": [
        "en"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("antndev/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/@veritasium"],
    "languages": ["en"],
}

# Run the Actor and wait for it to finish
run = client.actor("antndev/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/@veritasium"
  ],
  "languages": [
    "en"
  ]
}' |
apify call antndev/youtube-transcript-rag --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=antndev/youtube-transcript-rag",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/4HePSqd7FO1Ol0kkq/builds/UDkblGkSFfcelmzLM/openapi.json
