# YouTube Transcript Scraper: Text + Timestamps (`withgrokbot/youtube-transcript`) Actor

Download YouTube transcripts (captions/subtitles) from videos, Shorts and playlists as plain text plus timestamped segments for LLMs, summaries and search. Choose language and manual vs auto captions. Pay only per transcript delivered.

- **URL**: https://apify.com/withgrokbot/youtube-transcript.md
- **Developed by:** [402xAgent](https://apify.com/withgrokbot) (community)
- **Categories:** AI, Videos, Social media
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.50 / 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.

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 and subtitles with timestamps

Get the transcript (captions) of any public YouTube video, Short or playlist as **plain text** and **timestamped segments**, ready for LLMs, search, summaries and subtitles.

### Features

- Input: watch / youtu.be / Shorts / live URLs, playlist URLs, or bare IDs. Playlists are expanded automatically (with retries).
- Choose a **preferred language** plus **fallback languages**, and whether to prefer **manual (human)** or **auto-generated** captions.
- Output per video: `videoId`, `title`, `channel`, `language`, `isAutoGenerated`, `text`, and `segments` `[{start, duration, text}]` (seconds).
- Reliable: each attempt uses a fresh US residential proxy session, with automatic retries on blocks and network errors.
- `maxItems` caps how many videos are processed.

### Pricing

Pay per event: you are charged **only for each transcript delivered** (`transcript` event). Videos without captions, unavailable videos and failures return a free row with `status` and `reason`.

### Input example

```json
{ "urls": ["https://www.youtube.com/watch?v=aircAruvnKk", "https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi"],
  "preferredLanguage": "en", "fallbackLanguages": [], "captionPreference": "manual", "maxItems": 50 }
```

### Output example

```json
{ "videoId": "aircAruvnKk", "status": "success", "title": "But what is a neural network?", "channel": "3Blue1Brown",
  "language": "en", "isAutoGenerated": false, "text": "This is a 3. It's sloppily written...",
  "segments": [{ "start": 4.22, "duration": 3.1, "text": "This is a 3." }] }
```

Non-success rows: `status` is `no_captions` (reason `no_captions_available`, `live_stream_without_captions`, `requested_language_not_available`) or `failed` (e.g. `blocked`, `network_error`, `video_error`, `unrecognized_url`). `availableLanguages` lists the tracks a video has.

### Notes

- Only public captions are fetched; no login, no audio download or speech-to-text.
- Live streams usually have no captions until they end.
- Playlist expansion reads the first page of the playlist (up to ~100 videos).

### Use cases

- **Summarize YouTube videos with AI**: feed the transcript text to an LLM for summaries, notes or Q\&A.
- **Search and research**: make video content searchable across channels and playlists.
- **Subtitles and repurposing**: reuse timestamped segments for clips, blog posts or translations.

### FAQ

**How do I get the transcript of a YouTube video?** Paste the video, Shorts or playlist URL (or a bare video ID) into `urls` and run. Each video becomes one dataset item with `text` and `segments`.

**Does it work with auto-generated captions?** Yes. Set `captionPreference` to prefer manual or auto-generated captions; the `isAutoGenerated` field tells you which you got.

**Can I pick the transcript language?** Yes, with `preferredLanguage` and `fallbackLanguages`. `availableLanguages` lists what each video has.

**What if a video has no captions?** You get a free row with `status: "no_captions"`. There is no speech-to-text.

**What does it cost?** $0.0025 per transcript delivered ($2.50 per 1,000). Videos without captions and failures are free.

Made by withgrokbot.

# Actor input Schema

## `urls` (type: `array`):

YouTube watch, youtu.be, Shorts, live or playlist URLs, or bare video/playlist IDs. Playlists are expanded (first page, up to ~100 videos).

## `preferredLanguage` (type: `string`):

Language code, e.g. en, es, de, ja. Regional variants match too (en matches en-GB).

## `fallbackLanguages` (type: `array`):

Tried in order if the preferred language is missing. Leave empty to return no_captions when the preferred language is unavailable; add e.g. 'en' or the video's own language.

## `captionPreference` (type: `string`):

Which caption track to choose when both exist in the selected language.

## `maxItems` (type: `integer`):

Maximum number of videos to process across all inputs (after playlist expansion).

## `maxRetries` (type: `integer`):

Attempts per video, each with a fresh proxy session.

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

US residential proxy is recommended; YouTube blocks most datacenter IPs.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=aircAruvnKk"
  ],
  "preferredLanguage": "en",
  "fallbackLanguages": [],
  "captionPreference": "manual",
  "maxItems": 100,
  "maxRetries": 3,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

## `transcripts` (type: `string`):

One item per video: status, metadata, plain text and timestamped segments.

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

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

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

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,withgrokbot/youtube-transcript"
        }
    }
}
```

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/kv3ujThrlNoR8i4N1/builds/H42A6F3jdX5RMZ2eI/openapi.json
