# YouTube Transcript Scraper for AI & RAG – Videos, Channels (`clearfeed-labs/youtube-transcripts-ai`) Actor

Get YouTube transcripts (captions) in bulk from videos, playlists, channels or search. Clean text, timestamped segments and RAG-ready chunks with deep links, language fallback and video metadata. Pay only for successful transcripts.

- **URL**: https://apify.com/clearfeed-labs/youtube-transcripts-ai.md
- **Developed by:** [Clearfeed Labs](https://apify.com/clearfeed-labs) (community)
- **Categories:** AI, Videos, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.40 / 1,000 transcripts

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 Scraper for AI & RAG – Videos, Playlists, Channels

Get **YouTube transcripts (captions / subtitles) in bulk** and turn them into **clean, LLM-ready text**. Paste video URLs, playlists, channels or search queries. You get the full transcript, **timestamped segments**, **\[mm:ss]-stamped text for citations**, and **RAG-ready chunks** with deep links back to the exact second in the video. Video metadata (title, channel, publish date, duration, views) is included at no extra cost.

**You only pay for successful transcripts.** Videos without captions, private or deleted videos and invalid URLs return a clear error row and are **not charged**.

### Why this YouTube transcript API?

- 📦 **Bulk input:** video URLs, Shorts, youtu.be links, bare video IDs, **playlists**, **channels** (`@handle`, `/channel/UC…`, `/c/…`), and **YouTube search queries**, mixed in one run. Duplicates are removed automatically.
- 🧠 **Built for AI:** plain text, timestamped text, segments, or **chunks of a configurable size and overlap** that never cut a caption line, each with `startSeconds`, `endSeconds` and a `timestampUrl` (`…&t=754s`).
- 🗂️ **One row per video or one row per chunk:** load the chunk rows straight into Pinecone, Qdrant, Weaviate, pgvector, Chroma, LangChain or LlamaIndex.
- 🌍 **Smart language fallback:** your preferred languages in order → uploaded (human) captions first → auto-generated captions → the original language (YouTube machine translation is available as an experimental option). Every row tells you `language`, `isAutoGenerated` and `isTranslated`.
- 🧹 **Clean text:** HTML entities decoded, `[Music]`, `[Applause]` and ♪ removed (optional), overlapping auto-caption lines fixed.
- ⚡ **Fast and reliable:** a lightweight caption API (no browser, no video download), rotating proxy sessions, automatic retries on a fresh IP, and one clear error row per failed video instead of a crashed run.
- 💸 **Cheap:** no browser, ~30 KB of traffic per video.

### Use cases

- **RAG chatbots and knowledge bases** over a channel, a course playlist or a conference talk series ("chat with this YouTube channel").
- **AI agents / MCP tools** that need the transcript of a video a user mentions.
- **Summaries, show notes, chapters, blog posts and newsletters** from podcasts and lectures.
- **Content research and SEO:** what competitors and creators actually say, keyword and topic analysis.
- **Fine-tuning and evaluation datasets** from public educational content (check the licence of the content you use).
- **Brand, product and market monitoring** across many videos at once.

### How to use it

1. Paste one or more YouTube URLs, playlists, channels (or search queries).
2. Choose your preferred languages (e.g. `en`, `de`, `es`).
3. Pick the output: plain text, timestamped text, segments, or chunks (and per-video or per-chunk rows).
4. Click **Start**, then download the results as JSON, CSV, Excel, or get them through the API.

### Input example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jGwO_UgTS7I",
    "https://www.youtube.com/playlist?list=PLoROMvodv4rMiGQp3WXShtMGgzqpfVfbU",
    "@3blue1brown"
  ],
  "searchQueries": ["retrieval augmented generation tutorial"],
  "maxVideosPerChannel": 20,
  "languages": ["en", "de"],
  "outputMode": "chunk",
  "chunkSize": 2000,
  "chunkOverlap": 200
}
```

### Output example (one row per video)

```json
{
  "videoId": "aircAruvnKk",
  "url": "https://www.youtube.com/watch?v=aircAruvnKk",
  "status": "success",
  "title": "But what is a neural network? | Deep learning chapter 1",
  "channelName": "3Blue1Brown",
  "channelId": "UCYO_jab_esuFRV4b17AJtAw",
  "publishDate": "2017-10-05T08:11:25-07:00",
  "durationSeconds": 1120,
  "viewCount": 24955886,
  "language": "en",
  "isAutoGenerated": false,
  "isTranslated": false,
  "wordCount": 3357,
  "text": "This is a 3. It's sloppily written and rendered at an extremely low resolution of 28x28 pixels…",
  "timestampedText": "[00:04] This is a 3. It's sloppily written…\n[00:34] …",
  "segments": [{ "start": 4.22, "end": 7.0, "text": "This is a 3." }],
  "chunks": [{ "index": 0, "text": "…", "startSeconds": 4.22, "endSeconds": 117.5, "timestampUrl": "https://www.youtube.com/watch?v=aircAruvnKk&t=4s", "count": 11 }],
  "availableLanguages": [{ "code": "en", "name": "English", "isAutoGenerated": false }]
}
```

### Output example (one row per chunk, for vector databases)

```json
{
  "chunkId": "aircAruvnKk-3",
  "videoId": "aircAruvnKk",
  "title": "But what is a neural network? | Deep learning chapter 1",
  "channelName": "3Blue1Brown",
  "chunkIndex": 3,
  "chunkCount": 11,
  "text": "…",
  "startSeconds": 312.5,
  "endSeconds": 421.8,
  "timestampUrl": "https://www.youtube.com/watch?v=aircAruvnKk&t=312s",
  "language": "en"
}
```

### Error rows (never charged)

| `errorCode` | Meaning |
|---|---|
| `NO_CAPTIONS` | The video has no captions at all |
| `LANGUAGE_NOT_AVAILABLE` | No captions in your languages and fallback is off (see `availableLanguages`) |
| `VIDEO_UNAVAILABLE`, `PRIVATE_VIDEO`, `MEMBERS_ONLY`, `AGE_RESTRICTED` | The video can't be accessed without a login |
| `LIVE_NOT_STARTED` | Upcoming live stream or premiere |
| `INVALID_INPUT`, `LISTING_FAILED`, `NO_VIDEOS` | The URL isn't a YouTube URL, or the playlist/channel couldn't be listed |
| `BLOCKED`, `RATE_LIMITED` | YouTube still refused after all retries on fresh IPs (rare) |

### Language options

- `languages`: in order of preference. `en` also matches `en-US` and `en-GB`.
- `allowAutoGenerated`: use YouTube's speech-recognition captions when no uploaded captions exist (on by default).
- `allowTranslation` (experimental, off by default): ask YouTube for a machine translation into your first language. **YouTube currently rate-limits translated captions heavily, so this usually fails.** If it refuses, you get the original language and a `translationError` note instead of a failure.
- `fallbackToAnyLanguage`: return the original language rather than an error.

### Pricing

Pay per event: you're charged **only for each successful transcript** (plus a tiny run-start fee). Metadata, chunks, segments and error rows are free. Use the run option **"Max total charge"** to cap your spend; the Actor stops cleanly when the cap is reached.

### Integrations

Use the Apify API, the Python or JavaScript client, **Make**, **Zapier**, **n8n**, **LangChain** (`ApifyDatasetLoader`), **LlamaIndex**, or the **Apify MCP server** to give AI agents a YouTube transcript tool. Schedule the Actor to keep a channel's knowledge base up to date.

### FAQ

**Does it download videos or audio?** No. It only reads the caption tracks YouTube already publishes, plus public video metadata.

**What if a video has no captions?** You get a `NO_CAPTIONS` error row and you aren't charged. Audio transcription (speech-to-text) for videos without captions is planned as an optional paid add-on.

**Is it legal?** The Actor reads publicly available captions and does not log in. Transcripts can be copyrighted by their creators. Make sure your use (e.g. analysis, summaries, internal search) is allowed in your jurisdiction and complies with YouTube's Terms of Service. Don't republish full transcripts without permission.

**Which proxy does it use?** Apify residential proxy by default, because YouTube blocks most datacenter IPs. Only small caption files go through it.

**Found a bug or need a custom feature?** Open an issue on the Actor's Issues tab and we'll reply.

# Actor input Schema

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

Any mix of video URLs (watch, youtu.be, Shorts, live, embed), bare 11-character video IDs, playlist URLs, and channel URLs or @handles (e.g. https://www.youtube.com/@3blue1brown). Duplicates are removed.

## `searchQueries` (type: `array`):

Find videos by YouTube search and get their transcripts, e.g. "retrieval augmented generation tutorial".

## `maxVideosPerChannel` (type: `integer`):

Newest videos taken from each channel.

## `channelTabs` (type: `array`):

Which channel tabs to take videos from (used when the channel URL has no tab).

## `maxVideosPerPlaylist` (type: `integer`):

Videos taken from each playlist, in playlist order.

## `maxVideosPerSearch` (type: `integer`):

Top search results taken for each query.

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

Hard cap across all inputs. 0 = no cap.

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

Language codes in order of preference (e.g. en, de, es, pt-BR). 'en' also matches en-US/en-GB. Uploaded (human) captions are preferred over auto-generated ones in the same language.

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

Use YouTube's automatic (speech recognition) captions when no uploaded captions exist in your languages.

## `allowTranslation` (type: `boolean`):

If no track exists in your preferred languages, ask YouTube for a machine translation into the first preferred language. YouTube currently rate-limits translated captions heavily, so this usually falls back to the original language (see translationError).

## `fallbackToAnyLanguage` (type: `boolean`):

If nothing above works, return the transcript in whatever language is available (the spoken language first) instead of an error.

## `outputMode` (type: `string`):

One row per video, or one row per text chunk (ready to embed and load into a vector database).

## `includePlainText` (type: `boolean`):

Full transcript as one clean string.

## `includeTimestampedText` (type: `boolean`):

Transcript as paragraphs prefixed with \[mm:ss], about every 30 seconds. Great for LLM answers with citations.

## `includeSegments` (type: `boolean`):

Array of caption lines with start and end in seconds.

## `includeChunks` (type: `boolean`):

Add a `chunks` array to each video row. Always on in per-chunk mode.

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

Target chunk length. ~4 characters ≈ 1 token, so 2000 ≈ 500 tokens. Chunks never cut a caption line.

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

Characters repeated at the start of the next chunk so context is not lost at boundaries.

## `removeNonSpeechTags` (type: `boolean`):

Strip \[Music], \[Applause], ♪ and similar tags.

## `includeMetadata` (type: `boolean`):

Title, channel, publish date, duration, views, category, keywords, thumbnail.

## `includeDescription` (type: `boolean`):

Add the full video description text.

## `maxConcurrency` (type: `integer`):

Videos processed in parallel.

## `maxRetries` (type: `integer`):

Each retry uses a fresh IP address.

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

Residential Apify Proxy is the default because YouTube blocks most datacenter IPs. Only small caption files (~30 KB per video) go through it. If you choose datacenter proxies, blocked videos are retried through residential IPs automatically.

## `residentialFallback` (type: `boolean`):

Retry blocked videos through residential IPs.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jGwO_UgTS7I",
    "https://www.youtube.com/@3blue1brown"
  ],
  "maxVideosPerChannel": 20,
  "channelTabs": [
    "videos"
  ],
  "maxVideosPerPlaylist": 100,
  "maxVideosPerSearch": 20,
  "maxVideos": 0,
  "languages": [
    "en"
  ],
  "allowAutoGenerated": true,
  "allowTranslation": false,
  "fallbackToAnyLanguage": true,
  "outputMode": "video",
  "includePlainText": true,
  "includeTimestampedText": false,
  "includeSegments": false,
  "includeChunks": false,
  "chunkSize": 2000,
  "chunkOverlap": 200,
  "removeNonSpeechTags": true,
  "includeMetadata": true,
  "includeDescription": false,
  "maxConcurrency": 10,
  "maxRetries": 6,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  },
  "residentialFallback": true
}
```

# Actor output Schema

## `transcripts` (type: `string`):

No description

## `chunks` (type: `string`):

No description

## `summary` (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=jGwO_UgTS7I",
        "https://www.youtube.com/@3blue1brown"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("clearfeed-labs/youtube-transcripts-ai").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=jGwO_UgTS7I",
        "https://www.youtube.com/@3blue1brown",
    ],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("clearfeed-labs/youtube-transcripts-ai").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=jGwO_UgTS7I",
    "https://www.youtube.com/@3blue1brown"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call clearfeed-labs/youtube-transcripts-ai --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,clearfeed-labs/youtube-transcripts-ai"
        }
    }
}
```

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/QATdx8Eb3o2OHxWw4/builds/gxlY4CCPznDFIV5AG/openapi.json
