# YouTube Transcript Scraper — Captions with Timestamps (`datamule/youtube-transcript-scraper`) Actor

Get the transcript of public YouTube videos from URLs or IDs: timestamped segments, full text, SRT or VTT, any caption language. $0.0025 per delivered transcript, no start fee; videos without captions are never charged.

- **URL**: https://apify.com/datamule/youtube-transcript-scraper.md
- **Developed by:** [Datamule](https://apify.com/datamule) (community)
- **Categories:** Videos, AI
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.61 / 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

**$0.0023 per delivered transcript. No start fee.** Videos with no captions, private/unavailable videos and refused fetches are **not charged**.

Paste public YouTube video links or IDs and get each video's transcript as timestamped segments plus full text (or SRT / WebVTT), in the caption language you choose.

**Example input**

```json
{"videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"], "language": "en", "includeTimestamps": true, "outputFormat": "segmentsAndText"}
```

**Example output (one row per video)**

```json
{"videoId":"dQw4w9WgXcQ","title":"...","channel":"...","language":"en","isAutoGenerated":false,"languageFallback":false,"segmentCount":61,"text":"...","segments":[{"text":"...","start":18.64,"duration":3.2}]}
```

### Input

- `videoUrls` (1–100): watch, youtu.be, shorts, embed or live URLs, or 11-character IDs. Duplicates are merged.
- `language`: caption language code (`en`, `es`, `ko`…). Missing language → English/first track, flagged `languageFallback: true`. Manual captions are preferred over auto-generated.
- `includeTimestamps`, `outputFormat`: `segmentsAndText`, `textOnly`, `srt`, `vtt`.

### Output

One dataset row per delivered video: `videoId, videoUrl, title, channel, channelId, lengthSeconds, language, languageName, isAutoGenerated, languageFallback, segmentCount, text, segments | formatted, scrapedAt`. Per-video status (`delivered`, `no_captions`, `unavailable`, `blocked`, `invalid_input`) is in the `SUMMARY` record. One bad video never fails the others; the run fails only if zero transcripts were delivered.

### Pricing

Pay per event: one `result` event per delivered transcript row. Your max-charge setting is honored; the run stops cleanly when it is reached.

### Honest limits

- Public videos with captions only. No login, cookies, private, members-only or age-gated videos. No speech-to-text: if a video has no caption track there is no transcript.
- Uses YouTube's public player endpoint through an Apify datacenter proxy. YouTube sometimes refuses datacenter IPs, so the Actor retries on fresh proxy sessions (up to 12 per video). Measured in Apify cloud: 19 of 20 videos succeeded; a video that is still refused is reported as `blocked` and not charged — re-run it later.
- Unofficial; not affiliated with YouTube/Google. Automated access may conflict with YouTube's Terms of Service; you are responsible for lawful use of the content and respecting creators' rights.

# Actor input Schema

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

1–100 public YouTube video URLs (watch, youtu.be, shorts, embed, live) or 11-character video IDs.

## `language` (type: `string`):

Language code of the caption track you want, e.g. en, es, de, ko. If that language does not exist the English (or first available) track is returned and languageFallback is true.

## `includeTimestamps` (type: `boolean`):

Add start and duration (seconds) to each segment. Turn off for plain text only. SRT/VTT output always carries timestamps.

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

segmentsAndText: segment list plus full text. textOnly: full text only. srt / vtt: subtitle file text in the 'formatted' field plus full text.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "language": "en",
  "includeTimestamps": true,
  "outputFormat": "segmentsAndText"
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

## `summary` (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=dQw4w9WgXcQ"
    ],
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("datamule/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 = {
    "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "language": "en",
}

# Run the Actor and wait for it to finish
run = client.actor("datamule/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 '{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "language": "en"
}' |
apify call datamule/youtube-transcript-scraper --silent --output-dataset

```

## MCP server setup

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