# Youtube Transcript Scraper (`thedoor/youtube-transcript-scraper`) Actor

Extract full YouTube transcripts instantly. Bulk video support, precise timestamps, and multiple export formats (CSV, Excel, JSON). Perfect for AI training, SEO, and content analysis.

- **URL**: https://apify.com/thedoor/youtube-transcript-scraper.md
- **Developed by:** [TheDoor](https://apify.com/thedoor) (community)
- **Categories:** Videos, Social media, News
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 26 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

from $0.70 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.
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

Fetch transcripts and captions from YouTube videos using Apify Proxy with session management and automatic retry logic.

### Input

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `videos` | array | ✅ | - | List of videos with URLs and preferred languages |
| `includeTimestamps` | boolean | ❌ | `true` | Include start time and duration for each snippet |

#### Video Object

Each video in the `videos` array has:

| Field | Type | Required | Default | Description |
|-------|------|----------|---------|-------------|
| `url` | string | ✅ | - | YouTube video URL (supports regular videos, shorts, youtu.be) |
| `languages` | array | ❌ | `["en"]` | Preferred transcript languages for this video |

#### Example Input

```json
{
    "videos": [
        {
            "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
            "languages": ["en"]
        },
        {
            "url": "https://www.youtube.com/watch?v=9bZkp7q19f0",
            "languages": ["ko", "en"]
        },
        {
            "url": "https://www.youtube.com/shorts/97IwoIqBCZk",
            "languages": ["en"]
        },
        {
            "url": "https://youtu.be/kJQP7kiw5Fk",
            "languages": ["es", "en"]
        }
    ],
    "includeTimestamps": true
}
```

### Supported URL Formats

- Regular: `https://www.youtube.com/watch?v=VIDEO_ID`
- Shorts: `https://www.youtube.com/shorts/VIDEO_ID`
- Short link: `https://youtu.be/VIDEO_ID`

### Supported Languages

The actor supports any language available on the YouTube video. Common language codes:

| Code | Language |
|------|----------|
| `en` | English |
| `es` | Spanish |
| `fr` | French |
| `de` | German |
| `pt` | Portuguese |
| `ja` | Japanese |
| `ko` | Korean |
| `zh` | Chinese |
| `ar` | Arabic |
| `hi` | Hindi |
| `vi` | Vietnamese |

If the preferred language is not available, the actor will fall back to the next language in the list or the video's default transcript.

### Output Format

The actor outputs a JSON object for each video with the following fields:

| Field | Type | Description |
|-------|------|-------------|
| `videoId` | string | YouTube video ID extracted from URL |
| `videoUrl` | string | Full YouTube video URL |
| `language` | string | Language of the fetched transcript |
| `isGenerated` | boolean | `true` if auto-generated captions, `false` if manually created |
| `transcriptText` | string | Full transcript text (with timestamps if enabled) |
| `snippetCount` | number | Total number of transcript snippets |
| `snippets` | array | Array of snippet objects (only when `includeTimestamps: true`) |
| `success` | boolean | `true` if transcript was fetched successfully |
| `error` | string | Error message (only present when `success: false`) |

#### Example Output (with timestamps)

```json
{
    "videoId": "dQw4w9WgXcQ",
    "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "language": "en",
    "isGenerated": true,
    "transcriptText": "[0.00s] Hello world\n[2.50s] Welcome to the video",
    "snippetCount": 2,
    "snippets": [
        {"text": "Hello world", "start": 0.0, "duration": 2.5},
        {"text": "Welcome to the video", "start": 2.5, "duration": 3.0}
    ],
    "success": true
}
```

#### Example Output (without timestamps)

```json
{
    "videoId": "dQw4w9WgXcQ",
    "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "language": "en",
    "isGenerated": false,
    "transcriptText": "Hello world Welcome to the video",
    "snippetCount": 2,
    "snippets": null,
    "success": true
}
```

### Recommended Memory

512 MB (default)

### Scraping Policy

This actor respects YouTube's terms of service and is designed for legitimate use cases:

- ✅ Fetches only publicly available transcripts/captions
- ✅ Does not bypass any authentication or access controls
- ✅ Uses rate limiting and proxy rotation to avoid overloading servers
- ✅ Intended for research, accessibility, content analysis, and archival purposes

**Do not use this actor to:**

- ❌ Scrape private or unlisted video transcripts without permission
- ❌ Violate YouTube's Terms of Service
- ❌ Redistribute copyrighted content without authorization

### Apify Platform Policy

This actor runs on the [Apify platform](https://apify.com) and adheres to:

- [Apify Terms of Service](https://apify.com/terms-of-service)
- [Apify Acceptable Use Policy](https://apify.com/acceptable-use-policy)
- [Apify Privacy Policy](https://apify.com/privacy-policy)

Users are responsible for ensuring their use of this actor complies with all applicable laws and the terms of service of both Apify and YouTube.

### License

This project is licensed under the **MIT License**.

```
MIT License

Copyright (c) 2024

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
```

### Support

For issues or feature requests, please open an issue on the actor's GitHub repository or contact the author through Apify Console.

# Actor input Schema

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

List of videos with their URLs and preferred languages

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

Include start time and duration for each transcript snippet

## Actor input object example

```json
{
  "videos": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "languages": [
        "en"
      ]
    },
    {
      "url": "https://www.youtube.com/watch?v=9bZkp7q19f0",
      "languages": [
        "ko",
        "en"
      ]
    },
    {
      "url": "https://www.youtube.com/shorts/97IwoIqBCZk",
      "languages": [
        "en"
      ]
    },
    {
      "url": "https://www.youtube.com/watch?v=JGwWNGJdvx8",
      "languages": [
        "en",
        "es"
      ]
    },
    {
      "url": "https://youtu.be/kJQP7kiw5Fk",
      "languages": [
        "es",
        "en"
      ]
    }
  ],
  "includeTimestamps": true
}
```

# 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": [
        {
            "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
            "languages": [
                "en"
            ]
        },
        {
            "url": "https://www.youtube.com/watch?v=9bZkp7q19f0",
            "languages": [
                "ko",
                "en"
            ]
        },
        {
            "url": "https://www.youtube.com/shorts/97IwoIqBCZk",
            "languages": [
                "en"
            ]
        },
        {
            "url": "https://www.youtube.com/watch?v=JGwWNGJdvx8",
            "languages": [
                "en",
                "es"
            ]
        },
        {
            "url": "https://youtu.be/kJQP7kiw5Fk",
            "languages": [
                "es",
                "en"
            ]
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("thedoor/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": [
        {
            "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
            "languages": ["en"],
        },
        {
            "url": "https://www.youtube.com/watch?v=9bZkp7q19f0",
            "languages": [
                "ko",
                "en",
            ],
        },
        {
            "url": "https://www.youtube.com/shorts/97IwoIqBCZk",
            "languages": ["en"],
        },
        {
            "url": "https://www.youtube.com/watch?v=JGwWNGJdvx8",
            "languages": [
                "en",
                "es",
            ],
        },
        {
            "url": "https://youtu.be/kJQP7kiw5Fk",
            "languages": [
                "es",
                "en",
            ],
        },
    ] }

# Run the Actor and wait for it to finish
run = client.actor("thedoor/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": [
    {
      "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
      "languages": [
        "en"
      ]
    },
    {
      "url": "https://www.youtube.com/watch?v=9bZkp7q19f0",
      "languages": [
        "ko",
        "en"
      ]
    },
    {
      "url": "https://www.youtube.com/shorts/97IwoIqBCZk",
      "languages": [
        "en"
      ]
    },
    {
      "url": "https://www.youtube.com/watch?v=JGwWNGJdvx8",
      "languages": [
        "en",
        "es"
      ]
    },
    {
      "url": "https://youtu.be/kJQP7kiw5Fk",
      "languages": [
        "es",
        "en"
      ]
    }
  ]
}' |
apify call thedoor/youtube-transcript-scraper --silent --output-dataset

```

## MCP server setup

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