# YouTube Transcript & Subtitles Extractor (`happysproutstore/youtube-transcript`) Actor

Get the transcript of any YouTube video, Short, channel or playlist as plain text, timestamped segments or SRT. Picks your preferred language, falls back to any language or YouTube auto-translate, and retries blocked requests on a fresh proxy IP. You only pay for transcripts delivered.

- **URL**: https://apify.com/happysproutstore/youtube-transcript.md
- **Developed by:** [Recep Vural](https://apify.com/happysproutstore) (community)
- **Categories:** Videos, AI, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.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 & Subtitles Extractor

Paste YouTube video URLs, Shorts, or whole channels and playlists. For each video you get **one row** containing the transcript as plain text, timestamped segments and, if you want it, a ready-made SRT file.

| Field | Meaning |
|---|---|
| `text` | The full transcript as one plain-text string |
| `segments` | `[{start, duration, text}]` in seconds (optional) |
| `srt` | A complete `.srt` subtitle file (optional) |
| `language` / `isAutoGenerated` / `isTranslated` | Which caption track was used |
| `availableLanguages` | Every caption track on the video. Auto-generated tracks are marked `(auto)` |
| `title`, `channel`, `durationSeconds`, `publishDate`, `viewCount` | Video metadata (optional) |
| `wordCount`, `charCount` | Transcript size |
| `error`, `errorMessage` | Empty when the row succeeded |

### How the language is chosen

1. Your `preferredLanguages` in order. Human-made captions beat auto-generated ones in the same language. `en` also matches `en-US` and `en-GB`.
2. If none match and auto-translate is on, the Actor tries YouTube's machine translation into your first language. This is best effort: YouTube offers only a few target languages (often only English) and sometimes refuses the request. When that happens you get the original language, and `translationNote` explains why.
3. If none match and fallback is on (the default), you get the video's original captions in whatever language they are.

### Input example

```json
{"videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://youtu.be/iG9CE55wbtY", "https://www.youtube.com/shorts/Y8IJi7iP5vk"],
 "channelOrPlaylistUrls": ["https://www.youtube.com/@3blue1brown"], "maxVideos": 10,
 "preferredLanguages": ["en", "de"], "includeSrt": true}
```

### Output example

```json
{"videoId": "jNQXAC9IVRw", "title": "Me at the zoo", "channel": "jawed", "language": "en", "isAutoGenerated": false,
 "isTranslated": false, "availableLanguages": ["en", "de"], "wordCount": 39, "durationSeconds": 19, "publishDate": "2005-04-24",
 "text": "All right, so here we are, in front of the elephants ...",
 "segments": [{"start": 1.2, "duration": 2.16, "text": "All right, so here we are, in front of the elephants"}], "error": null}
```

### Reliability

- **Two engines.** Each video goes through `youtube-transcript-api` first. If YouTube blocks that request, the Actor falls back to yt-dlp's caption tracks on the same IP.
- **New IP on every retry.** On HTTP 429, "Sign in to confirm you're not a bot" or a similar block, the Actor retries on a new proxy session with exponential backoff, up to 5 attempts by default.
- **Clear final errors.** These are never retried and **never charged**: `no_captions` (the video has none), `language_not_available` (fallback switched off), `video_unavailable` (private, deleted or invalid), `age_restricted`, `invalid_url`. A video that stays blocked after every attempt returns `blocked`, which is also free.

### Proxy

YouTube blocks many datacenter IPs from its caption endpoint, and it rate-limits any single IP after a few dozen requests. The default automatic Apify Proxy rotates IPs and is fine for small runs. For hundreds of videos or for scheduled runs, select the **Residential** proxy group. Residential traffic is billed by Apify per GB, but caption files are small.

### Pricing

Pay per event: you are charged only for each transcript delivered. Rows with an `error` are free.

Not affiliated with YouTube or Google. You are responsible for using transcripts in line with YouTube's Terms of Service and copyright law. By HAPPYSPROUTSTORE LLC.

# Actor input Schema

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

One per line. Accepts watch URLs, youtu.be links, Shorts, live and embed URLs, or bare 11-character video IDs.

## `channelOrPlaylistUrls` (type: `array`):

Optional. Channel (e.g. https://www.youtube.com/@handle) or playlist URLs. Each one is expanded to its newest videos, up to 'Max videos per channel/playlist'.

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

Upper limit of videos taken from each channel or playlist URL.

## `preferredLanguages` (type: `array`):

Language codes in order of preference, e.g. en, de, tr, pt-BR. Human-made captions are preferred over auto-generated ones in the same language.

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

If none of the preferred languages exist, return the original captions in whatever language the video has. If off, such videos return error 'language_not_available' (not charged).

## `translateToPreferredLanguage` (type: `boolean`):

If none of the preferred languages exist, use YouTube's machine translation into the first preferred language. Rows get isTranslated=true.

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

Add a 'segments' array of {start, duration, text} in seconds. Long videos produce large rows; switch off if you only need plain text.

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

Add an 'srt' field with a ready-to-save .srt subtitle file.

## `includeMetadata` (type: `boolean`):

Add title, channel, duration, publish date and view count. Costs one extra request per video; switch off for maximum speed.

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

How many videos are processed at the same time. Higher values are faster but trigger YouTube rate limits sooner.

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

When YouTube blocks a request (429, 'Sign in to confirm you're not a bot'), the video is retried on a new proxy IP with backoff, up to this many attempts.

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

YouTube blocks many datacenter IPs for transcripts. Automatic Apify Proxy works for small runs thanks to IP rotation; use the Residential group for large or frequent runs.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxVideos": 20,
  "preferredLanguages": [
    "en"
  ],
  "fallbackToAnyLanguage": true,
  "translateToPreferredLanguage": false,
  "includeSegments": true,
  "includeSrt": false,
  "includeMetadata": true,
  "maxConcurrency": 4,
  "maxRetries": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

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

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

```

## MCP server setup

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

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/Uvs93AR3C27RNI6OK/builds/lycigN4bXiz5y4YCX/openapi.json
