# YouTube Transcript Scraper (`upadhyay.labs/youtube-transcript-scraper`) Actor

Extract YouTube transcripts at scale from videos, Shorts, playlists, and channels. Get timestamped captions in structured JSON with multi-language support, automatic fallback, and translation — ideal for AI, RAG pipelines, search, research, and content analysis.

- **URL**: https://apify.com/upadhyay.labs/youtube-transcript-scraper.md
- **Developed by:** [Upadhyay Labs](https://apify.com/upadhyay.labs) (community)
- **Features:** Limited permissions
- **Stats:** 1 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## 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

Extract transcripts and captions from YouTube videos, Shorts, playlists, and channels in bulk. Returns clean, timestamped text in structured JSON — ready for AI, RAG, search indexing, and content analysis. Pay only for successfully extracted transcripts.

https://www.youtube.com/watch?v=EVmh0_rAhCo

### Why use this Actor?

- **Bulk extraction** — process hundreds of videos in a single run from videos, playlists, and channels
- **Multi-language** — request transcripts in any language YouTube supports, with automatic fallback and translation
- **Manual or auto-generated captions** — choose human-made captions for accuracy, or include auto-generated (ASR) captions
- **AI/RAG-ready** — optional pre-chunked output with timestamp anchors, sized for embeddings pipelines
- **Timestamped segments** — every caption segment includes `start`, `duration`, `end`, and `text`
- **Rich metadata** — title, channel, duration, publish date, view count, and caption provenance per video
- **Structured errors** — failed videos report a clear error code and message, never a blank row
- **Pay only for results** — charged per successful transcript; failed videos cost nothing
- **Fast and lightweight** — no browser overhead

### Use cases

- **RAG pipelines** — feed transcript chunks into vector databases for retrieval-augmented generation
- **AI training data** — build datasets of video content for LLM fine-tuning
- **Content analysis** — analyze topics, sentiment, and messaging at scale
- **Search indexing** — make video content searchable by indexing transcript text
- **Content repurposing** — turn video content into blog posts, summaries, or study materials
- **Market research** — extract and compare competitor video content
- **Accessibility** — generate text versions of video content

### Input parameters

| Field | Type | Description | Default |
|---|---|---|---|
| `startUrls` | array | YouTube URLs to extract transcripts from | required |
| `language` | string | Preferred transcript language code (e.g. `en`, `es`, `hi`, `ja`) | `en` |
| `languageFallback` | boolean | Fall back to another available language if preferred is not found | `true` |
| `preferManualCaptions` | boolean | Prefer human-made captions over auto-generated when both exist | `true` |
| `includeAutoGenerated` | boolean | Include auto-generated (ASR) captions | `true` |
| `includeTimestampedSegments` | boolean | Include timestamped caption segments in output | `true` |
| `includeRagChunks` | boolean | Include AI/RAG-ready chunks with timestamp anchors | `false` |
| `chunkSizeChars` | integer | Target character length per RAG chunk (200–8000) | `2000` |
| `chunkOverlapChars` | integer | Character overlap between consecutive chunks (0–2000) | `200` |
| `maxVideosPerChannel` | integer | Max videos to expand from a single channel | `50` |
| `maxVideosPerPlaylist` | integer | Max videos to expand from a single playlist | `200` |
| `maxTotalVideos` | integer | Hard cap across all sources in one run | `500` |
| `maxConcurrency` | integer | Videos processed in parallel (1–50) | `20` |
| `proxyConfiguration` | object | Apify Proxy settings | Apify Proxy enabled |

#### Supported URL formats

- `https://www.youtube.com/watch?v=VIDEO_ID`
- `https://youtu.be/VIDEO_ID`
- `https://www.youtube.com/shorts/VIDEO_ID`
- `https://www.youtube.com/playlist?list=PLAYLIST_ID`
- `https://www.youtube.com/@handle`
- `https://www.youtube.com/channel/UC...`

#### Example input

```json
{
    "startUrls": [
        { "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" }
    ],
    "language": "en",
    "includeAutoGenerated": true,
    "includeRagChunks": false
}
```

### Output

Each video produces one JSON object in the dataset.

#### Output fields

| Field | Type | Description |
|---|---|---|
| `status` | string | `SUCCESS` or `FAILED` |
| `videoId` | string | YouTube video ID |
| `url` | string | Full YouTube URL |
| `title` | string | Video title |
| `channelName` | string | Channel name |
| `channelId` | string | Channel ID |
| `durationSeconds` | number | Video duration in seconds |
| `publishedAt` | string | Publish date |
| `viewCount` | number | View count |
| `isShort` | boolean | Whether the video is a YouTube Short |
| `language` | string | Language code of the returned transcript |
| `isAutoGenerated` | boolean | Whether the caption track is auto-generated (ASR) |
| `isTranslated` | boolean | Whether the transcript was auto-translated |
| `wordCount` | number | Total word count |
| `characterCount` | number | Total character count |
| `transcript` | string | Full concatenated transcript text |
| `segments` | array | Timestamped caption segments (`start`, `duration`, `end`, `text`) |
| `chunks` | array | RAG chunks with timestamp anchors (when enabled) |
| `errorCode` | string | Error code for failed videos |
| `errorMessage` | string | Error description for failed videos |

#### Example output

```json
{
    "status": "SUCCESS",
    "videoId": "dQw4w9WgXcQ",
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "title": "Rick Astley - Never Gonna Give You Up (Official Music Video)",
    "channelName": "Rick Astley",
    "channelId": "UCuAXFkgsw1L7xaCfnd5JJOw",
    "durationSeconds": 212,
    "publishedAt": "2009-10-25",
    "viewCount": 1700000000,
    "isShort": false,
    "language": "en",
    "isAutoGenerated": false,
    "isTranslated": false,
    "languageSelectionReason": "exact_match",
    "availableLanguages": [
        { "languageCode": "en", "kind": "manual", "name": "English" }
    ],
    "transcriptDurationSeconds": 210.5,
    "wordCount": 412,
    "characterCount": 2150,
    "transcript": "We're no strangers to love. You know the rules and so do I...",
    "segments": [
        { "start": 0.0, "duration": 2.3, "end": 2.3, "text": "We're no strangers to love" },
        { "start": 2.3, "duration": 3.1, "end": 5.4, "text": "You know the rules and so do I" }
    ],
    "chunks": [],
    "sourceUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "sourceType": "video",
    "errorCode": null,
    "errorMessage": null,
    "fetchedAt": "2026-11-05T10:00:00.000Z"
}
```

#### Error codes

| Code | Meaning |
|---|---|
| `VIDEO_UNAVAILABLE` | Video was deleted or does not exist |
| `PRIVATE_VIDEO` | Video is private or requires sign-in |
| `AGE_RESTRICTED` | Video is age-restricted |
| `LIVE_STREAM_NO_TRANSCRIPT` | Live stream has not ended or been processed yet |
| `TRANSCRIPTS_DISABLED` | Captions are disabled on this video |
| `NO_CAPTIONS_FOUND` | Caption track had no usable text |
| `LANGUAGE_NOT_AVAILABLE` | Requested language unavailable and fallback disabled |
| `TRANSCRIPT_FETCH_BLOCKED` | YouTube blocked the caption fetch — try using proxy |
| `PLAYLIST_UNAVAILABLE` | Playlist is private, deleted, or empty |
| `CHANNEL_UNAVAILABLE` | Channel is private, deleted, or empty |

### Pricing

YouTube Transcript Scraper uses **Pay-Per-Event** pricing and
Failed videos are never charged.

### Integrations

Connect YouTube Transcript Scraper with other tools through the Apify platform:

- **Apify API** — run programmatically and retrieve results via REST API
- **Webhooks** — trigger your pipeline when a run finishes
- **Scheduled runs** — set up recurring transcript extraction
- **Google Sheets, Slack, Zapier, Make** — connect output through Apify integrations
- **Dataset export** — download results as JSON, CSV, Excel, or XML

#### Using JavaScript

```javascript
import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });

const run = await client.actor('upadhyay.labs/youtube-transcript-scraper').call({
    startUrls: [{ url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }],
    language: 'en',
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);
```

#### Using Python

```python
from apify_client import ApifyClient

client = ApifyClient('YOUR_API_TOKEN')

run = client.actor('upadhyay.labs/youtube-transcript-scraper').call(run_input={
    'startUrls': [{'url': 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'}],
    'language': 'en',
})

items = client.dataset(run['defaultDatasetId']).list_items().items
print(items)
```

### FAQ

#### Is it legal to scrape YouTube transcripts?

This Actor accesses publicly available caption data. It does not bypass authentication or access private content. Users are responsible for ensuring their use complies with YouTube's Terms of Service and applicable laws.

#### What languages are supported?

Any language that YouTube captions are available in. Set the `language` input to a language code like `en`, `es`, `fr`, `de`, `ja`, `hi`, `pt`, `ko`, or `zh`. If the preferred language is unavailable, the Actor can fall back to another language or translate the transcript automatically.

#### Why did a video return TRANSCRIPT_FETCH_BLOCKED?

YouTube may block caption requests from certain IP addresses. Enable Apify Proxy in the input settings. If blocks persist, lower `maxConcurrency` or try residential proxies.

#### Can I extract transcripts from playlists or channels?

Yes. Add a playlist or channel URL and the Actor expands it into individual videos automatically. Use `maxVideosPerPlaylist` and `maxVideosPerChannel` to control how many videos are extracted per source.

#### What is RAG chunking?

RAG chunking splits the transcript into overlapping text segments with timestamp anchors, sized for embeddings pipelines. Enable it with `includeRagChunks: true`. Default chunk size is 2000 characters with 200-character overlap.

#### Can I get only human-made captions?

Yes. Set `includeAutoGenerated: false` to skip auto-generated (ASR) captions. Only videos with human-made captions will return transcripts.

# Actor input Schema

## `startUrls` (type: `array`):

Videos, Shorts, playlists or channels to extract transcripts from. Accepts any YouTube URL format plus bare 11-character video IDs.

## `language` (type: `string`):

BCP-47 / ISO 639-1 language code (e.g. "en", "es", "hi"). Falls back automatically if unavailable — see languageFallback.

## `languageFallback` (type: `boolean`):

If disabled, videos lacking a transcript in the preferred language are reported as LANGUAGE_NOT_AVAILABLE instead of returning a different language.

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

When both manual and auto-generated (ASR) captions exist in the same language, use the manual one for higher accuracy.

## `includeAutoGenerated` (type: `boolean`):

If disabled, only videos with human-made captions are processed; others are reported as NO_CAPTIONS_FOUND.

## `includeTimestampedSegments` (type: `boolean`):

Include the full array of { start, duration, end, text } caption segments in the output alongside the full transcript string.

## `includeRagChunks` (type: `boolean`):

Include a `chunks` array: transcript pre-split into overlapping, timestamp-anchored chunks sized for embeddings/RAG pipelines.

## `chunkSizeChars` (type: `integer`):

Target character length per chunk when "Include AI/RAG-ready chunks" is enabled.

## `chunkOverlapChars` (type: `integer`):

Character overlap between consecutive chunks, to preserve context across boundaries.

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

Safety cap on how many videos to expand from a single channel URL.

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

Safety cap on how many videos to expand from a single playlist URL.

## `maxTotalVideos` (type: `integer`):

Hard cap across all sources combined. Protects against runaway cost.

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

Maximum number of videos processed in parallel. Pure HTTP allows high concurrency at minimal memory cost.

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

Apify Proxy required. YouTube blocks datacenter IPs — the actor auto-escalates to RESIDENTIAL proxy on first block. For best results, set proxy group to RESIDENTIAL.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    }
  ],
  "language": "en",
  "languageFallback": true,
  "preferManualCaptions": true,
  "includeAutoGenerated": true,
  "includeTimestampedSegments": true,
  "includeRagChunks": false,
  "chunkSizeChars": 2000,
  "chunkOverlapChars": 200,
  "maxVideosPerChannel": 50,
  "maxVideosPerPlaylist": 200,
  "maxTotalVideos": 500,
  "maxConcurrency": 20,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,upadhyay.labs/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/Hc3afv5eO8EPKsgHk/builds/nmxUwDj8AfcRQTMZ3/openapi.json
