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

Get YouTube transcripts and subtitles as clean text, timestamped segments or SRT. Videos, whole channels and playlists. Manual or auto-generated captions, any language, optional translation. Ready for LLMs and RAG. No login, no API key.

- **URL**: https://apify.com/uber\_byte/youtube-transcript-scraper.md
- **Developed by:** [Marlon Lee](https://apify.com/uber_byte) (community)
- **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?

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

Get the transcript (captions or subtitles) of any public YouTube video as plain text, timestamped segments or an SRT file. Paste video links, or a channel or playlist link to pull YouTube transcripts for many videos at once, ready for ChatGPT, Claude and other LLMs, RAG pipelines, summarizers and search indexes. No YouTube account, login or API key needed.

### What you get

One dataset row per video with:

- **Video metadata:** video ID, URL, title, channel, channel ID, duration, view count, publish date
- **Transcript:** the full text, plus timestamped segments (`start` and `duration` in seconds) or an SRT subtitle string, depending on the output format
- **Language info:** transcript language code and name, original caption language, auto-generated flag, translated flag, and every caption track the video offers

Inputs and options:

- **Videos, channels and playlists:** watch URLs, `youtu.be` links, Shorts, live and embed URLs, or bare 11-character video IDs. Channel links (`@handle`, `/channel/UC...`, `/c/...`, `/user/...`) and playlist links expand into their videos, up to a limit you set.
- **Preferred languages:** a list such as `en`, `de`, `es`. `en` also matches `en-GB` and `en-US`. Human-made captions win over auto-generated ones. If none of your languages exist, you get the auto-generated track in the video's spoken language (or the first available track) instead of an empty result.
- **Caption type:** any, human-made only, or auto-generated only.
- **Translation:** give a target language and get YouTube's own machine translation of the captions.
- **Output format:** text plus segments, text only (smallest, best for LLMs), or text plus SRT.

### Use cases

- **LLM and RAG pipelines:** feed video transcripts into summarizers, chatbots and vector databases.
- **Content research:** search and analyse what a channel has said across hundreds of videos.
- **SEO and repurposing:** turn videos into blog posts, show notes and social posts.
- **Subtitles:** download SRT files for editing or translation.
- **Academic and media monitoring:** build text datasets from lectures, talks and news channels.

### How to use

1. Open the Actor in Apify Console and paste video, channel or playlist URLs.
2. Set **Max videos per channel/playlist** and your preferred languages.
3. Pick the caption type, output format and, if you want, a translation language.
4. Keep the residential proxy default and click **Start**.
5. Download the results as JSON, CSV, Excel or HTML, or read them through the Apify API.

| Field | Description |
|---|---|
| `urls` | Video URLs or IDs, channel URLs, playlist URLs. Required. |
| `maxVideos` | Max videos taken from each channel or playlist (default 50). Channels are read newest first. |
| `languages` | Preferred language codes in order, default `["en"]`. |
| `captionType` | `any` (default, human-made preferred), `manual`, or `auto`. |
| `translateTo` | Optional language code for YouTube's machine translation. If a video doesn't offer it, you get the original language and `isTranslated` is `false`. |
| `outputFormat` | `segments` (default), `text`, or `srt`. |
| `maxRetries` | Retries per video on a fresh IP when blocked (default 6). |
| `proxyConfiguration` | Defaults to Apify residential proxy. YouTube blocks most datacenter proxies. |

### Input example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=arj7oStGLkU",
    "https://www.youtube.com/@TED"
  ],
  "maxVideos": 20,
  "languages": ["en"],
  "outputFormat": "text"
}
```

### Output example

```json
{
  "videoId": "jNQXAC9IVRw",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "title": "Me at the zoo",
  "channel": "jawed",
  "channelId": "UC4QobU6STFB0P71PMvOGN5A",
  "durationSeconds": 19,
  "viewCount": 438283667,
  "publishDate": "2005-04-23T20:31:52-07:00",
  "language": "en",
  "languageName": "English",
  "originalLanguage": "en",
  "isAutoGenerated": false,
  "isTranslated": false,
  "availableLanguages": [{ "code": "en", "isAutoGenerated": false }, { "code": "de", "isAutoGenerated": false }],
  "text": "All right, so here we are, in front of the elephants the cool thing about these guys is that they have really... really really long trunks ...",
  "segments": [
    { "start": 1.2, "duration": 2.16, "text": "All right, so here we are, in front of the elephants" },
    { "start": 5.318, "duration": 2.656, "text": "the cool thing about these guys is that they have really..." }
  ]
}
```

With `outputFormat: "srt"` you get an `srt` string instead of `segments`. With `"text"` you get only `text`. `publishDate` is best effort and can be `null`.

A video without a transcript:

```json
{
  "videoId": "oNTaHYXQ4MM",
  "url": "https://www.youtube.com/watch?v=oNTaHYXQ4MM",
  "title": "Humans Can Regrow an Organ",
  "channel": "Kurzgesagt – In a Nutshell",
  "errorCode": "NO_TRANSCRIPT",
  "error": "No captions/transcripts are available for this video."
}
```

Error codes: `NO_TRANSCRIPT`, `VIDEO_UNAVAILABLE`, `AGE_RESTRICTED`, `LOGIN_REQUIRED` (private or members-only), `BLOCKED` (YouTube kept blocking after all retries), `FAILED` (another error after all retries).

### Pricing

This Actor uses pay-per-result pricing: you pay only for rows that contain a transcript. Videos without captions, and private, deleted, age-restricted or blocked videos, still appear in the dataset with an `error` field so you can see what happened, and they're free. Set a maximum spend per run and the Actor stops cleanly when it reaches it.

### FAQ

**Is it legal to scrape YouTube transcripts?** The Actor only reads publicly available captions. Check YouTube's terms and the laws that apply to you, and respect the copyright of the creators.

**Do I need a YouTube API key?** No.

**Why residential proxy, and will I get blocked?** YouTube blocks scraping from datacenter IPs, the main reason transcript scrapers fail. This Actor defaults to Apify residential proxy. It uses the same method as the open-source [youtube-transcript-api](https://github.com/jdepoix/youtube-transcript-api) Python library (YouTube's internal player API with the Android client), which doesn't need a PO token for captions today. It detects blocks (HTTP 429, CAPTCHA pages, "confirm you're not a bot") and retries on a fresh IP, up to 6 times by default. It treats "this video has no transcript" as final, without retries or charges.

**Can I use this to feed an LLM?** Yes. Use `outputFormat: "text"` for the most compact output, or `segments` when you need timestamps for citations or chapter links.

**What if YouTube changes something?** YouTube changes its internals often, and runs may fail until the Actor is updated. The Actor always reports failed videos in the dataset and never drops them silently.

**What are the limits?**

- Public videos only. The Actor never logs in, so it can't read private, members-only or age-restricted videos.
- A transcript exists only if the uploader added captions or YouTube generated them. Some videos (music, very new or very short uploads) have none.
- Translations are YouTube's machine translations, not human ones.
- Channel expansion reads the channel's uploads list, which includes Shorts and past live streams.

# Actor input Schema

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

YouTube video URLs or 11-character video IDs (watch, youtu.be, shorts, live, embed). Channel URLs (@handle, /channel/UC...) and playlist URLs are expanded into their videos.

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

How many videos to take from each channel or playlist (newest first for channels). Individual video URLs are always processed.

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

Language codes in order of preference, e.g. en, de, es. 'en' also matches en-GB etc. If none is available, the video's original (auto-generated) language is returned.

## `captionType` (type: `string`):

Caption type.

## `translateTo` (type: `string`):

Optional language code (e.g. en, de, fr). Uses YouTube's own machine translation of the captions. If YouTube doesn't offer it for a video, the original language is returned.

## `outputFormat` (type: `string`):

Output format.

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

Retries with a fresh proxy IP when YouTube blocks a request.

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

YouTube blocks most datacenter IPs. Residential proxy is strongly recommended.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxVideos": 50,
  "languages": [
    "en"
  ],
  "captionType": "any",
  "outputFormat": "segments",
  "maxRetries": 6,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

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

// Run the Actor and wait for it to finish
const run = await client.actor("uber_byte/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"],
    "languages": ["en"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("uber_byte/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"
  ],
  "languages": [
    "en"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call uber_byte/youtube-transcript-scraper --silent --output-dataset

```

## MCP server setup

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