# YouTube Transcript Scraper (`f-keys/youtube-transcript-scraper`) Actor

Bulk-extract YouTube video transcripts and subtitles. Manual and auto-generated captions, 100+ languages, optional translation, plain text, timestamped segments, and SRT output.

- **URL**: https://apify.com/f-keys/youtube-transcript-scraper.md
- **Developed by:** [Vince Gonzalez](https://apify.com/f-keys) (community)
- **Categories:** Videos, AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.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?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTube Transcript Scraper

Bulk-extract transcripts and subtitles from YouTube videos. Give it a list of video URLs (or IDs); get back clean, structured transcript data for each one — plain text, timestamped segments, and optional ready-to-use SRT subtitle files.

Built for researchers, AI/ML teams building training corpora, content analysts, translators, and anyone who needs YouTube captions at volume without touching a browser.

***

### What it does

- **Manual and auto-generated captions.** Prefers human-uploaded captions; falls back to YouTube's automatic speech recognition when that's all a video has.
- **100+ languages.** Ask for a preferred language; the actor picks the best matching track.
- **On-the-fly translation.** When your language isn't available, optionally have YouTube machine-translate an existing track into it.
- **Three output shapes per video:** one flat `text` string, an array of `{ start, dur, text }` segments, and (optionally) a complete `.srt`.
- **Bulk and resilient.** Processes many videos in parallel, retries transient failures on fresh proxy sessions, and never lets one bad video stop the run — videos without captions or that are private/removed come back as clearly labeled rows.

### Input

| Field | Type | Description |
|---|---|---|
| `videoUrls` | array (required) | YouTube URLs (watch, `youtu.be`, shorts, embed, live) or bare 11-character IDs. Duplicates removed automatically. |
| `language` | string | Preferred ISO language code (`en`, `es`, `de`, `pt`, `ja`, …). Default `en`. |
| `translate` | boolean | Machine-translate into `language` when no native track exists. Default `false`. |
| `includeSrt` | boolean | Add an `.srt` string to each result. Default `false`. |
| `concurrency` | integer | Videos processed in parallel, 1–20. Default `5`. |
| `maxRetries` | integer | Retries per video, each on a fresh proxy session. Default `3`. |
| `proxyConfiguration` | object | Apify Proxy recommended — YouTube throttles repeated requests from one address. |

#### Example input

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtu.be/jNQXAC9IVRw",
    "9bZkp7q19f0"
  ],
  "language": "en",
  "includeSrt": true,
  "concurrency": 5,
  "proxyConfiguration": { "useApifyProxy": true }
}
```

### Output

Each video becomes one dataset row.

```json
{
  "videoId": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channel": "Rick Astley",
  "lengthSeconds": 213,
  "status": "ok",
  "language": "en",
  "trackKind": "manual",
  "translated": false,
  "segmentCount": 61,
  "text": "We're no strangers to love ...",
  "segments": [
    { "start": 18.56, "dur": 3.2, "text": "We're no strangers to love" }
  ],
  "srt": "1\n00:00:18,560 --> 00:00:21,760\nWe're no strangers to love\n\n..."
}
```

**`status`** is one of:

- `ok` — transcript extracted.
- `no-captions` — video exists but has no captions in any usable form.
- `error` — video is private, removed, age-restricted beyond reach, or otherwise unavailable (see the `error` field).

Filter for `status = "ok"` to get just the successful transcripts.

### Pricing

Pay-per-event: you are charged only for each transcript successfully returned (`status = "ok"`). Videos with no captions or that fail cost nothing.

### Notes & limits

- Some videos genuinely have no captions — that is a property of the video, not a failure of the actor.
- Live streams that are still running, private videos, and members-only content cannot be transcribed.
- Using Apify Proxy (or your own residential proxy) is strongly recommended for any run of more than a handful of videos.
- This actor reads publicly available caption data. You are responsible for using the output in accordance with YouTube's Terms of Service and applicable copyright law in your jurisdiction.

### Running locally (developers)

```
npm install
npm test          # runs src/test-local.js against live YouTube, no Apify runtime needed
```

The transcript logic lives in `src/transcript.js` and has no dependency on the Apify SDK, so it is unit-testable with plain Node 18+.

***

www.f-keys.com | © 2026 F-Keys Creative LLC

# Actor input Schema

## `videoUrls` (type: `array`):

YouTube video URLs (watch, youtu.be, shorts, embed, live) or bare 11-character video IDs. Duplicates are removed automatically.

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

ISO language code to prefer (e.g. en, es, de, pt, ja). Manually uploaded captions in this language win over auto-generated ones. Falls back to English, then to whatever the video has.

## `translate` (type: `boolean`):

When the preferred language has no caption track, ask YouTube to machine-translate an available track into it.

## `includeSrt` (type: `boolean`):

Adds a ready-to-use .srt string to every result alongside plain text and timestamped segments.

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

How many videos to process in parallel (1-20).

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

Each retry uses a fresh proxy session.

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

Apify Proxy is recommended; YouTube throttles repeated requests from a single address.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "language": "en",
  "translate": false,
  "includeSrt": false,
  "concurrency": 5,
  "maxRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

The scraped video transcripts, as JSON dataset items.

# 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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

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

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

```

## MCP server setup

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