# YouTube Transcript Scraper - Text, Timestamps & SRT (`admirala/youtube-transcript-scraper`) Actor

YouTube transcript API: get the captions of any video as clean text, timestamped segments and an SRT file. Bulk URLs or video IDs, language choice, auto-translate. $0.0049 per transcript.

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

## Pricing

from $4.20 / 1,000 per 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 - Text, Timestamps & SRT

> ✅ **Tested daily** with its default input (Apify's automated QA plus our own smoke test before every release).

**YouTube transcript scraper**: turn YouTube videos into text. This Actor reads the captions a video already has on YouTube (uploaded by the creator or auto-generated) and returns them as one clean block of text, a list of timestamped segments and a ready-to-use SRT subtitle file. $0.0049 per transcript, failed videos are free.

Fast and lightweight: no video or audio is downloaded, so a transcript usually arrives within a few seconds.

### Features

- **Bulk input**: any mix of `watch?v=`, `youtu.be/`, `shorts/`, `embed/`, `live/` URLs or bare 11-character video IDs
- **Language choice**: give one code (`en`) or a preference list (`de,en`); creator-made captions win over auto-generated ones
- **Fallback**: optionally return whatever language is available instead of failing
- **Translation**: request a target language and get YouTube's own caption translation
- **Metadata**: language, whether captions are auto-generated, all available caption languages, duration covered, segment count

### Input

| Field | Default | Description |
|---|---|---|
| `videos` | – | Video URLs or IDs |
| `language` | `en` | Preferred language code(s), comma-separated |
| `anyLanguageFallback` | true | Use any available language if the preferred one is missing |
| `translateTo` | – | Optional target language for translation |
| `includeSegments` | true | Add `segments` with `start`/`end` in seconds |
| `includeSrt` | true | Add `srt` subtitle text |

### Output (one item per video)

```json
{
  "videoId": "jNQXAC9IVRw",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "language": "en", "isAutoGenerated": false,
  "availableLanguages": ["de", "en"],
  "durationSecs": 18.881, "segmentCount": 6,
  "text": "All right, so here we are, in front of the elephants ...",
  "segments": [{"start": <seconds>, "end": <seconds>, "text": "..."}],
  "srt": "1\n<hh:mm:ss,ms> --> <hh:mm:ss,ms>\n...\n"
}
```

Videos without captions (or with captions disabled) return an `error` field and are **not charged**.

### Use cases

Summarising or translating videos with an LLM, building search indexes or RAG datasets over your own or public video libraries, creating subtitles, quoting talks and lectures, content research.

### Pricing (pay per event)

- **$0.0049 per transcript** delivered. Failed videos cost nothing.

### Notes

Only the videos you supply are processed. The Actor reads caption tracks only; it does not collect comments, channel data or any personal information.

### Use with AI agents (MCP)

This Actor can be used as a tool by AI agents (Claude, Cursor, VS Code, other MCP clients) through the official [Apify MCP server](https://docs.apify.com/platform/integrations/mcp):

- Add only this Actor as a tool: `https://mcp.apify.com?tools=admirala/youtube-transcript-scraper` (sign in with OAuth or an Apify API token).
- Or connect `https://mcp.apify.com` and let the agent find it with `search-actors` (e.g. "youtube transcript"), read the input schema with `fetch-actor-details` and run it with `call-actor`.

Example input an agent can pass:

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "language": "en"
}
```

Cost per call: $0.0049 per transcript delivered; videos without captions are not charged. Results come back as dataset items (`get-dataset-items`).

### FAQ

**How do I download a YouTube transcript as text or SRT?**
Put the video URL or 11-character ID in `videos`. Each result contains `text`, `segments` with start/end seconds and an `srt` string you can save as a .srt file.

**Can I get YouTube subtitles in another language?**
Yes: set `language` to a preference list like `de,en`, or set `translateTo` to use YouTube's own caption translation.

**What if a video has no captions?**
You get an `error` field for that video and it is not charged.

**Can I scrape transcripts of many videos at once?**
Yes, `videos` takes any number of URLs or IDs (watch, youtu.be, shorts, embed, live).

### Related actors

- [YouTube Transcript & Audio to Text (Whisper) - SRT/VTT](https://apify.com/admirala/audio-to-subtitles)
- Podcast Transcription - RSS Feed to Text, SRT & VTT (coming soon to Apify Store)
- RSS Feed Reader - RSS & Atom to JSON (bulk, auto-discovery) (coming soon to Apify Store)

### More examples

Ready-to-run Python, curl and MCP examples with real sample output: https://github.com/AdmiraalA/apify-scrapers-examples

# Actor input Schema

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

YouTube video URLs (watch, youtu.be, shorts, embed, live) or bare 11-character video IDs. One transcript per video, $0.0049 each. Example: \["https://www.youtube.com/watch?v=jNQXAC9IVRw", "dQw4w9WgXcQ"].

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

Preferred caption language as ISO code, or a comma-separated preference list, e.g. 'en' or 'de,en'. Creator-made captions are preferred over auto-generated ones.

## `anyLanguageFallback` (type: `boolean`):

true = if none of the preferred languages exist, return the first available caption track instead of an error.

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

Optional ISO code (e.g. 'es'). Uses YouTube's own caption translation when the video allows it. Leave empty for no translation.

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

true = add `segments`: a list of {start, end, text} with times in seconds.

## `includeSrt` (type: `boolean`):

true = add `srt`: the full transcript as SRT subtitle file content.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "language": "en",
  "anyLanguageFallback": true,
  "includeSegments": true,
  "includeSrt": true
}
```

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

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

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

```

## MCP server setup

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