# YouTube Transcript Scraper: Subtitles, Captions & Timestamps (`davidcastro/youtube-transcript-scraper`) Actor

Get YouTube transcripts and subtitles with timestamps from video URLs, playlists, channels or search. Choose the language, prefer human or auto captions, translate, and export text, timed segments or SRT. Title, channel and duration included. Export to JSON, CSV or Excel.

- **URL**: https://apify.com/davidcastro/youtube-transcript-scraper.md
- **Developed by:** [David Castro](https://apify.com/davidcastro) (community)
- **Categories:** Videos, AI, Social media
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $15.00 / 1,000 results

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: Subtitles, Captions & Timestamps

Get the transcript of any public YouTube video that has captions. Paste video links, a playlist, a channel or a search query, choose the language, and get one row per video with the full text, timed caption lines, and the video title, channel and duration. Human-made captions are used first when they exist, and auto-generated captions cover the rest. Transcripts can be translated into another language, and you can also get them as SRT subtitles.

### What you get

| Field | Example |
|---|---|
| `title` | Steve Jobs' 2005 Stanford Commencement Address |
| `channelName`, `channelId`, `channelUrl` | Stanford, UC-EnprmCZ3OXyAoG7vjVNCA, channel link |
| `durationSeconds` | 904 |
| `language`, `languageName` | en, English |
| `captionType` | manual or auto |
| `isTranslated`, `originalLanguage` | false, en |
| `availableLanguages` | \["ar", "en (auto)", "en", "es", "ja", "pt-BR"] |
| `transcript` | the full text as one paragraph, or one line per caption with \[m:ss] timestamps |
| `segments` | \[{"start": 7.47, "end": 10.369, "duration": 2.899, "text": "..."}] |
| `segmentCount`, `wordCount` | 244, 2298 |
| `srt` | a ready-to-save subtitle file, when requested |
| `videoUrl`, `videoId` | video link and ID |
| `source`, `sourceInput` | which input produced the row |

### Inputs

- **Video or playlist URLs:** watch links, youtu.be links, Shorts, live and embed links, bare video IDs, or playlist links.
- **Channels:** a channel link or a handle such as `@mkbhd`. The latest uploads are transcribed.
- **Search queries:** keywords, with sort order, upload date, duration and a "has subtitles" filter.
- **Language:** a code such as `en`, `es`, `pt-BR` or `ja`. If a video lacks that language you can return the original captions, translate them into your language, or skip the video.
- **Always translate to:** translate every transcript into one language.
- **Caption type:** prefer human-made or auto-generated captions, or require one of them.
- **Output:** timed segments, timestamps inside the text, and SRT subtitles.

### Example input

```json
{
    "videoUrls": ["https://www.youtube.com/watch?v=UF8uR6Z6KLc"],
    "channelUrls": ["@mkbhd"],
    "searchQueries": ["how to make sourdough bread"],
    "maxVideosPerSource": 10,
    "language": "en",
    "fallback": "translate",
    "includeSrt": true
}
```

### Example output

```json
{
    "videoId": "UF8uR6Z6KLc",
    "videoUrl": "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
    "title": "Steve Jobs' 2005 Stanford Commencement Address",
    "channelName": "Stanford",
    "channelId": "UC-EnprmCZ3OXyAoG7vjVNCA",
    "durationSeconds": 904,
    "language": "en",
    "languageName": "English",
    "captionType": "manual",
    "isTranslated": false,
    "availableLanguages": ["ar", "en (auto)", "en", "it", "ja", "km", "pt-BR", "es", "es-ES"],
    "segmentCount": 244,
    "wordCount": 2298,
    "transcript": "This program is brought to you by Stanford University. Please visit us at stanford.edu ...",
    "segments": [{ "start": 7.47, "end": 10.369, "duration": 2.899, "text": "This program is brought to you by Stanford University." }]
}
```

### Use cases

- Feed video content into search, summaries, chatbots and AI knowledge bases.
- Research what a channel or a topic says across many videos.
- Quote videos with exact timestamps.
- Make subtitles for re-uploads, translations and accessibility.
- Repurpose talks, tutorials and podcasts into articles and notes.

### Coverage

Any public video with captions or subtitles. Videos without any captions, private, members-only and age-restricted videos cannot be transcribed; they come back as a row with an `error` message and are not charged. Auto-generated captions follow the spoken language of the video and have no punctuation in some languages.

### Pricing

You pay per transcript delivered. Videos without usable captions, failed inputs and error rows are never charged. The run stops when it reaches your maximum transcripts or your spend limit. Free Apify plans get up to 10 transcripts per run.

### FAQ

**Can I get transcripts in a language the video does not have?**
Yes. Set the fallback to "Translate into my language", or set "Always translate to". The translation is YouTube's own caption translation.

**Does it return comments, likes or view counts?**
No. This actor returns transcripts plus the title, channel, duration and caption languages a transcript user needs.

**How do I get SRT files?**
Turn on "Include SRT subtitles". The `srt` field holds the subtitle file as text.

# Actor input Schema

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

YouTube video links (watch, youtu.be, Shorts, live, embed), bare 11-character video IDs, or playlist links.

## `channelUrls` (type: `array`):

Channel links or handles such as @mkbhd. The latest uploads are transcribed, up to the per-source limit below.

## `searchQueries` (type: `array`):

Keywords to search on YouTube. Matching videos are transcribed, up to the per-source limit below.

## `maxVideosPerSource` (type: `integer`):

How many videos to take from each channel, playlist or search query.

## `maxResults` (type: `integer`):

Total transcripts to deliver in this run. Free Apify plans are limited to 10 per run.

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

Preferred caption language as a code, for example en, es, pt, de, fr, ja or pt-BR. Regional variants match too (en also matches en-US and en-GB).

## `fallback` (type: `string`):

What to do when a video has no captions in your language.

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

Optional language code. When set, every transcript is translated into this language with YouTube's own caption translation.

## `captionType` (type: `string`):

Human-made captions are usually more accurate. Auto-generated captions exist for most spoken videos.

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

Adds the transcript as a list of lines with start, end and duration in seconds.

## `timestampsInText` (type: `boolean`):

Writes the transcript one line per caption with a \[m:ss] timestamp, instead of one plain paragraph.

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

Adds a ready-to-save SRT subtitle file as text.

## `searchSort` (type: `string`):

Order of search results.

## `uploadDate` (type: `string`):

Only videos uploaded in this window.

## `videoDuration` (type: `string`):

Video length filter.

## `onlyWithCaptions` (type: `boolean`):

Limits search results to videos that have subtitles or closed captions.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=UF8uR6Z6KLc"
  ],
  "channelUrls": [],
  "searchQueries": [],
  "maxVideosPerSource": 20,
  "maxResults": 10,
  "language": "en",
  "fallback": "original",
  "translateTo": "",
  "captionType": "prefer_manual",
  "includeSegments": true,
  "timestampsInText": false,
  "includeSrt": false,
  "searchSort": "relevance",
  "uploadDate": "any",
  "videoDuration": "any",
  "onlyWithCaptions": true
}
```

# Actor output Schema

## `overview` (type: `string`):

Transcripts with the main video fields.

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

Every field, including timed segments and SRT.

# 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=UF8uR6Z6KLc"
    ],
    "channelUrls": [],
    "searchQueries": [],
    "maxVideosPerSource": 20,
    "maxResults": 10,
    "language": "en",
    "translateTo": ""
};

// Run the Actor and wait for it to finish
const run = await client.actor("davidcastro/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=UF8uR6Z6KLc"],
    "channelUrls": [],
    "searchQueries": [],
    "maxVideosPerSource": 20,
    "maxResults": 10,
    "language": "en",
    "translateTo": "",
}

# Run the Actor and wait for it to finish
run = client.actor("davidcastro/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=UF8uR6Z6KLc"
  ],
  "channelUrls": [],
  "searchQueries": [],
  "maxVideosPerSource": 20,
  "maxResults": 10,
  "language": "en",
  "translateTo": ""
}' |
apify call davidcastro/youtube-transcript-scraper --silent --output-dataset

```

## MCP server setup

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