# YouTube Transcript API — Pay Per Result (`xtech/youtube-transcript-ppr`) Actor

Extract reliable YouTube transcripts in bulk with language selection, timestamps, multiple export formats, and unbilled failure diagnostics. Pay only for successful transcript results.

- **URL**: https://apify.com/xtech/youtube-transcript-ppr.md
- **Developed by:** [Xtech](https://apify.com/xtech) (community)
- **Categories:** Videos
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $10.00 / 1,000 transcript results

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/platform/actors/running/actors-in-store#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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js/docs.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python/docs.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/integrations/mcp.md).

If your project is in a different language, use 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 Scraper Pro

Extract clean transcripts from one or many YouTube videos in a single run.

#### Fastest first run

```json
{
  "videos": ["dQw4w9WgXcQ"],
  "type": "plain",
  "maxConcurrency": 1,
  "maxRetries": 1
}
````

Validate one known-caption video first, then increase the batch size. Successful transcript rows and unbilled error rows are separated so downstream workflows can retry only unavailable inputs.

This Actor accepts YouTube video URLs or video IDs and returns transcripts in the format you need: plain text, timestamped text, SRT, VTT, JSON, CSV, or all formats at once. It prefers manually created captions when they are available and otherwise uses an auto-generated transcript.

### What you get

- Bulk processing for multiple videos
- Support for standard YouTube URLs, short URLs, Shorts URLs, embed URLs, live URLs, and raw video IDs
- Automatically returns the best available transcript, preferring manually created captions when available
- Optional language setting for users who need a specific transcript language
- Structured dataset output for downstream automations
- Output format control for different workflows (LLM prep, subtitle editing, QA, analytics)
- Apify Proxy support for cloud runs where YouTube blocks datacenter IPs

### Input

#### `videos` (required)

List of YouTube videos.

Supported values:

- Video ID: `VIDEO_ID`
- Watch URL: `https://www.youtube.com/watch?v=VIDEO_ID`
- Short URL: `https://youtu.be/VIDEO_ID`
- Shorts URL: `https://www.youtube.com/shorts/VIDEO_ID`
- Embed URL: `https://www.youtube.com/embed/VIDEO_ID`
- Live URL: `https://www.youtube.com/live/VIDEO_ID`

#### `type` (optional)

Output format for `transcript`.

Allowed values:

- `plain` (default)
- `timestamped`
- `srt`
- `vtt`
- `json`
- `csv`
- `all`

#### `language` (optional)

Leave empty to return the best available transcript in any language. If you enter a language code such as `en`, `es`, or `de`, the Actor will try to return that language and otherwise report which languages are available.

#### `keepMusicMarkers` (optional)

- Type: boolean
- Default: `false`
- When `false`, markers like `[Music]` are removed.

#### `dropEmpty` (optional)

- Type: boolean
- Default: `true`
- Removes empty transcript segments after cleanup.

#### `maxConcurrency` (optional)

- Type: integer
- Default: `3`
- Range: `1` to `10`
- Controls how many videos are processed in parallel.

#### `maxRetries` (optional)

- Type: integer
- Default: `2`
- Range: `0` to `5`
- Retries transient transcript request failures.

#### `proxyConfiguration` (optional)

- Type: object
- Default: Apify Proxy with the `RESIDENTIAL` group
- YouTube often blocks cloud datacenter IPs, so proxy use is recommended for Apify platform runs. You can disable it for local/direct runs if transcript requests work without a proxy.

### Output

Each dataset item contains:

- `recordType` (`transcript` or `error`)
- `success` (boolean)
- `originalInput` (string)
- `videoId` (string)
- `videoUrl` (string)
- `languageCode` (string or `null`)
- `languageName` (string or `null`)
- `isGenerated` (boolean or `null`)
- `isTranslatable` (boolean or `null`)
- `outputFormat` (string)
- `transcript` (string, array, object, or `null` depending on `type`)
- `segments` (array or `null`)
- `segmentCount` (integer)
- `availableLanguages` (array)
- `errorMessage` (string or `null`)
- `scrapedAt` (UTC timestamp)

If a video fails, the item is still returned with:

- `success: false`
- `transcript: ""`
- `errorMessage` explaining the failure

When this Actor is configured for pay-per-event pricing, successful transcript rows are the only billable dataset items. Failed inputs and spending-limit diagnostics are written to the separate **Unbilled errors** dataset.

### Example input

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=VIDEO_ID_1",
    "https://youtu.be/VIDEO_ID_2",
    "VIDEO_ID_3"
  ],
  "type": "all",
  "language": "",
  "keepMusicMarkers": false,
  "dropEmpty": true,
  "maxConcurrency": 4,
  "maxRetries": 2,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}
```

### Example output item

```json
{
  "recordType": "transcript",
  "success": true,
  "originalInput": "https://www.youtube.com/watch?v=VIDEO_ID_1",
  "videoId": "VIDEO_ID_1",
  "videoUrl": "https://www.youtube.com/watch?v=VIDEO_ID_1",
  "languageCode": "en",
  "languageName": "English",
  "isGenerated": false,
  "isTranslatable": true,
  "outputFormat": "all",
  "transcript": {
    "plain": "Never gonna give you up...",
    "timestamped": "00:00:01.200 Never gonna give you up...",
    "srt": "1\\n00:00:01,200 --> 00:00:03,800\\nNever gonna give you up...",
    "vtt": "WEBVTT\\n\\n00:00:01.200 --> 00:00:03.800\\nNever gonna give you up...",
    "json": [
      {
        "text": "Never gonna give you up...",
        "start": 1.2,
        "duration": 2.6
      }
    ],
    "csv": "start,duration,text\\n1.2,2.6,\"Never gonna give you up...\""
  },
  "segmentCount": 42,
  "errorMessage": null,
  "scrapedAt": "2026-05-22T12:34:56Z"
}
```

### Typical use cases

- Build subtitle files (`srt` or `vtt`) for editing or publishing
- Prepare clean text for AI/LLM pipelines (`plain` or `json`)
- Create timestamped transcripts for compliance or QA reviews
- Batch-export transcripts for research and analytics

### Notes

- The Actor deduplicates repeated video IDs in one run.
- Transcript availability depends on whether subtitles exist for a given video.
- Leave `language` empty for the simplest and most reliable result. The Actor will choose a manually created transcript when available, otherwise an auto-generated transcript.
- For best throughput on larger batches, increase `maxConcurrency` gradually.

# Actor input Schema

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

Enter one or more YouTube video IDs or URLs. Supported URL formats include standard watch URLs, short youtu.be URLs, Shorts URLs, embed URLs, and live URLs.

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

Choose the format stored in the `transcript` field. Select `all` to include every supported format in one object.

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

Optional transcript language code, for example `en`, `es`, or `de`. Leave empty to return the best available transcript in any language.

## `preserveFormatting` (type: `boolean`):

Keep YouTube transcript formatting tags where the upstream transcript API provides them.

## `keepMusicMarkers` (type: `boolean`):

Keep markers such as `[Music]` in transcript text. When disabled, these markers are removed.

## `dropEmpty` (type: `boolean`):

Remove transcript segments that become empty after cleanup.

## `maxConcurrency` (type: `integer`):

Number of videos to process in parallel. Increase gradually for larger batches.

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

Number of retries for transient transcript request failures.

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

Proxy settings for transcript requests. Apify Proxy is enabled by default because YouTube often blocks cloud datacenter IPs.

## Actor input object example

```json
{
  "type": "plain",
  "language": "",
  "preserveFormatting": false,
  "keepMusicMarkers": false,
  "dropEmpty": true,
  "maxConcurrency": 3,
  "maxRetries": 2,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `dataset_items` (type: `string`):

No description

## `errorResults` (type: `string`):

When pay-per-event pricing is active, failed inputs and spending-limit diagnostics are saved here without a transcript charge.

# 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("xtech/youtube-transcript-ppr").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("xtech/youtube-transcript-ppr").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).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 xtech/youtube-transcript-ppr --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=xtech/youtube-transcript-ppr",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Transcript API — Pay Per Result",
        "description": "Extract reliable YouTube transcripts in bulk with language selection, timestamps, multiple export formats, and unbilled failure diagnostics. Pay only for successful transcript results.",
        "version": "1.1",
        "x-build-id": "nKze6vBxEZKgPyQHO"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/xtech~youtube-transcript-ppr/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-xtech-youtube-transcript-ppr",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/xtech~youtube-transcript-ppr/runs": {
            "post": {
                "operationId": "runs-sync-xtech-youtube-transcript-ppr",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/xtech~youtube-transcript-ppr/run-sync": {
            "post": {
                "operationId": "run-sync-xtech-youtube-transcript-ppr",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "videos"
                ],
                "properties": {
                    "videos": {
                        "title": "YouTube videos",
                        "minItems": 1,
                        "uniqueItems": true,
                        "type": "array",
                        "description": "Enter one or more YouTube video IDs or URLs. Supported URL formats include standard watch URLs, short youtu.be URLs, Shorts URLs, embed URLs, and live URLs.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "type": {
                        "title": "Transcript format",
                        "enum": [
                            "plain",
                            "timestamped",
                            "srt",
                            "vtt",
                            "json",
                            "csv",
                            "all"
                        ],
                        "type": "string",
                        "description": "Choose the format stored in the `transcript` field. Select `all` to include every supported format in one object.",
                        "default": "plain"
                    },
                    "language": {
                        "title": "Language (optional)",
                        "maxLength": 12,
                        "type": "string",
                        "description": "Optional transcript language code, for example `en`, `es`, or `de`. Leave empty to return the best available transcript in any language.",
                        "default": ""
                    },
                    "preserveFormatting": {
                        "title": "Preserve formatting",
                        "type": "boolean",
                        "description": "Keep YouTube transcript formatting tags where the upstream transcript API provides them.",
                        "default": false
                    },
                    "keepMusicMarkers": {
                        "title": "Keep music markers",
                        "type": "boolean",
                        "description": "Keep markers such as `[Music]` in transcript text. When disabled, these markers are removed.",
                        "default": false
                    },
                    "dropEmpty": {
                        "title": "Drop empty segments",
                        "type": "boolean",
                        "description": "Remove transcript segments that become empty after cleanup.",
                        "default": true
                    },
                    "maxConcurrency": {
                        "title": "Max concurrency",
                        "minimum": 1,
                        "maximum": 10,
                        "type": "integer",
                        "description": "Number of videos to process in parallel. Increase gradually for larger batches.",
                        "default": 3
                    },
                    "maxRetries": {
                        "title": "Max retries",
                        "minimum": 0,
                        "maximum": 5,
                        "type": "integer",
                        "description": "Number of retries for transient transcript request failures.",
                        "default": 2
                    },
                    "proxyConfiguration": {
                        "title": "Proxy (optional)",
                        "type": "object",
                        "description": "Proxy settings for transcript requests. Apify Proxy is enabled by default because YouTube often blocks cloud datacenter IPs.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ]
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
