# YouTube Transcript Scraper — subtitles & captions to text (`x402opklaar/youtube-transcript-scraper`) Actor

Video URLs or IDs in, full transcripts out: plain text plus timestamped segments, language selection, auto-generated and manual captions. Videos without transcripts are reported and never charged.

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

## Pricing

$5.00 / 1,000 transcript fetcheds

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 — subtitles & captions to text

Video URLs (or bare IDs) in, complete transcripts out — as clean plain text, readable paragraphs, **SRT**, **WebVTT**, or timestamped JSON. Manual subtitles and auto-generated captions both supported, with language preference, optional translation, and video metadata.

- **Five output formats in one call**: plain `text`, readable `paragraphs`, `srt`, `vtt`, and timestamped `segments` — all built from the same fetch, one charge
- **Any URL form**: `watch?v=`, `youtu.be/`, `/shorts/`, `/embed/`, `/live/`, or a bare 11-character ID
- **Language control**: pass preference order (`en`, `de`, …); falls back to the first available transcript so you still get text
- **Translation**: set `translateTo` (e.g. `en`) to get the transcript in your target language when the source supports it
- **Video metadata**: title, channel, and thumbnail included by default (public oEmbed, no key)
- **Block-resistant**: automatic residential-proxy retry when YouTube rate-limits datacenter IPs
- **Honest pricing**: you pay only when a transcript is actually delivered. No captions, private/removed videos, or blocks → reported clearly, **never charged**

### Input

```json
{
    "videoUrls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "languages": ["en"],
    "outputFormats": ["text", "srt"],
    "translateTo": "",
    "includeMetadata": true,
    "useApifyProxy": true
}
```

### Output (one dataset item per video)

```json
{
    "video_id": "jNQXAC9IVRw",
    "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "title": "Me at the zoo",
    "channel": "jawed",
    "thumbnail": "https://i.ytimg.com/vi/jNQXAC9IVRw/hqdefault.jpg",
    "language": "English",
    "language_code": "en",
    "auto_generated": false,
    "translated": false,
    "text": "All right, so here we are in front of the elephants…",
    "srt": "1\n00:00:00,000 --> 00:00:03,200\nAll right, so here we are…\n",
    "word_count": 4213,
    "segment_count": 512,
    "duration_covered_s": 1180.4
}
```

Only the formats you request appear (plus always `text`'s `word_count`/`segment_count`).

### Pricing

One event: `transcript-fetched` — charged **only for videos where you actually received a transcript**, regardless of how many formats you ask for. Everything else (no captions, video unavailable, temporary block) is free and reported with a clear `error` field.

### Typical uses

- **LLM pipelines**: summarize, chapterize, or answer questions over video content
- **Subtitle files**: export ready-to-use `.srt` / `.vtt` for editing or upload
- **Content research**: bulk-pull transcripts of a channel's videos for topic mining
- **Accessibility & SEO**: publish text versions of video content
- **Clip discovery**: `segments` output + keyword search over `start` times

### Works with AI agents

Exposed via Apify's MCP server — agents can call *"get the transcript of this video and summarize the key claims"* as a single tool step.

### FAQ

**Does it handle auto-generated captions?** Yes — flagged as `auto_generated: true` so you know the quality tier.

**Can it translate?** Yes — set `translateTo` to a language code. When the source transcript is translatable, the result comes back translated (flagged `translated: true`). If not, you get the original with its language reported.

**Which format should I use?** `text` for LLMs, `paragraphs` for reading/publishing, `srt`/`vtt` for subtitle files, `segments` for timestamp-precise clip search.

**Bulk?** Pass as many URLs as you want; each video is one dataset row, failures never charged.

# Actor input Schema

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

YouTube video URLs (watch, youtu.be, shorts, embed, live) or bare 11-character video IDs.

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

Language codes in order of preference (e.g. en, de, es). If none match, the first available transcript is used.

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

Which representations to include per video. Every format is built from the same transcript in a single charge.

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

Target language code (e.g. en, es, fr). When set and the source transcript is translatable, the transcript is returned in this language.

## `includeMetadata` (type: `boolean`):

Add video title, channel name and thumbnail (fetched from YouTube's public oEmbed endpoint).

## `useApifyProxy` (type: `boolean`):

Route requests through Apify residential proxies. Turn on if runs report IP blocks.

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

Deprecated — use "Timestamped segments (JSON)" in Output formats instead. Kept for backward compatibility.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "languages": [
    "en"
  ],
  "outputFormats": [
    "text"
  ],
  "includeMetadata": true,
  "useApifyProxy": true,
  "includeSegments": false
}
```

# 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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    ],
    "languages": [
        "en"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("x402opklaar/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=jNQXAC9IVRw"],
    "languages": ["en"],
}

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

```

## MCP server setup

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