# YouTube Transcript Extractor — Captions & Timestamps (`junipr/youtube-transcript-extractor`) Actor

Extract available YouTube transcripts and captions with timestamps, languages, metadata, and text exports for research or RAG workflows.

- **URL**: https://apify.com/junipr/youtube-transcript-extractor.md
- **Developed by:** [junipr](https://apify.com/junipr) (community)
- **Categories:** Videos, Developer tools
- **Stats:** 10 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.90 / 1,000 transcript extracteds

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?

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 Extractor — Captions & Timestamps

Extract available transcripts, captions, and subtitles from public YouTube videos. Get full text, timed segments, video metadata, channel info, and word counts. Supports multiple languages, auto-generated captions, and SRT/VTT/JSON/plain text output formats. Batch process up to 500 input videos with an intentionally bounded one-video default.

### Features

- Extract available transcripts from public YouTube videos with captions enabled
- Multiple output formats: plain text, SRT subtitles, WebVTT subtitles, or raw JSON segments
- Timed segments with start time and duration for each text block
- Full video metadata: title, channel name, channel URL, duration, view count, publish date
- Multi-language support with automatic fallback to available languages
- Auto-generated caption support — falls back to YouTube's auto-captions when manual captions are unavailable
- Batch processing — extract transcripts from up to 500 videos in a single run
- Word count per video for content analysis
- Accepts all YouTube URL formats: standard, short (youtu.be), embed, and shorts
- Bounded zero-config default — attempts one known public video
- Pay-per-event pricing — only pay for transcripts successfully extracted

### Proxy Requirements

Residential proxies are strongly recommended because YouTube may block datacenter IP addresses.

- Accounts with residential proxy access can use the default proxy configuration.
- Other users can provide their own proxy URL or allow the actor to attempt a direct request.
- If YouTube blocks every route, the actor records an uncharged KVS diagnostic rather than a paid transcript row.

### Input

All fields are optional. The actor runs with defaults and requires no configuration.

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `urls` | string\[] | Example video | List of YouTube video URLs to extract transcripts from |
| `language` | string | `"en"` | Preferred transcript language code (e.g., en, es, fr, de, ja) |
| `includeTimestamps` | boolean | `true` | Include timed segments with start time and duration |
| `includeAutoGenerated` | boolean | `true` | Fall back to auto-generated captions if manual captions are unavailable |
| `outputFormat` | string | `"text"` | Output format: text, srt, vtt, or json |
| `maxVideos` | integer | `1` | Maximum videos to process (1-500) |
| `proxyConfiguration` | object | Apify residential | Proxy settings; direct fallback is attempted when proxy access is unavailable |

### Output

Each successfully extracted transcript is stored in the default dataset. Caption-unavailable, blocked, and extraction-error details are stored as uncharged KVS diagnostics.

| Field | Type | Description |
|-------|------|-------------|
| `videoUrl` | string | Canonical YouTube URL |
| `videoId` | string | YouTube video ID |
| `title` | string or null | Video title |
| `channelName` | string or null | Channel name |
| `channelUrl` | string or null | Channel URL |
| `duration` | string or null | Video duration in ISO 8601 format (e.g., PT5M30S) |
| `viewCount` | number or null | Total view count |
| `publishedAt` | string or null | Publish date |
| `language` | string or null | Language code of the extracted transcript |
| `isAutoGenerated` | boolean or null | Whether the transcript is auto-generated by YouTube |
| `transcript` | string or null | Full transcript text in the requested format |
| `segments` | array or null | Timed segments with text, start, and duration (when includeTimestamps is true) |
| `wordCount` | number or null | Total word count of the transcript |
| `error` | string or null | Reserved field; successful rows use `null` and failures are recorded in KVS |
| `scrapedAt` | string | ISO 8601 timestamp of extraction |

#### Output Example

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "videoId": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "channelName": "Rick Astley",
  "channelUrl": "https://www.youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
  "duration": "PT3M33S",
  "viewCount": 1500000000,
  "publishedAt": "2009-10-25",
  "language": "en",
  "isAutoGenerated": true,
  "transcript": "We're no strangers to love You know the rules and so do I...",
  "segments": [
    { "text": "We're no strangers to love", "start": 18.0, "duration": 3.5 },
    { "text": "You know the rules and so do I", "start": 21.5, "duration": 3.0 }
  ],
  "wordCount": 287,
  "error": null,
  "scrapedAt": "2025-06-01T12:00:00.000Z"
}
```

### Use Cases

- **Content repurposing** — convert video content into blog posts, articles, or social media copy
- **SEO and keyword research** — analyze transcript text for keywords and topic coverage
- **Accessibility** — generate text versions of video content for hearing-impaired users
- **Research and analysis** — extract and analyze spoken content from educational or news videos
- **Subtitle generation** — export SRT or VTT files for use in video editors or players
- **AI and NLP pipelines** — feed transcript text into summarization, sentiment analysis, or embedding models
- **Content monitoring** — track what competitors or influencers are saying in their videos

### Integrations

Connect this actor with other tools in your workflow:

- **Apify API** — trigger runs programmatically and retrieve results via REST API
- **Webhooks** — get notified when extraction completes
- **Scheduling** — set up recurring runs to monitor new video transcripts
- **Apify integrations** — connect to Google Sheets, Slack, Zapier, Make, and more

### Ready-to-run public tasks

- **Extract one readable transcript** — one public video, clean text, no timestamps.
- **Export timestamped segments** — one public video with structured caption timing.
- **Check another public video** — a second bounded source demonstrating timestamp-aware text output.

All three tasks cap the run at one video and use the current `includeAutoGenerated` input field.

### Pricing

This actor uses Pay-Per-Event (PPE) pricing: **$4.90 per 1,000 transcripts extracted** ($0.0049 per `transcript-extracted` event). Apify platform usage follows the live Store pricing entry.

### FAQ

#### What YouTube URL formats are supported?

The actor accepts standard watch URLs (youtube.com/watch?v=), short URLs (youtu.be/), embed URLs (youtube.com/embed/), shorts URLs (youtube.com/shorts/), and bare video IDs.

#### What if a video has no captions?

The actor records an uncharged KVS diagnostic for that video and continues processing the remaining videos. You are not charged for unavailable transcripts.

#### Why does this actor need a residential proxy?

YouTube may block requests from datacenter IP addresses. Residential routing can improve reliability, but no route is guaranteed; blocked responses are reported honestly.

#### Can I use this on Apify's free plan?

The actor can attempt direct requests when residential proxy access is unavailable. Reliability depends on YouTube's current network controls; provide a compatible proxy when direct requests are blocked.

# Actor input Schema

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

List of YouTube video URLs to extract transcripts from. Supports standard (youtube.com/watch?v=), short (youtu.be/), and embed (youtube.com/embed/) URL formats.

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

Preferred transcript language code (e.g., 'en', 'es', 'fr', 'de', 'ja'). Falls back to available language if preferred is not found.

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

Include timed segments with start time and duration for each text segment.

## `includeAutoGenerated` (type: `boolean`):

Fall back to auto-generated captions if manual captions are not available.

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

Format for the transcript text. 'text' = plain text, 'srt' = SubRip subtitle format, 'vtt' = WebVTT subtitle format, 'json' = raw JSON segments.

## `maxVideos` (type: `integer`):

Maximum number of videos to process from the URL list.

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

Residential proxy routing is recommended because YouTube may block datacenter IPs. The actor attempts a direct request when configured proxy access is unavailable.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=UF8uR6Z6KLc"
  ],
  "language": "en",
  "includeTimestamps": true,
  "includeAutoGenerated": true,
  "outputFormat": "text",
  "maxVideos": 1,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `results` (type: `string`):

Successfully extracted YouTube video transcripts with segments, timestamps, metadata, channel info, and word counts.

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("junipr/youtube-transcript-extractor").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 = {}

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

```

## MCP server setup

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

```

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/60aNIMzLIyjMSfEy6/builds/MivYs5Kbf7FymZnsO/openapi.json
