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

Extract the full transcript (captions / subtitles) of any YouTube video as clean, ready-to-use text — with optional timestamps.

- **URL**: https://apify.com/santhej/youtube-transcript-scraper.md
- **Developed by:** [Santhej Kallada](https://apify.com/santhej) (community)
- **Categories:** Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$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/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTube Transcript Scraper — Captions & Subtitles to Text

Extract the full transcript (captions / subtitles) of any YouTube video as clean, ready-to-use text — with optional timestamps. Works with **manually-created** and **auto-generated** captions in **any language**. No API key, no login.

Perfect for feeding videos into LLMs/RAG, summarization, translation, content repurposing, SEO, and research at scale.

### Features

- Accepts **video URLs or IDs** — `watch`, `youtu.be`, `shorts`, and `embed` links all work.
- **Clean full-text transcript** plus rich metadata (title, channel, duration, views, language).
- Optional **timestamped segments** (`start`, `dur`, `text`) for subtitle/SRT-style use.
- Prefer **human captions** over auto-generated when both exist.
- **Bulk**: pass hundreds of videos in one run.
- **Residential proxy** support to avoid IP blocks.
- **Fair pricing — you only pay for transcripts actually returned.** Videos without captions are returned (so you know) but never charged.

### Input

| Field | Type | Description |
|---|---|---|
| `videos` | array | YouTube URLs or 11-char IDs, one per line. **Required.** |
| `language` | string | Preferred caption language code (`en`, `es`, `fr`…). Falls back to best available. |
| `preferManualCaptions` | boolean | Prefer human captions over auto-generated. Default `true`. |
| `includeTimestamps` | boolean | Also output a `segments` array per video. Default `false`. |
| `proxyConfiguration` | object | Residential proxy recommended. |

#### Example input

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtu.be/9bZkp7q19f0"
  ],
  "language": "en",
  "preferManualCaptions": true,
  "includeTimestamps": false
}
```

### Output

One record per video:

```json
{
  "video_id": "dQw4w9WgXcQ",
  "video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "title": "…",
  "channel": "…",
  "duration_seconds": 213,
  "view_count": 1600000000,
  "language": "en",
  "is_auto_generated": false,
  "has_transcript": true,
  "word_count": 410,
  "transcript_text": "We're no strangers to love …"
}
```

With `includeTimestamps: true`, each record also includes:

```json
"segments": [{ "start": 18.2, "dur": 3.4, "text": "We're no strangers to love" }]
```

### Pricing

Pay-per-event: a tiny start fee plus a flat fee **per transcript returned**. Videos with no captions are not charged.

### Notes

- Some videos genuinely have **no captions** — those come back with `has_transcript: false` and a reason in `error`.
- Age-restricted or region-locked videos may be unavailable; the reason is reported per video.

# Actor input Schema

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

YouTube video URLs or 11-character video IDs, one per line. Supports watch, youtu.be, shorts and embed URLs.

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

Preferred caption language code (e.g. en, es, fr, de). Falls back to the best available track if not found.

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

Prefer manually-created captions over auto-generated ones when both are available.

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

Also include a 'segments' array (start time, duration, text) for each caption line.

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

Residential proxy is recommended to avoid YouTube IP blocks.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "language": "en",
  "preferManualCaptions": true,
  "includeTimestamps": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

One record per video with transcript text and metadata.

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

Counts of videos processed and transcripts returned.

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

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

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

```

## MCP server setup

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