# YouTube Transcript Scraper: captions with timestamps (`leadharbor/youtube-transcripts`) Actor

YouTube captions and subtitles as full text plus timed segments, from video links or ids, a channel's latest videos or a playlist's latest videos. Picks your language, prefers manual captions, optional chunks for AI retrieval. Videos without captions are free. Not affiliated with YouTube or Google.

- **URL**: https://apify.com/leadharbor/youtube-transcripts.md
- **Developed by:** [Mohammed Samaan](https://apify.com/leadharbor) (community)
- **Categories:** AI, Videos, Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.30 / 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.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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: captions with timestamps

Get the public captions and subtitles of YouTube videos as full text plus timed lines. Give it video links or ids, a channel, or a playlist. It picks the language you ask for, prefers captions written by a person over automatic ones, and can cut the text into pieces for AI and search tools. Videos without captions cost nothing. This actor is not affiliated with or endorsed by YouTube or Google.

It reads only what a logged-out viewer can see: no login, no cookies, no browser, no video or audio download.

### What you get

For each video that has captions: title, channel, length, the language of the caption that was read, whether YouTube generated it automatically, the whole transcript as one text, and the caption lines with start time and duration. Optionally the text is also cut into chunks of a size you choose.

| Field | Meaning |
|---|---|
| `rowType` | `transcript` for a delivered transcript, `error` for a free error row |
| `videoId`, `url` | The 11 character video id and the link to the video |
| `title`, `channelName`, `channelId` | From YouTube's answer for that video (`channelId` and others are `null` when YouTube did not give them) |
| `lengthSeconds` | Video length in seconds |
| `language` | Language code of the caption that was read (`en`, `de`, `pt-BR` ...) |
| `isAutoGenerated` | `true` if YouTube generated the caption automatically, `false` if a person wrote or uploaded it |
| `text` | The whole caption as one text, lines joined by a space |
| `segments` | List of `{ start, duration, text }`, seconds. Left out when Include timed segments is off |
| `segmentCount` | Number of caption lines |
| `chunks` | Only when Chunk size is above 0: list of `{ index, start, text, approxTokens }` |
| `rowTrimmed` | Only present, as `true`, when the row would have been over 8,500,000 bytes (UTF-8, as JSON), or could not be saved with them: `segments` and `chunks` were left out; `text` and `segmentCount` are still there |
| `source` | `video`, or `channel:<your entry>` / `playlist:<your entry>` |
| `scrapedAt` | When the row was read |
| `input`, `errorKind`, `error` | Error rows only: what failed and why |

It does not return view counts, likes, comments, descriptions or thumbnails, and it does not return subtitle files (SRT, VTT). It returns the caption lines as data.

### Example

Input:

```json
{
  "videos": ["https://www.youtube.com/watch?v=jNQXAC9IVRw", "VgOm8nqPlD4"],
  "languages": ["en"],
  "maxVideos": 3,
  "chunkTokens": 0
}
```

Output (shape of one row; the text is shortened):

```json
{
  "rowType": "transcript",
  "videoId": "jNQXAC9IVRw",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "title": "Me at the zoo",
  "channelName": "jawed",
  "channelId": "UC4QobU6STFB0P71PMvOGN5A",
  "lengthSeconds": 19,
  "language": "en",
  "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... ...",
  "segments": [
    { "start": 1.2, "duration": 2.16, "text": "All right, so here we are, in front of the elephants" }
  ],
  "segmentCount": 6,
  "source": "video",
  "scrapedAt": "2026-11-21T12:00:00.000Z"
}
```

### How to use it

**Apify Console:** open the actor, paste video links into Videos (or channels into Channels, playlists into Playlists), set Max videos, and click Start. Results appear in the Transcripts table; download them as JSON, CSV or Excel.

**API (JavaScript client):**

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('leadharbor/youtube-transcripts').call({
  videos: ['https://www.youtube.com/watch?v=jNQXAC9IVRw'],
  languages: ['en'],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].text);
```

**Python client:**

```python
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
run = client.actor("leadharbor/youtube-transcripts").call(run_input={
    "videos": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "languages": ["en"],
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["videoId"], item["language"], item["segmentCount"])
```

Use your own Apify token in place of the placeholder. To cap what one run can cost, set a maximum charge for the run in the Console run options or in the client call.

### Input

| Field | Meaning |
|---|---|
| `videos` | Video links or 11 character ids: `watch?v=`, `youtu.be/`, `shorts/`, `embed/`, `live/`. Only youtube.com, www.youtube.com, m.youtube.com and youtu.be are accepted |
| `channels` | Channel links (`youtube.com/@name`, `youtube.com/channel/UC...`), `@handle`s or channel ids. Reads the channel's latest videos, see the limits below |
| `playlists` | Playlist links or ids (`PL...`). Reads the playlist's latest videos, see the limits below |
| `maxVideos` | Most videos read in one run, 1 to 5000, default 50, counted over all three fields together |
| `maxVideoMinutes` | Videos longer than this many minutes are not read: a free `too_long` row, no charge. 1 to 180, default 180 |
| `languages` | Caption languages in order of preference, default `["en"]`. `en` also matches `en-US` |
| `fallbackToAnyLanguage` | On (default): if none of your languages exists, take another language: with `preferManualCaptions` on, the first manual caption (or the first listed one if there is no manual caption); with it off, the first caption YouTube lists. Off: that video returns a free `language_unavailable` row |
| `preferManualCaptions` | On (default): inside one language, the first manual caption (written by a person) is used, or the first listed one if there is no manual caption. Off: the first caption YouTube lists for that language is used, manual or not |
| `chunkTokens` | 0 = off. Otherwise 50 to 8000: adds `chunks` of about that many tokens, cut on word boundaries |
| `includeSegments` | On (default): include `segments`. Off: smaller rows |

The order of languages wins over caption quality: with `["en","de"]` an automatic English caption is used before a manual German one.

`chunkTokens` is an estimate (one word is counted as 1.3 tokens). It is not a count from any model's tokenizer, so leave some room under your model's limit.

Entries that are not valid (another website, `localhost`, an IP address, a file link, a broken id) are not fetched; each gets a free `invalid_input` row.

### Why this one

- You are not charged for videos without captions, blocked or private videos, videos over your length limit, or invalid input entries; each of these is a free error row that tells you why.
- Blocked, rate-limited and empty answers are retried up to 2 times, each on a new residential proxy session.
- One actor takes video links or ids, channels, `@handle`s and playlists.
- Optional `chunks` with start times for retrieval tools.
- `language` and `isAutoGenerated` on every row, and a choice of language order with or without fallback.

What it does not do, compared with some other transcript actors: no view counts, likes, description, publish date or thumbnail; no SRT or XML output (the caption lines come as data); and channel and playlist inputs read only the latest ~15 videos.

### Use cases

- **AI and retrieval (RAG):** turn videos into text with timestamps; use `chunks` to feed a vector store, and `start` to link back to the moment in the video.
- **Summaries and notes:** pass `text` to your own summarizer or LLM.
- **Subtitles and captions work:** `segments` gives each line with start and duration, ready to convert into your subtitle format.
- **Research and monitoring:** collect what a channel's recent videos say, search quotes across videos, compare topics between channels.
- **Datasets:** build a text corpus from public captions you are allowed to use.

### Price

Pay per event, one event named `transcript` per video that returned at least one caption line. There is no start fee. Prices by Apify plan:

| Apify plan | Price per 1,000 transcripts | Per transcript |
|---|---|---|
| Free | $3.00 | $0.0030 |
| Starter (Bronze) | $2.50 | $0.0025 |
| Scale and above (Silver, Gold, Platinum, Diamond) | $2.30 | $0.0023 |

Not charged: error rows, videos without captions, private or removed videos, videos still blocked after retries, videos over `maxVideoMinutes` (`too_long`), rows too large to store (`too_large`), videos already delivered earlier in the same run, videos not read because of the maximum charge or the time budget, and invalid input entries. If you set a maximum charge for the run, the run stops cleanly when it is reached; the videos it did not read are not charged. There is no separate platform-usage charge for this actor.

### Limits

- **Some videos have no captions.** In our own test of 500 videos from search results, about 1 in 5 had none (our measurement, not a promise for your list); Shorts had more. Those return a free `no_captions` row.
- **Automatic captions are lower quality** than captions written by a person: wrong words, no punctuation, names misspelled. `isAutoGenerated` tells you which one you got.
- **Channels and playlists give only the latest videos.** The actor reads YouTube's public feed, which lists about 15 videos. It cannot list a whole channel archive or a long playlist. To read older videos, put their links in Videos.
- **`@handle` links need one extra page read** to find the channel id. If that fails you get a free `channel_not_found` row; use the channel id (`UC...`) instead. `/c/` and `/user/` links are not supported.
- **Caption links:** if YouTube answers a caption link with 404, the actor asks again once for a new link before giving up; other failures give a `request_failed` row that names the step (player or captions).
- **YouTube may block requests.** The actor uses Apify's residential proxy, starts a new session every 10 videos and on every retry, and retries a blocked, rate-limited or empty answer up to 2 times. If a video is still blocked, you get a free `blocked` row and no charge. Videos that need a sign-in (age limit) give a free `age_or_login_required` row.
- **Videos run one after another** with a short pause, not in parallel. Set a run timeout of at least 5 minutes (shorter timeouts skip every video with a free `skipped_time_budget` row), and for large lists one that fits the list; when the time is used up, unread videos get a free `skipped_time_budget` row and you can run them again.
- **Live streams and premieres** that have no caption yet return a free error row.
- **Long videos are capped.** Videos longer than `maxVideoMinutes` (at most 180 minutes, the default) are not read and are free (`too_long`), because the proxy cost of reading a video grows with the length of its transcript.
- **Large rows.** A long transcript is kept up to three times if you ask for text, segments and chunks. A row over 8,500,000 bytes (counted in UTF-8, so Hindi, Japanese and similar text takes more room than its character count) has `segments` and `chunks` left out (`rowTrimmed: true`); if the text alone is still too large, the video returns a free `too_large` row and is not charged. Turn off `includeSegments` to shrink rows.
- **Maximum charge:** when the run's maximum charge is reached the run stops, and every video it did not read gets a free `skipped_charge_limit` row.
- **If saving a row fails** after the transcript event was charged, the actor first tries once more without `segments` and `chunks`. If that fails too, the run carries on and writes a `push_failed` row saying so: the event may already have been charged, so contact us with the run id. `SUMMARY.pushFailed` counts these.
- **Restarts:** if a run restarts, videos already in the dataset are not delivered or charged again.
- Respect the terms of the platform and the rights of the video owners for the text you collect; you are responsible for how you use it.

### Integrations and API

Run it from the Apify Console, the Apify API or the Apify clients for JavaScript and Python. Put it on an Apify schedule and connect a webhook or an integration (Make, Zapier, n8n, Google Sheets, Slack) to send each run's results on. Read the rows from the run's default dataset (`.../datasets/<id>/items`); the run summary (videos queued, delivered, without captions, retries, charged events) is in the key-value store record `SUMMARY`.

### FAQ

**Is it official?** No. It is an independent tool and is not affiliated with or endorsed by YouTube or Google.

**Do I pay for videos without captions?** No. Only a video that returned at least one caption line is charged.

**How do I get a channel's whole back catalogue?** You cannot with this actor; channel and playlist inputs give the latest videos only (about 15). Pass the video links yourself for older ones.

**Which language do I get?** The first of your `languages` that the video has. If none exists, with fallback on you get the video's own language (see the `language` field), and with fallback off a free error row.

**Can I get subtitles in a translated language?** No. It returns caption tracks that exist on the video; it does not translate.

**Why did a video return `blocked`?** YouTube refused or returned nothing, also after retries on new sessions. Run that video again later.

**Do I need a proxy or a login?** No. The actor handles its own proxy; you do not need an account on YouTube.

# Actor input Schema

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

Video links or 11 character video ids, one per entry: youtube.com/watch?v=..., youtu.be/..., youtube.com/shorts/..., or just the id. Only youtube.com, www.youtube.com, m.youtube.com and youtu.be links are accepted; anything else gets a free error row. The same video twice is read once.

## `channels` (type: `array`):

Channel links (youtube.com/@name or youtube.com/channel/UC...), @handles or channel ids (UC followed by 22 characters). Reads the channel's public feed, which lists only its latest videos (about 15, not the whole channel). /c/ and /user/ links are not supported. Videos found here count towards Max videos.

## `playlists` (type: `array`):

Playlist links (with list=...) or playlist ids (PL...). Reads the playlist's public feed, which lists only its latest videos (about 15, not the whole playlist). Videos found here count towards Max videos.

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

Upper limit of videos read in this run, counted over videos, channels and playlists together, 1 to 5000. Videos without captions are free but still count here.

## `maxVideoMinutes` (type: `integer`):

Videos longer than this are not read: they return a free too_long row (the message names the video's length) and are not charged. 1 to 180, default 180. Longer videos are never read, because the proxy cost of reading a video grows with the length of its transcript.

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

Caption language codes in order of preference, for example en, de, pt-BR. A code such as en also matches en-US. The first language that has a caption wins, even if a later language has a manual caption.

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

On: if none of your preferred languages has a caption, take another language: with Prefer manual captions on, the video's first manual caption (or, if it has none, its first caption); with Prefer manual captions off, the first caption YouTube lists. The language field says which. Off: such a video returns a free error row (language_unavailable).

## `preferManualCaptions` (type: `boolean`):

On: within one language, the first manual caption (written by a person) is used, or the first listed one if there is no manual caption (isAutoGenerated tells which you got). Off: the first caption YouTube lists for that language is used, manual or not.

## `chunkTokens` (type: `integer`):

0 = no chunks. Otherwise adds a chunks field: the text cut into pieces of about this many tokens, on word boundaries, each with its start time. The size is an estimate (1 word = 1.3 tokens), not a count from any model's tokenizer. 50 to 8000.

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

On: every row has segments, the caption lines with start second and duration. Off: only the full text (and chunks if asked) is returned, which makes rows smaller. segmentCount is always given.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "VgOm8nqPlD4",
    "ACCnhY1fKoI"
  ],
  "channels": [],
  "playlists": [],
  "maxVideos": 3,
  "maxVideoMinutes": 180,
  "languages": [
    "en"
  ],
  "fallbackToAnyLanguage": true,
  "preferManualCaptions": true,
  "chunkTokens": 0,
  "includeSegments": true
}
```

# Actor output Schema

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

Table of the delivered transcripts and any error rows.

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

Counts: videos queued, transcripts delivered, videos without captions, error rows, retries and charged events.

# 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=jNQXAC9IVRw",
        "VgOm8nqPlD4",
        "ACCnhY1fKoI"
    ],
    "channels": [],
    "playlists": [],
    "maxVideos": 3,
    "languages": [
        "en"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leadharbor/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 = {
    "videos": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw",
        "VgOm8nqPlD4",
        "ACCnhY1fKoI",
    ],
    "channels": [],
    "playlists": [],
    "maxVideos": 3,
    "languages": ["en"],
}

# Run the Actor and wait for it to finish
run = client.actor("leadharbor/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 '{
  "videos": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "VgOm8nqPlD4",
    "ACCnhY1fKoI"
  ],
  "channels": [],
  "playlists": [],
  "maxVideos": 3,
  "languages": [
    "en"
  ]
}' |
apify call leadharbor/youtube-transcripts --silent --output-dataset

```

## MCP server setup

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