# YouTube Transcript Scraper for AI Agents (`perceptual_arboretum/video-transcripts-for-ai`) Actor

Extract YouTube transcripts with metadata (title, channel, date, views, language) as LLM-ready text, timestamped segments and RAG chunks. Videos, Shorts, channels, playlists and search. Pay only for successful transcripts.

- **URL**: https://apify.com/perceptual_arboretum/video-transcripts-for-ai.md
- **Developed by:** [Delfos Athletics](https://apify.com/perceptual_arboretum) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.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.

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 Agents

Extract **clean YouTube transcripts with rich metadata** in a format that LLMs, AI agents and RAG pipelines can use straight away: full plain text, timestamped segments, ready-made chunks with token estimates, plus title, channel, publish date, views, likes, duration, category, tags and language info.

Works with **videos, Shorts, youtu.be links, channels, playlists and YouTube search**. Instagram Reels and TikTok support is coming next. The output format will stay the same, so your agents won't need changes.

**Price: $5 per 1,000 transcripts.** You only pay for videos that return a transcript. Private, deleted or caption-less videos are free.

### What can this YouTube Transcript Scraper do?

- 📝 **Get the full transcript** of any public YouTube video as one clean string. Line breaks, HTML entities and caption markup are removed.
- ⏱️ **Timestamped segments** (`start`, `end`, `text`) let you cite the exact second or deep-link to it.
- 🧩 **RAG-ready chunks.** Choose a window, e.g. 60 s, and get chunks with start/end times and a token estimate each.
- 🌍 **Pick your language.** Set a preference order (e.g. `es`, `en`), request YouTube's machine translation (best effort), or fall back to the original spoken language.
- 🧑‍💻 **Human captions first.** Creator-uploaded captions are used when they exist; auto-generated captions are the fallback.
- 📊 **Metadata for context**: title, description, channel name/ID/URL, publish date, duration, views, likes, category, keywords, thumbnail, live/Shorts flags.
- 📺 **Bulk input**: paste a channel (`@handle`) or playlist and get its latest N videos, or run search queries.
- 🔁 **Reliable**: retries automatically on a new IP, escalates to residential proxies only when YouTube blocks a request, and has a second extraction engine as a fallback.
- 🤖 **Built for agents**: one predictable JSON object per video, with a `status` field so your agent always knows what happened.

### What data can I extract from YouTube videos?

| Field | Example |
|---|---|
| `text` | Full transcript as plain text |
| `segments` | `[{ "start": 1.2, "end": 3.36, "text": "All right, so here we are" }]` |
| `chunks` | `[{ "timestamp": "01:00", "start": 60.1, "end": 119.8, "text": "…", "estimatedTokens": 212 }]` |
| `timestampedText` | `[00:00] Intro… \n[00:30] …` |
| `title`, `description`, `keywords`, `category` | Video info |
| `channelName`, `channelId`, `channelUrl` | Creator |
| `publishedAt`, `durationSeconds`, `viewCount`, `likeCount` | Stats |
| `transcriptLanguageCode`, `isAutoGenerated`, `isTranslated`, `availableLanguages` | Caption info |
| `wordCount`, `characterCount`, `estimatedTokens` | Size of the transcript, to budget your context window |
| `status`, `error` | `ok`, `no_transcript`, `unavailable`, `blocked`, `unsupported` |

### How to scrape YouTube transcripts

1. Click **Try for free**.
2. Paste one or more YouTube URLs (videos, Shorts, channels or playlists) or add search queries.
3. Optionally set preferred languages, a translation target and chunk size.
4. Click **Start** and download the results as JSON, CSV, Excel or via the API.

### How much does it cost to scrape YouTube transcripts?

This Actor uses **pay-per-event** pricing: **$0.005 per video with a transcript**, i.e. **$5 per 1,000 transcripts**. Platform usage and proxies are included, and failed or caption-less videos cost nothing. On the free Apify plan ($5 of monthly credits) you can extract roughly 1,000 transcripts a month at no cost.

Set **Max cost per run** in the run options to cap your spend. The Actor stops cleanly when it reaches the limit.

### Input example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "https://www.youtube.com/@mkbhd",
    "https://www.youtube.com/playlist?list=PLxxxxxxxx"
  ],
  "searchQueries": ["how transformers work"],
  "maxVideosPerSource": 10,
  "languages": ["en", "es"],
  "translateTo": "",
  "chunkSeconds": 60,
  "includeSegments": true
}
```

### Output example

```json
{
  "status": "ok",
  "platform": "youtube",
  "videoId": "jNQXAC9IVRw",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "title": "Me at the zoo",
  "channelName": "jawed",
  "channelId": "UC4QobU6STFB0P71PMvOGN5A",
  "publishedAt": "2005-04-23T20:31:52-07:00",
  "durationSeconds": 19,
  "viewCount": 380000000,
  "transcriptLanguageCode": "en",
  "isAutoGenerated": false,
  "text": "All right, so here we are, in front of the elephants...",
  "wordCount": 39,
  "estimatedTokens": 49,
  "segments": [{ "start": 1.2, "end": 3.36, "text": "All right, so here we are," }]
}
```

### Using it from AI agents (MCP, LangChain, n8n, Make, Zapier)

- **MCP**: add this Actor to the [Apify MCP server](https://mcp.apify.com) and your agent (Claude, Cursor, ChatGPT…) can call it as a tool: *"get the transcript of this video and summarise it"*.
- **API**: run it synchronously and get the items back in one call:
  `POST https://api.apify.com/v2/acts/perceptual_arboretum~video-transcripts-for-ai/run-sync-get-dataset-items?token=YOUR_TOKEN`
- **LangChain / LlamaIndex**: use the Apify dataset loader and map `text` (or each `chunks[]`) to documents, with the metadata fields as document metadata.
- **No-code**: the official Apify integrations for n8n, Make and Zapier work out of the box.

### Tips

- Leave **Fall back to any available language** on, so videos in other languages still return their original transcript.
- For RAG, set `chunkSeconds` to 45–90 and index `chunks[]`. Each chunk keeps its timestamp for citations.
- Turn off `includeSegments` if you only need the text. Items get much smaller.

### FAQ

**Does it work for videos without captions?** No. The Actor reads YouTube's own captions (human or auto-generated). Videos with captions disabled return `status: "no_transcript"` and are not charged. Audio transcription (speech-to-text) for those videos is on the roadmap.

**Does translation always work?** It uses YouTube's own machine translation, which YouTube often rate-limits. When it is refused you still get the original transcript (and are charged normally), with an explanation in the `warnings` field.

**Is scraping YouTube transcripts legal?** The Actor only reads publicly available data and no personal data beyond what creators publish. Respect copyright when reusing transcripts and check the rules that apply to your use case. If unsure, ask a lawyer.

**Something broke or you need a feature?** Open an issue in the **Issues** tab. Instagram and TikTok are coming next, and requests help us prioritise.

# Actor input Schema

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

YouTube video, Shorts, youtu.be, channel (@handle), playlist URLs or bare 11-character video IDs. Channels and playlists are expanded to their latest videos (see 'Max videos per channel/playlist/search').

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

Optional. Each query is searched on YouTube and the top results are transcribed.

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

How many videos to take from each channel, playlist or search query (newest first for channels).

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

Hard cap for the whole run. 0 = no cap.

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

Language codes in order of preference, e.g. 'en', 'es', 'pt-BR'. 'en' also matches 'en-GB', 'en-US'...

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

If none of the preferred languages exist, return the transcript in the video's original language instead of no transcript.

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

Optional language code (e.g. 'en'). Best effort: uses YouTube's machine translation, which YouTube often rate-limits. If it is refused, the original-language transcript is returned with a note in 'warnings'.

## `preferManualCaptions` (type: `boolean`):

Use creator-uploaded captions over auto-generated ones when both exist.

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

Adds 'segments' \[{start, end, text}] - useful for citations and jumping to the exact second.

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

Adds 'timestampedText': paragraphs prefixed with \[mm:ss] every ~30 s. Great for pasting into an LLM prompt.

## `chunkSeconds` (type: `integer`):

If > 0, adds 'chunks' - the transcript split into windows of this many seconds, each with start/end and token estimate. 0 = off.

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

Include the full video description in the output.

## `extendedMetadata` (type: `boolean`):

Makes one extra lightweight request per video to get publish date, category and like count.

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

How many videos to process in parallel.

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

Proxy used for YouTube requests. The default (Apify Proxy, automatic) works for most runs.

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

If YouTube blocks a request, retry it automatically through residential IPs. Recommended.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "maxVideosPerSource": 20,
  "maxVideos": 0,
  "languages": [
    "en"
  ],
  "fallbackToAnyLanguage": true,
  "preferManualCaptions": true,
  "includeSegments": true,
  "includeTimestampedText": false,
  "chunkSeconds": 0,
  "includeDescription": true,
  "extendedMetadata": true,
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  },
  "residentialFallback": true
}
```

# Actor output Schema

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

No description

## `fullJson` (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=jNQXAC9IVRw"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("perceptual_arboretum/video-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 = {
    "urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "proxyConfiguration": { "useApifyProxy": True },
}

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,perceptual_arboretum/video-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/3UyMQLR6S8wDn4op4/builds/8Q8GLYLSp2G07IQbz/openapi.json
