# YouTube Transcript Scraper (`leanpilar/youtube-transcripts`) Actor

Transcripts from YouTube videos, Shorts, whole channels and playlists, with timestamps, SRT/VTT and AI-ready chunks. Watch channels for new videos on a schedule. Pay only for transcripts delivered.

- **URL**: https://apify.com/leanpilar/youtube-transcripts.md
- **Developed by:** [Lean Pilar](https://apify.com/leanpilar) (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 $2.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: videos, Shorts, channels and playlists

Get YouTube transcripts as clean JSON, plain text, SRT or WebVTT subtitles, or AI-ready
chunks with timestamp links. Paste video links, whole channels or playlists, pick your
languages, and schedule it to pick up new uploads automatically.
**You only pay for transcripts that are delivered.**

### What you get

For every video:

| Field | What it contains |
|---|---|
| `text` | The whole transcript as one string |
| `segments` | Each caption line with `start` and `duration` in seconds |
| `srt`, `vtt` | Ready-to-use subtitle files |
| `chunks` | Passages of up to ~1,500 characters, each with its start time and a link that opens the video at that moment. Made for ChatGPT, Claude, RAG and search tools |
| `language`, `isAutoGenerated` | Which transcript you got, and whether YouTube generated it |
| `availableLanguages` | Every transcript language the video has |
| Video details | Title, channel, duration, views, description, keywords, thumbnail (free) |

### Why this scraper

- **Pay per transcript, not per row.** Videos without captions, private or removed
  videos, and failed requests are listed with a clear reason and never charged.
- **Whole channels and playlists.** Paste `@handle`, a channel link or a playlist link.
  Choose videos, Shorts and live streams, and how many of the newest to take.
- **Watch channels for new videos.** Turn on *Only new videos* and schedule the actor daily.
  Each run returns only transcripts of uploads it has not delivered before, so you can feed
  a newsletter, a research database or an AI agent without duplicates.
- **The right language.** List your languages in order. Human-made captions are preferred
  over auto-generated ones, and if none match you get the language the video is spoken in
  (or skip it, free, if you prefer). Or get every language at once.
- **Reliable.** In our tests, 180 of 180 videos from 12 channels resolved without a single
  block, using residential proxies that are included in the price.
- **Every URL format.** watch links, youtu.be, Shorts, live, embed, mobile links and bare IDs.

### Pricing

| Event | Price |
|---|---|
| Transcript (one delivered transcript) | **$2.00 per 1,000** ($0.002 each) |

Proxy and platform usage are included. Records with status `noTranscript`, `unavailable`,
`noVideos` or `error` are free. Example: the newest 50 videos from 20 channels = 1,000
transcripts = $2.00.

### Input example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "@veritasium",
    "https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab"
  ],
  "languages": ["en"],
  "outputFormats": ["text", "segments", "chunks"],
  "maxVideosPerSource": 20
}
```

#### Monitor channels for new uploads

```json
{
  "urls": ["@veritasium", "@kurzgesagt"],
  "onlyNewVideos": true,
  "monitorName": "science-channels",
  "maxVideosPerSource": 10
}
```

Schedule this daily in Apify Console (Schedules). The first run delivers the 10 newest
videos per channel; later runs deliver only new ones. Use a different `monitorName` for
each schedule.

### Output example

```json
{
  "status": "ok",
  "videoId": "dQw4w9WgXcQ",
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)",
  "channelName": "Rick Astley",
  "durationSeconds": 213,
  "language": "en",
  "languageName": "English",
  "isAutoGenerated": false,
  "availableLanguages": [{"code": "en", "name": "English", "autoGenerated": false}],
  "wordCount": 487,
  "text": "We're no strangers to love You know the rules and so do I ...",
  "segments": [{"start": 18.64, "duration": 3.24, "text": "We're no strangers to love"}],
  "chunks": [{"index": 0, "start": 18.64, "end": 95.2, "text": "We're no strangers to love ...",
              "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=18s"}]
}
```

### Status values

| Status | Meaning | Charged |
|---|---|---|
| `ok` | Transcript delivered | Yes |
| `noTranscript` | The video has no captions, or none in your languages (see `availableLanguages`) | No |
| `unavailable` | Private, removed, age-restricted or members-only video | No |
| `noVideos` | The channel or playlist has no videos in the selected tabs | No |
| `error` | Bad input or YouTube kept blocking after several retries. Try again later | No |

### Good to know

- Transcripts come from YouTube's own captions. Videos without captions cannot be
  transcribed by this actor (very fresh uploads often get auto-captions within hours).
- Translation into other languages is not offered: YouTube blocks automated access to its
  translate feature. You get every language the creator uploaded plus the auto-generated one.
- Use the transcripts in line with YouTube's terms and copyright law.

### Other tools by the same author

- [Google Trends Scraper](https://apify.com/leanpilar/google-trends): interest over time,
  regions, related queries and trending searches.

# Actor input Schema

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

One per line. Video links (watch, youtu.be, Shorts, live), video IDs, channel links or @handles, and playlist links all work.

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

Language codes in order of preference, for example en, de, hr. Human-made captions are preferred over auto-generated ones. Leave empty to get the language the video is spoken in.

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

When off, videos without a transcript in your languages are returned as noTranscript and not charged.

## `allLanguages` (type: `boolean`):

Return one transcript per language the video has (filtered by Preferred languages if you set any). Each transcript is charged.

## `outputFormats` (type: `array`):

text: the whole transcript as one string. segments: lines with start time and duration in seconds. srt and vtt: subtitle files. chunks: passages of up to ~1,500 characters with start time and a link to that moment, ready for AI tools and search.

## `chunkMaxChars` (type: `integer`):

Maximum length of each chunk when the chunks format is selected.

## `maxVideosPerSource` (type: `integer`):

For channels, the newest videos come first.

## `channelTabs` (type: `array`):

Which channel tabs to read.

## `onlyNewVideos` (type: `boolean`):

Skip videos this monitor already delivered in earlier runs. Schedule the actor daily to get transcripts of new uploads only.

## `monitorName` (type: `string`):

Keeps separate memory of delivered videos per name, so different schedules do not affect each other.

## `includeVideoDetails` (type: `boolean`):

Title, channel, duration, views, description, keywords and thumbnail. Free.

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

How many videos to fetch at the same time.

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

YouTube blocks most datacenter IPs. Residential is the default and is included in the price.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "@veritasium",
    "https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2xVFitgF8hE_ab"
  ],
  "languages": [
    "en"
  ],
  "fallbackToAnyLanguage": true,
  "allLanguages": false,
  "outputFormats": [
    "text",
    "segments"
  ],
  "chunkMaxChars": 1500,
  "maxVideosPerSource": 20,
  "channelTabs": [
    "videos"
  ],
  "onlyNewVideos": false,
  "monitorName": "default",
  "includeVideoDetails": true,
  "maxConcurrency": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One record per video (or per language). Check status: ok (charged), noTranscript, unavailable, noVideos or error (free).

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

Counts of records by status and request statistics.

# 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"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leanpilar/youtube-transcripts").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"],
}

# Run the Actor and wait for it to finish
run = client.actor("leanpilar/youtube-transcripts").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"
  ]
}' |
apify call leanpilar/youtube-transcripts --silent --output-dataset

```

## MCP server setup

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

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/Ughs3aoRCsufd7YWA/builds/g3wXaeMgln1nG0feY/openapi.json
