# Youtube Transcript API (`2eightnine/youtube-transcript-api`) Actor

Pull transcripts from YouTube videos, Shorts and 3-hour podcasts. Full text, timed segments and SRT subtitles in any caption language. No YouTube account. Videos without captions are free.

- **URL**: https://apify.com/2eightnine/youtube-transcript-api.md
- **Developed by:** [James J. Lee](https://apify.com/2eightnine) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $6.00 / 1,000 transcript delivereds

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 API: Text, Timestamps & SRT, No Login

Get the transcript of any public YouTube video, Short or live replay as clean text, timed segments or SRT subtitles.

**You pay only for transcripts delivered.** Videos without captions, unavailable videos and failures are free, and every record says why.

### What you get

- **Full text** ready for summaries, search, or an AI model
- **Timed segments**: every caption line with its start time and duration
- **SRT subtitles**, optional
- **Any language** the video has, manual or auto-generated, with your order of preference
- **Video details**: title, channel, length, view count, and every caption language available
- **Any link form**: watch links, youtu.be, Shorts, embeds, live links or bare video IDs

### Why this one

- **A clear reason for every video that has no transcript.** `NO_CAPTIONS`, `AGE_RESTRICTED`, `UNAVAILABLE` or `INVALID_ID`, never an empty transcript you were charged for.
- **Built to get past blocks.** Every attempt uses a new proxy address, and videos that still fail get a second pass at the end of the run.
- **Predictable cost.** Set `maxVideos`, or a maximum charge for the run, and it stops there.

### Input

| Field | Default | Notes |
| --- | --- | --- |
| `videos` | required | YouTube links or video IDs |
| `languages` | `["en"]` | Preferred caption languages, in order |
| `includeSegments` | `true` | Timed caption lines |
| `includeSrt` | `false` | SRT subtitle file in the `srt` field |
| `maxVideos` | `1000` | Run processes at most this many videos |
| `maxConcurrency` | `3` | Videos in parallel, 1 to 10 |
| `proxyConfiguration` | Residential | YouTube blocks most datacenter addresses |

### Output

```json
{
  "status": "OK",
  "videoId": "aircAruvnKk",
  "url": "https://www.youtube.com/watch?v=aircAruvnKk",
  "title": "But what is a neural network? | Deep learning chapter 1",
  "channel": "3Blue1Brown",
  "lengthSeconds": 1120,
  "language": "en",
  "isGenerated": false,
  "availableLanguages": ["ar", "en", "en (auto)", "es", "..."],
  "wordCount": 3357,
  "text": "This is a 3. It's sloppily written and rendered at an extremely low resolution of 28x28 pixels...",
  "segments": [{ "start": 4.22, "duration": 3.1, "text": "This is a 3." }],
  "charged": true
}
```

Videos without a transcript come back with `status` set to the reason and `charged: false`.

### Limits to know about

- **Only videos with captions.** If a video has no captions, manual or automatic, there is no transcript to return. This Actor does not transcribe audio.
- **Public videos only.** Private, members-only and age-restricted videos are reported, not fetched.
- **No official API.** YouTube can change how captions are served without notice. If something breaks, open an issue and it will be looked at quickly.

### For developers

```bash
npm install
npm test        # offline tests
npm run live    # real requests to YouTube from your own connection
```

## youtube-transcript-api

# Actor input Schema

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

YouTube links or 11-character video IDs. Watch links, youtu.be links, Shorts, embeds and live links all work.

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

Language codes in order of preference, such as en, es, de. For each video the first available one is used, manual captions before auto-generated ones. If none is available, the video's own captions are returned.

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

Return every caption line with its start time and duration, as well as the full text.

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

Also return the transcript as an SRT subtitle file in the srt field.

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

The run processes at most this many videos. Keeps cost predictable.

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

How many videos to fetch at the same time, each on its own proxy address.

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

How many times to retry a video that YouTube blocks, each time from a new address, before moving it to the end-of-run retry pass.

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

YouTube blocks most datacenter addresses. Residential proxies are strongly recommended.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=aircAruvnKk",
    "https://www.youtube.com/watch?v=8jPQjjsBbIc"
  ],
  "languages": [
    "en"
  ],
  "includeSegments": true,
  "includeSrt": false,
  "maxVideos": 1000,
  "maxConcurrency": 3,
  "maxRetries": 4,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One item per video: status, title, channel, language, the full text and, if requested, timed segments and SRT. The charged field shows whether the video was billed.

## `summary` (type: `string`):

Counts of delivered transcripts, videos without a transcript and failures, with a breakdown of reasons.

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

// Run the Actor and wait for it to finish
const run = await client.actor("2eightnine/youtube-transcript-api").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",
        "https://www.youtube.com/watch?v=8jPQjjsBbIc",
    ],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("2eightnine/youtube-transcript-api").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",
    "https://www.youtube.com/watch?v=8jPQjjsBbIc"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call 2eightnine/youtube-transcript-api --silent --output-dataset

```

## MCP server setup

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

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/G3xVuzdbc5H6wf9Bc/builds/GEuQYcz91i9nLpF8V/openapi.json
