# YouTube Transcript API | Video to Text Scraper for AI (`andok/youtube-transcript-scraper`) Actor

Extract full transcripts and time-coded captions from any YouTube video. Build custom AI datasets, train LLMs, or repurpose video content.

- **URL**: https://apify.com/andok/youtube-transcript-scraper.md
- **Developed by:** [Andok](https://apify.com/andok) (community)
- **Categories:** Videos, AI, Developer tools
- **Features:** Limited permissions
- **Stats:** 28 total users, 0 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.47 / 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

Turn any YouTube video into clean, structured text ready for LLM context windows, RAG pipelines, or full-text search. Extracts captions directly from YouTube's internal player data — no browser, no API key, no rate-limit headaches. Process hundreds of videos in parallel with configurable concurrency.

### Features

- **Full transcript extraction** — pulls the complete caption track from any video with available subtitles
- **Timed segments** — returns individual segments with offset and duration for precise referencing
- **Bulk processing** — extract transcripts from hundreds of videos in a single run
- **Parallel execution** — configurable concurrency to balance speed and reliability
- **AI-ready output** — concatenated plain text field perfect for LLM ingestion
- **No API key required** — works directly with YouTube's public caption data

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `urls` | `array` | Yes | — | YouTube video URLs to extract transcripts from |
| `concurrency` | `integer` | No | `10` | Number of videos to process in parallel. Increase for large batches, decrease if you see errors. |

#### Input Example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "concurrency": 10
}
```

### Output

Each video produces one dataset row containing the full transcript as a single text block, plus an array of timed segments for granular access.

Key output fields:

| Field | Type | Description |
|-------|------|-------------|
| `inputUrl` | `string` | The video URL you provided |
| `videoId` | `string` | YouTube video ID |
| `fullText` | `string` | Complete transcript as a single text block |
| `segments` | `array` | Individual caption segments with timing data |
| `segments[].text` | `string` | Text content of the segment |
| `segments[].offset` | `number` | Start time in milliseconds |
| `segments[].duration` | `number` | Segment duration in milliseconds |

#### Output Example

```json
{
  "inputUrl": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "videoId": "jNQXAC9IVRw",
  "fullText": "Welcome to the presentation. Today we will cover three key topics in machine learning. First, let us look at supervised learning and how it differs from unsupervised approaches...",
  "segments": [
    { "text": "Welcome to the presentation.", "offset": 0, "duration": 2400 },
    { "text": "Today we will cover three key topics", "offset": 2400, "duration": 3100 },
    { "text": "in machine learning.", "offset": 5500, "duration": 1800 }
  ]
}
```

### Pricing

Pay per event on Apify platform.

| Event | Description |
|-------|-------------|
| Transcript | One video transcript extracted |

### Use Cases

- **RAG pipelines** — feed video transcripts into vector databases for retrieval-augmented generation
- **Content repurposing** — convert video content into blog posts, summaries, or social media threads
- **Research analysis** — make lecture and conference talk content searchable and quotable
- **SEO audits** — analyze what competitors say in their videos without watching them
- **Training data** — build domain-specific datasets from educational YouTube content

### Related Actors

| Actor | What it adds |
|-------|-------------|
| [YouTube Transcript MCP Server](https://apify.com/andok/youtube-transcript-mcp) | AI-powered transcription via MCP — works even on videos without captions |
| [YouTube Video Metadata Extractor](https://apify.com/andok/youtube-video-metadata) | Get views, likes, tags, and publish dates alongside your transcripts |
| [Markdown Extractor](https://apify.com/andok/markdown-extractor) | Convert web pages to clean markdown — complement video transcripts with written sources |

# Actor input Schema

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

YouTube video URLs to extract transcripts from. Each video must have captions available (auto-generated or manual).

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

Number of videos to process in parallel. Higher values speed up large batches but may cause errors if set too high.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "concurrency": 10
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `resultsCsv` (type: `string`):

No description

## `run` (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",
        "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("andok/youtube-transcript-scraper").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",
        "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("andok/youtube-transcript-scraper").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=dQw4w9WgXcQ",
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ]
}' |
apify call andok/youtube-transcript-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,andok/youtube-transcript-scraper"
        }
    }
}
```

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/DCKBs3rbfufIvQOWc/builds/X1AbmfE2x63kcuZI1/openapi.json
