# YouTube Transcript Scraper & API for AI (Bulk, RAG-ready) (`s3nafps/youtube-transcripts-for-ai`) Actor

Scrape YouTube transcripts, subtitles and captions in bulk from videos, Shorts, channels, playlists or search. Clean text, Markdown, timestamps and RAG chunks for LLMs. $2 per 1,000, free without captions.

- **URL**: https://apify.com/s3nafps/youtube-transcripts-for-ai.md
- **Developed by:** [mohamed senator](https://apify.com/s3nafps) (community)
- **Categories:** AI, Videos, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 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.

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 & API for AI (Bulk, RAG-ready)

Scrape YouTube transcripts, subtitles and captions in bulk and feed them straight into ChatGPT, Claude, LangChain, LlamaIndex or your vector database. Give it video URLs, Shorts, whole channels, playlists or YouTube search terms. You get clean text, Markdown, timed segments and ready-made RAG chunks, each with a link to the exact moment in the video.

**$2 per 1,000 transcripts. Videos without captions are free.**

![YouTube Transcript Scraper for AI: videos, Shorts, channels, playlists or search terms go in; captions in your languages are read; clean text, Markdown and RAG chunks with timestamps come out](https://raw.githubusercontent.com/s3nafps/YouTube-Transcripts-for-AI/main/docs/images/hero.png)

### Why use it

- **Bulk input.** Mix video URLs, Shorts, whole channels (`@handle`), playlists and YouTube searches in one run.
- **Ready for AI.** Each video comes back as plain text, Markdown with timestamps, and RAG chunks of about 300 words with start and end times and a `&t=` link.
- **Video facts included.** Title, channel, publish date, length, views, category, description and keywords at no extra cost.
- **Any language.** Pick your preferred caption languages, allow or block auto-generated captions, or have YouTube translate the captions into another language.
- **Reliable.** Requests go through residential proxies with automatic retries, and you only pay when a transcript is returned.

### How to get YouTube transcripts in 3 steps

1. Paste video URLs, `@channel` handles, playlist URLs or search terms into the input.
2. Pick your caption languages (English by default) and the RAG chunk size.
3. Click **Start**, then download the results as JSON, CSV or Excel, or read them through the API.

![Example output for one video: title, channel, publish date, language, word count and RAG chunks with start and end times and a timestamped YouTube link](https://raw.githubusercontent.com/s3nafps/YouTube-Transcripts-for-AI/main/docs/images/output.png)

### Input

| Field | What it does | Default |
| --- | --- | --- |
| `videos` | Video or Shorts URLs, or video IDs | |
| `channels` | Channel URLs, `@handles` or channel IDs (newest videos first) | |
| `playlists` | Playlist URLs or IDs | |
| `searchQueries` | Search terms (top video results) | |
| `maxVideosPerSource` | Videos per channel, playlist or search | 20 |
| `languages` | Preferred caption languages, in order | `["en"]` |
| `allowAutoGenerated` | Use YouTube's automatic captions when needed | `true` |
| `translateTo` | Translate captions into this language, for example `ar` | |
| `chunkWords` | RAG chunk size in words (0 = off) | 300 |
| `includeMarkdown`, `includeSegments`, `includeDescription` | Turn parts of the output on or off | `true` |

If no preferred language matches, the actor uses the video's own spoken language.

### Output

One dataset row per video:

```json
{
  "videoId": "aircAruvnKk",
  "url": "https://www.youtube.com/watch?v=aircAruvnKk",
  "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": 24895211,
  "category": "Education",
  "language": "en",
  "isAutoGenerated": false,
  "isTranslated": false,
  "wordCount": 3357,
  "text": "This is a 3. It's sloppily written and rendered at an extremely low resolution...",
  "markdown": "# But what is a neural network? ...\n\n## Transcript\n\n[0:04](https://www.youtube.com/watch?v=aircAruvnKk&t=4s) This is a 3...",
  "segments": [{ "start": 4.22, "duration": 1.18, "text": "This is a 3." }],
  "chunks": [{ "index": 0, "text": "This is a 3. ...", "start": 4.22, "end": 100.26, "url": "https://www.youtube.com/watch?v=aircAruvnKk&t=4s" }],
  "availableLanguages": [{ "code": "en", "name": "English", "isAutoGenerated": false }],
  "error": null
}
```

Videos without captions still get a row with the video facts and `"errorCode": "no_captions"`. You are not charged for them.

### Use it from code

#### Python

```python
from apify_client import ApifyClient

client = ApifyClient("<YOUR_APIFY_TOKEN>")
run = client.actor("s3nafps/youtube-transcripts-for-ai").call(run_input={
    "channels": ["@3blue1brown"],
    "maxVideosPerSource": 50,
})
for video in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(video["title"], video["wordCount"])
```

#### LangChain documents for RAG

```python
from langchain_core.documents import Document

docs = [
    Document(page_content=c["text"], metadata={"title": v["title"], "url": c["url"], "start": c["start"]})
    for v in client.dataset(run["defaultDatasetId"]).iterate_items() if v.get("chunks")
    for c in v["chunks"]
]
```

Each chunk keeps a link to its moment in the video, so your AI's answers can cite the exact timestamp.

#### AI agents (MCP)

Add the actor to [Apify's MCP server](https://mcp.apify.com) and Claude, Cursor or any MCP client can call it as a tool.

### Pricing

![Price per 1,000 transcripts: $2 for this actor, $5, $7 and $10 for other popular Store actors](https://raw.githubusercontent.com/s3nafps/YouTube-Transcripts-for-AI/main/docs/images/price.png)

| What | Price |
| --- | --- |
| Transcript returned | $0.002 ($2 per 1,000) |
| Run start | $0.005 |
| Video with no captions, unavailable or failed | Free |
| Listing videos from channels, playlists or searches | Free |

Set a maximum cost per run in the run options and the actor stops cleanly when it is reached.

### FAQ

**Does it transcribe videos that have no captions?** Not yet. It reads the captions YouTube already has, including auto-generated ones, which covers most videos with speech.

**Can I get transcripts in another language?** Yes. Set `languages` to pick from existing captions, or `translateTo` to have YouTube translate them.

**Does it work for YouTube Shorts?** Yes. Paste Shorts URLs like any video, or find them through search.

**Can I use it as a YouTube transcript API?** Yes. Start a run through the Apify API or the Python and JavaScript clients and read the dataset, as shown above.

**Is there a limit?** No hard limit. Use `maxVideosPerSource` for channels, playlists and searches.

**Is it legal?** It only reads public captions. Check that your use follows YouTube's terms and copyright law where you live.

### Related Actors

- [Website to Markdown for LLMs & RAG](https://apify.com/s3nafps/ai-ready-webpage-extractor): turn whole websites into clean Markdown.
- [Google Custom Search API Replacement](https://apify.com/s3nafps/google-custom-search-api): Google results in Custom Search JSON format.
- [Google Trends Scraper: Bulk Compare 100+ Keywords](https://apify.com/s3nafps/google-trends-bulk-compare): compare hundreds of keywords on one Google Trends scale.

Found a bug or need a field? Open an issue on the actor's Issues tab. If it saves you time, a review on the Store helps others find it.

# Actor input Schema

## `videos` (type: `array`):

Video or Shorts URLs, or 11-character video IDs.

## `channels` (type: `array`):

Channel URLs, @handles or channel IDs. Takes the newest videos of each channel.

## `playlists` (type: `array`):

Playlist URLs or IDs.

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

Takes the top YouTube video results for each term.

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

How many videos to take from each channel, playlist or search term.

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

Caption languages in order of preference, as codes like en, ar, es or pt-BR. If none match, the actor uses the video's own language.

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

Use YouTube's automatic captions when a video has no captions written by a person.

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

Optional language code, for example en or ar. YouTube translates the captions into this language.

## `chunkWords` (type: `integer`):

Split each transcript into chunks of about this many words, each with its start time and a link to that moment. 0 turns chunks off.

## `includeMarkdown` (type: `boolean`):

A Markdown version with a header and timestamped paragraphs.

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

Every caption line with its start time and duration in seconds.

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

The video's description text.

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

How many videos to fetch at the same time.

## `proxyCountry` (type: `string`):

Two-letter country code for the residential proxy. Change it if videos are blocked in the US.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=aircAruvnKk"
  ],
  "maxVideosPerSource": 20,
  "languages": [
    "en"
  ],
  "allowAutoGenerated": true,
  "chunkWords": 300,
  "includeMarkdown": true,
  "includeSegments": true,
  "includeDescription": true,
  "maxConcurrency": 5,
  "proxyCountry": "US"
}
```

# Actor output Schema

## `transcripts` (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 = {
    "videos": [
        "https://www.youtube.com/watch?v=aircAruvnKk"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("s3nafps/youtube-transcripts-for-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 = { "videos": ["https://www.youtube.com/watch?v=aircAruvnKk"] }

# Run the Actor and wait for it to finish
run = client.actor("s3nafps/youtube-transcripts-for-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 '{
  "videos": [
    "https://www.youtube.com/watch?v=aircAruvnKk"
  ]
}' |
apify call s3nafps/youtube-transcripts-for-ai --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,s3nafps/youtube-transcripts-for-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/4Ug3O25WKvL15wlWC/builds/lDPnrePKS7UOQt2Xp/openapi.json
