# YouTube Transcript API: Subtitles, Captions & Whisper AI (`0xdevinci/youtube-transcript-scraper`) Actor

Transcribe YouTube to text: transcripts, subtitles and captions from videos, Shorts, channels, playlists and search. Whisper AI speech-to-text for videos without captions (paid plans), translation, SRT/VTT and LLM chunks. Works with MCP agents and n8n. From $1.80 per 1,000.

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

## Pricing

from $1.80 / 1,000 transcripts

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 API: Subtitles, Captions & Whisper AI

Turn YouTube videos, Shorts, channels, playlists and searches into text: transcripts, subtitles and captions as plain text, SRT, VTT or LLM chunks. Videos without captions can be transcribed by Whisper AI, and transcripts can be translated (AI features on paid Apify plans). You pay only for the transcripts you get.

### One video from the API

One field is enough. This call waits for the run to finish and returns the result (up to 300 seconds):

```bash
curl -X POST "https://api.apify.com/v2/acts/0xdevinci~youtube-transcript-scraper/run-sync-get-dataset-items" \
  -H "Authorization: Bearer $APIFY_TOKEN" -H "Content-Type: application/json" \
  -d '{"url": "https://www.youtube.com/watch?v=UF8uR6Z6KLc", "compact": true}'
```

Response with `"compact": true` (a real result, transcript shortened):

```json
[
  {
    "url": "https://www.youtube.com/watch?v=UF8uR6Z6KLc",
    "videoId": "UF8uR6Z6KLc",
    "title": "Steve Jobs' 2005 Stanford Commencement Address",
    "language": "en",
    "transcriptText": "This program is brought to you by Stanford University. Please visit us at stanford.edu Thank You. I am honored to be with you today at your commencement ...",
    "status": "success",
    "errorCode": null,
    "errorMessage": null,
    "warning": null
  }
]
```

- `"includeSegments": true` adds the timestamped segments (`transcript`: text, start, duration in seconds).
- `"languages": ["it", "en"]` picks the language, `"translateTo": "es"` translates, `"outputFormat": "srt"` returns subtitles.
- Without `compact` you get the full result with 24 fields (see [Output](#output-example)).
- `url` also takes a Short, a `youtu.be` link, a channel or a playlist; for many links use `urls`.

#### What a call costs

| | FREE | BRONZE | SILVER | GOLD and above |
| --- | --- | --- | --- | --- |
| **1 video in one call** | $0.00255 | $0.0023 | $0.00205 | $0.00185 |
| **1,000 videos, one call each** | $2.55 | $2.30 | $2.05 | $1.85 |
| **1,000 videos in one run** | $2.50 | $2.25 | $2.00 | $1.80 |

- A call costs one transcript ($0.0025 on FREE, down to $0.0018) plus Apify's start fee of $0.00005 per run (one per GB of memory; the default memory is below 1 GB, so one fee).
- Failed videos are free: a call that returns no transcript costs only the start fee.
- Videos with no subtitles at all are transcribed by AI on paid plans, for $0.008–$0.010 per started minute on top. Send `"aiFallback": false` to never pay for it.

#### AI agents (MCP) and n8n

**MCP.** The [Apify MCP server](https://mcp.apify.com) turns this Actor into a tool your agent can call. Configuration for a local MCP client:

```json
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server", "--actors", "0xdevinci/youtube-transcript-scraper"],
      "env": { "APIFY_TOKEN": "<YOUR_APIFY_TOKEN>" }
    }
  }
}
```

The agent sees the tool `0xdevinci--youtube-transcript-scraper` and can call it with `{"url": "...", "compact": true}`.

**n8n.** Add the Apify node (`@apify/n8n-nodes-apify`), choose **Actors → Run actor and get dataset**, Actor `0xdevinci~youtube-transcript-scraper`, input mode JSON, and an input such as `{"url": "{{ $json.url }}", "compact": true}`. Each transcript comes out as one n8n item.

Python ([apify-client](https://docs.apify.com/api/client/python) 3.x):

```python
from apify_client import ApifyClient

client = ApifyClient('<YOUR_APIFY_TOKEN>')
run = client.actor('0xdevinci/youtube-transcript-scraper').call(
    run_input={'url': 'https://youtu.be/UF8uR6Z6KLc', 'compact': True},
)
item = next(client.dataset(run.default_dataset_id).iterate_items())
print(item['status'], item['transcriptText'][:200])
```

### Quick start in Apify Console

1. Click **Start**. The input is pre-filled with a sample video, so the first run works without changing anything.
2. Put your own sources in **YouTube URLs**, one per line, and/or type keywords in **Search YouTube**:
   - a video: `https://www.youtube.com/watch?v=UF8uR6Z6KLc` or `https://youtu.be/UF8uR6Z6KLc`
   - a Short: `https://www.youtube.com/shorts/KBfIo9sZbC4`
   - a channel: `https://www.youtube.com/@veritasium` (newest videos first)
   - a playlist: `https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi`
   - a search: `retrieval augmented generation tutorial`
3. Optional: pick **Transcript languages**, **Translate to**, the **Transcript text format** (`llm` for ready-made chunks), how many videos per channel, playlist or search, and **Only videos published after** (e.g. `30 days`).
4. Click **Start** and open the **Output** tab. Download as JSON, CSV or Excel, or read the results through the API.

Set **Maximum cost per run** in the run options to control spending: the Actor stops when it is reached and never lists more videos than that budget can pay for.

```json
{
    "urls": [
        "https://www.youtube.com/@veritasium",
        "https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi",
        "https://youtu.be/UF8uR6Z6KLc"
    ],
    "searchQueries": ["retrieval augmented generation tutorial"],
    "languages": ["en"],
    "translateTo": "it",
    "outputFormat": "llm",
    "maxVideosPerSource": 50,
    "maxVideosPerSearch": 20,
    "publishedAfter": "90 days",
    "includeShorts": false,
    "aiFallback": true
}
```

### What it does

| | |
| --- | --- |
| **Inputs** | Videos, Shorts, `youtu.be`, embeds, channels (`@handle`, `/channel/`, `/c/`, `/user/`, `/videos`, `/shorts`, `/streams` tabs), playlists, YouTube search terms and search links, mixed in one run. |
| **No link limit** | Add as many links and searches as you want, and as many videos per source as you want. Only your maximum cost per run decides how far a run goes. |
| **Filters** | `publishedAfter` (date or "30 days"), `includeShorts`, videos per source and per search. Live streams in progress and premieres are skipped. |
| **Languages** | Your languages in order of preference, optional fallback to any available language, translation to a target language, and `availableLanguages` for every video. |
| **AI fallback** | Videos with no subtitles at all are transcribed by Whisper (`whisper-large-v3-turbo`) from the audio (paid plans). |
| **LLM-ready formats** | `llm` blocks of ~1,000 tokens with start and end time, Markdown with timestamp links, clean plain text, timestamped segments, SRT and WebVTT. |
| **Fair billing** | Listing channels, playlists and searches is free. Failed videos are free. Duplicates found in several sources are charged once. |
| **Retries** | Each request starts on an Apify datacenter IP and moves to a fresh residential IP when YouTube blocks it (up to 3 attempts with increasing waits). One bad video or link never stops the run. |

### Compared with other transcript Actors on the Store

Checked on 13 November 2026 on the Store pages of the top four YouTube transcript Actors by monthly users:

| | This Actor | Those four Actors |
| --- | --- | --- |
| **AI transcription of videos without subtitles** | ✅ Whisper, from the audio | ❌ None of the four |
| **Translation when YouTube refuses it** | ✅ AI translation with the same timestamps (guaranteed on paid plans) | ❌ None of the four: three use only YouTube's own translation |
| **Translation of AI transcripts** | ✅ | ❌ None of the four |
| **LLM-ready chunks** with start and end times | ✅ | ❌ None of the four documents them |
| **Videos per run** | ✅ No limit: only your maximum cost per run decides | Three of the four have a cap: one video, 100 videos, or 200 videos from a channel |
| **Keyword search** (`searchQueries`) | ✅ | One of the four |
| **Playlists** | ✅ | One of the four |
| **Channels** | ✅ Any number of videos, newest first, with `publishedAfter` | Three of the four |
| **SRT and WebVTT** | ✅ | Two of the four |

### Built for automation

- **One input for everything.** Mix hundreds of video links, channels, playlists and searches in one run; duplicates across sources are removed and charged once.
- **Stable output.** One item per video, every field always present (`null` when it does not apply), so your code never breaks on a missing key. Filter on `status`, and retry only the items with `errorCode: "IpBlocked"` or `"RequestFailed"`.
- **Hard cost cap.** Set `maxTotalChargeUsd` on the run: the Actor never lists more videos than the budget can pay for, sets money aside before AI work, and stops cleanly when the budget is used.
- **Run report.** Every run saves `RUN_STATS` in its key-value store: videos listed and processed, successes, failures by code, AI minutes, translations.
- **Schedules and webhooks.** Run it every day on new videos (`publishedAfter: "1 day"`) and get a webhook when the dataset is ready.

Actor ID for the API: `0xdevinci/youtube-transcript-scraper` (Store page: https://apify.com/0xdevinci/youtube-transcript-scraper).

A bigger run from Python, with a cost cap:

```python
from decimal import Decimal
from apify_client import ApifyClient

client = ApifyClient('<YOUR_APIFY_TOKEN>')
run = client.actor('0xdevinci/youtube-transcript-scraper').call(
    run_input={
        'urls': ['https://www.youtube.com/@veritasium'],
        'searchQueries': ['retrieval augmented generation tutorial'],
        'maxVideosPerSource': 500,
        'maxVideosPerSearch': 100,
        'outputFormat': 'llm',
    },
    max_total_charge_usd=Decimal('5'),  # hard cap for this run
)
for item in client.dataset(run.default_dataset_id).iterate_items():
    if item['status'] == 'success':
        print(item['videoId'], len(item['chunks']), 'chunks')
    else:
        print(item['videoId'], item['errorCode'], item['errorMessage'])
```

For big runs use the asynchronous run endpoint (`POST /v2/acts/0xdevinci~youtube-transcript-scraper/runs`) and a webhook instead of the synchronous call, which waits at most 300 seconds.

### Use cases

| Use case | How |
| --- | --- |
| **RAG and knowledge bases** | Choose `llm`: each video comes as blocks of about 1,000 tokens in `chunks`, each with `start`/`end` seconds, ready to embed and cite. Or `markdown`, where every paragraph links to its moment in the video. |
| **AI agents** | Call the Actor from your agent through the Apify MCP server or the API with `{"url": "...", "compact": true}`: the agent gets the text and a status, without extra fields. |
| **Content repurposing** | Turn videos into blog posts, newsletters, social threads, show notes or course material: feed `transcriptText` to your LLM with your own prompt. |
| **Research and monitoring** | Search a topic or pull the last videos of several channels with `publishedAfter: "7 days"` on a schedule. |
| **Subtitles and translation** | `srt` / `vtt` files, in the original language or translated with `translateTo`. |

### Output example

Full output: one dataset item per video. Every field is always present and is `null` when it does not apply. With `"compact": true` each item has only `url`, `videoId`, `title`, `language`, `transcriptText`, `status`, `errorCode`, `errorMessage` and `warning` (plus `transcript` with `"includeSegments": true`).

A real result from a run with `"urls": ["https://www.youtube.com/@veritasium"]`, `"translateTo": "it"` and `"outputFormat": "llm"` (transcript and chunks shortened):

```json
{
    "videoId": "xlNKNnXdtN4",
    "url": "https://www.youtube.com/watch?v=xlNKNnXdtN4",
    "sourceUrl": "https://www.youtube.com/@veritasium",
    "title": "These ponds help support half the people on Earth",
    "channel": "Veritasium",
    "channelId": "UCHnyfMqiRRG1u-2MsSQLbXA",
    "durationSeconds": 112,
    "language": "it",
    "isGenerated": true,
    "isTranslated": true,
    "translatedFrom": "en",
    "translatedBy": "youtube",
    "translationMinutes": null,
    "availableLanguages": [
        { "languageCode": "en", "language": "English (auto-generated)", "isGenerated": true }
    ],
    "isAiGenerated": false,
    "aiModel": null,
    "aiMinutes": null,
    "transcript": [
        { "text": "Nel bel", "start": 0, "duration": 5.08 },
        { "text": "mezzo del deserto dello Utah si trovano stagni di un blu elettrico. Che cosa sono", "start": 2.6, "duration": 4.84 }
    ],
    "transcriptText": "[0:00:00 - 0:01:53]\nNel bel mezzo del deserto dello Utah si trovano stagni di un blu elettrico. Che cosa sono ? Perché sono qui? ...",
    "chunks": [
        { "index": 0, "start": 0, "end": 113.96, "tokens": 407, "text": "Nel bel mezzo del deserto dello Utah si trovano stagni di un blu elettrico. ..." }
    ],
    "status": "success",
    "errorCode": null,
    "errorMessage": null,
    "warning": null
}
```

- `sourceUrl` is the input line the video came from (the video itself, or the channel, playlist or search).
- `chunks` is filled with `"outputFormat": "llm"`. With other formats `transcriptText` holds plain text, text lines, Markdown, SRT or WebVTT.
- When YouTube does not deliver the translation, the same video comes back with `"translatedBy": "groq:openai/gpt-oss-120b"` and `"translationMinutes": 2` (a real run gave "Ci sono stagni di un blu elettrico nel | cuore del deserto dello Utah. ...", same timestamps).
- A video transcribed by AI has `"isAiGenerated": true`, `"aiModel": "whisper-large-v3-turbo"` and the `aiMinutes` charged.
- `warning` explains successful results that differ from what you asked, for example when YouTube does not deliver a translation and the original transcript is returned.

A video without subtitles when AI transcription is off looks like this (other fields `null`), and is **not charged**:

```json
{
    "videoId": "Y1vEGsnNYek",
    "url": "https://www.youtube.com/watch?v=Y1vEGsnNYek",
    "sourceUrl": "https://www.youtube.com/@kurzgesagt",
    "title": "What Is Food Fortification?",
    "availableLanguages": [],
    "status": "failed",
    "errorCode": "TranscriptNotFound",
    "errorMessage": "This video has no subtitles or automatic captions. Turn on aiFallback to transcribe it with AI."
}
```

### Pricing

Pay per event: you pay only for what you get, and the price drops on higher Apify plans:

| Event | FREE | BRONZE | SILVER | GOLD and above | When |
| --- | --- | --- | --- | --- | --- |
| **Transcript** | **$0.0025** | $0.00225 | $0.002 | $0.0018 | Each video whose transcript is delivered. |
| **AI minute** | **$0.010** | $0.0095 | $0.009 | $0.008 | Per started minute of audio, only for videos with no subtitles, transcribed by AI. |
| **AI translation minute** | $0.003 | $0.003 | $0.003 | $0.003 | Per started minute of video, only when YouTube does not deliver the translation you asked for, and for AI transcripts (paid plans). |

That is $2.50 per 1,000 transcripts on the FREE tier and $1.80 per 1,000 on GOLD.

- **Free:** listing channels, playlists and searches; failed videos (`TranscriptNotFound`, unavailable, age-restricted, blocked); duplicates; AI downloads, transcriptions or translations that fail.
- An AI-transcribed video costs one transcript plus its minutes. Example (FREE tier): a 7-minute video with no subtitles costs $0.0025 + 7 × $0.010 = **$0.0725**.
- AI minutes and AI translation minutes are charged **only after the AI succeeded**, and never beyond your maximum cost per run: the budget is set aside first, and if it allows only part of a video, only that part is transcribed.
- Apify also charges a small fixed fee when a run starts ($0.00005 per GB of memory, minimum one).

Example (FREE tier): 3 channels × 20 videos where 55 have subtitles and 5 are transcribed by AI (6 minutes each) = 60 × $0.0025 + 30 × $0.010 = **$0.45**.

Example with translation (BRONZE): a 12-minute video translated by AI because YouTube refused its translation costs $0.00225 + 12 × $0.003 = **$0.038**.

### Translation (guaranteed on paid plans)

Set `translateTo` (e.g. `it`) and the Actor delivers the transcript in that language:

1. If the video has its own track in that language, that track is used (no translation needed).
2. Otherwise YouTube's automatic translation is used, when YouTube delivers it (`translatedBy: "youtube"`).
3. YouTube refuses most of its automatic translations to automated tools (in our tests, more than 9 in 10). **On paid Apify plans** the Actor then translates the segments itself with an AI text model (`openai/gpt-oss-120b` on Groq), keeping every timestamp (`translatedBy: "groq:openai/gpt-oss-120b"`, charged as AI translation minutes). The same happens for videos transcribed by AI, which YouTube cannot translate at all. If even the AI translation fails, you get the original transcript with a `warning`, **free of charge**.
4. **On the free Apify plan** there is no AI translation: when YouTube does not deliver its translation, you get the original transcript with a `warning`, charged as a normal transcript.

Turn off `aiTranslationFallback` to never pay for AI translations (you then get the original with a warning when YouTube fails, charged normally).

### AI transcription for videos without subtitles

- **When:** only for videos with no subtitles or automatic captions at all (`aiFallback`, on by default). Videos that have captions in other languages use `anyLanguageFallback` / `translateTo` instead.
- **How:** the Actor downloads only the audio, at a low bitrate, and transcribes it with Whisper (`whisper-large-v3-turbo`) in the language spoken in the video. With `translateTo`, the AI transcript is then translated too.
- **Limits:** `maxAiMinutesPerVideo` (default 60) transcribes at most the first N minutes; `skipAiOverMinutes` (default 120) skips longer videos entirely (free).
- **Plans:** AI transcription is available to users on a paid Apify plan. On the free plan such videos return `TranscriptNotFound` with an explanation, and are not charged.

### Input

| Field | Default | Description |
| --- | --- | --- |
| `url` | empty | One YouTube link (video, Short, channel or playlist). Enough on its own for an API call. |
| `urls` | one sample video in Console | Videos, Shorts, channels, playlists and search links, in any mix, no limit. |
| `searchQueries` | empty | YouTube search terms, one per line. |
| `languages` | `["en"]` | Language codes in order of preference; uploader subtitles win over automatic captions. |
| `anyLanguageFallback` | `false` | When none of your languages exists, return the first available transcript instead of failing. |
| `translateTo` | empty | Target language code. Native track, then YouTube's translation, then (paid plans) AI translation. See "Translation (guaranteed on paid plans)". |
| `aiTranslationFallback` | `true` | Paid plans: translate with AI when YouTube does not deliver the translation. |
| `outputFormat` | `json` | `json` (clean text), `text`, `markdown`, `llm` (~1,000-token blocks), `srt`, `vtt`. |
| `includeMetadata` | `true` | Adds `title`, `channel`, `channelId`, `durationSeconds` (free). |
| `compact` | `false` | Return only `url`, `videoId`, `title`, `language`, `transcriptText`, `status`, `errorCode`, `errorMessage`, `warning`. |
| `includeSegments` | `false` | With `compact`: also return the timestamped segments (`transcript`). |
| `maxVideosPerSource` | `20` | Videos per channel or playlist. No upper limit. |
| `maxVideosPerSearch` | `20` | Videos per search. No upper limit. |
| `publishedAfter` | empty | `YYYY-MM-DD` (UTC) or `30 days`, `2 weeks`, `1 year`. Applies to channels, playlists and searches. |
| `includeShorts` | `true` | When off, channels give only regular videos and live replays and searches only regular videos. |
| `aiFallback` | `true` | Transcribe videos without subtitles with AI (paid plans). |
| `maxAiMinutesPerVideo` | `60` | AI transcribes at most the first N minutes. |
| `skipAiOverMinutes` | `120` | No AI for videos longer than this. |
| `maxConcurrency` | `3` | Videos processed in parallel (1–10). |

### Error codes

The run never crashes because of one bad video or link: it finishes with partial results and explains every failure. Failed items are free.

| `errorCode` | Meaning | What to do |
| --- | --- | --- |
| `TranscriptNotFound` | No subtitles in your `languages` (or none at all and AI was off, not available on your plan, or the video too long). | Add languages, turn on `anyLanguageFallback` or `aiFallback`. |
| `VideoUnavailable` | The video does not exist, was removed, is private or members-only. | Check the link. |
| `AgeRestricted` | YouTube shows the video only to signed-in adults. | Not supported. |
| `IpBlocked` | YouTube blocked the request even after retrying on fresh residential IPs. | Run those links again later. |
| `InvalidUrl` | The line is not a YouTube video, channel, playlist or search link. | Fix the link. |
| `SourceNotFound` | The channel or playlist does not exist or is private. | Check the link. |
| `RequestFailed` | Network, YouTube or AI service error after all retries. | Run again later. |

### FAQ

**What happens with videos that have no subtitles?**
With `aiFallback` on (default) and a paid Apify plan, they are transcribed by AI and charged per minute. Otherwise they come back with `"errorCode": "TranscriptNotFound"` and you are **not charged** for them.

**Do I pay for listing a channel, a playlist or a search?**
No. You pay only for transcripts (and AI minutes, if used).

**Is there a limit on links or videos?**
No fixed limit. Add as many sources as you like and raise `maxVideosPerSource` / `maxVideosPerSearch`; set a maximum cost per run you are comfortable with.

**How do I get only recent videos?**
Set `publishedAfter` to a date (`2026-01-01`) or a period (`30 days`). Channels are read newest first, so listing stops as soon as it reaches older videos.

**Does translation always work?**
Translation is guaranteed on paid Apify plans: when YouTube does not deliver its translation, an AI text model translates the transcript (timestamps unchanged); if that fails too, the original is free. On the free plan you get the original with `isTranslated: false` and a `warning`, charged as a normal transcript.

**Does it need a YouTube account, API key or browser?**
No. It reads public captions with small HTTP requests through Apify proxies.

**Is it legal?**
The Actor reads captions and audio that YouTube serves publicly. You are responsible for how you use the content: respect copyright and YouTube's terms, and do not republish transcripts you have no rights to.

### How it works

The Actor uses the open-source [youtube-transcript-api](https://github.com/jdepoix/youtube-transcript-api) library with a lighter request flow: it skips the 1.4 MB watch page and asks YouTube only for the fields it needs, so a transcript costs a few kilobytes of traffic and a page of 100 channel videos about 9 KB. Requests go through Apify datacenter proxies first; if YouTube blocks them, the Actor retries on a fresh Apify residential IP (up to 3 attempts with increasing waits). For AI transcription it downloads only the minutes it needs of a low-bitrate audio stream (using [yt-dlp](https://github.com/yt-dlp/yt-dlp) to find a downloadable stream for longer videos) and sends it to Whisper on Groq.

### Integrations and API

Run it from your code with the [Apify API](https://docs.apify.com/api/v2) or the client libraries for [Python](https://docs.apify.com/api/client/python) and [JavaScript](https://docs.apify.com/api/client/js), from n8n with the Apify node, or from AI agents through the [Apify MCP server](https://mcp.apify.com) (see [AI agents (MCP) and n8n](#ai-agents-mcp-and-n8n)). Apify lists its other integrations at https://docs.apify.com/platform/integrations.

# Actor input Schema

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

One link per line, in any mix and with no limit on how many. Videos: youtube.com/watch?v=..., youtube.com/shorts/..., youtu.be/..., embed links or bare video IDs. Channels: youtube.com/@handle, youtube.com/channel/UC..., /c/ and /user/ links, or a channel tab (/videos, /shorts, /streams). Playlists: youtube.com/playlist?list=.... A youtube.com/results?search_query=... link works as a search. A video found in several sources is processed once.

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

Optional. Search terms, one per line, e.g. "retrieval augmented generation tutorial". Each search gives up to "Max videos per search" videos in YouTube's relevance order. Only videos published after and Include Shorts apply here too.

## `languages` (type: `array`):

Language codes, most wanted first, for example en, it, de, es, pt-BR. For each video the first language that has a transcript is used; human-made subtitles are preferred over automatic captions in the same language.

## `anyLanguageFallback` (type: `boolean`):

When none of your languages exists for a video, return the first transcript it has (uploader subtitles first) instead of failing with TranscriptNotFound. availableLanguages always lists what the video has.

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

Optional language code, e.g. it, en, es, de, fr, pt, ja. A native track in this language is used when the video has one; otherwise YouTube's automatic translation. Translation is guaranteed on paid Apify plans: if YouTube does not deliver it, an AI text model translates the segments keeping their timestamps (charged as ai-translation per started minute of video), and if even that fails you get the original transcript with a warning, free of charge. On the free plan, when YouTube does not deliver the translation you get the original transcript with a warning, charged as a normal transcript.

## `aiTranslationFallback` (type: `boolean`):

Paid Apify plans: when YouTube does not deliver its automatic translation (it often rate-limits it), translate the transcript with an AI text model on Groq, keeping every timestamp. Charged as ai-translation per started minute of video, only after the translation succeeded and within your maximum cost per run. If the AI translation fails too, the original transcript is free. When you turn this off, the original transcript is delivered with a warning and charged normally.

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

Format of the transcriptText field. The timestamped segments are always in the transcript field. json: one clean plain-text string. text: one caption line per row. markdown: a document with title, channel and paragraphs that link to the moment in the video. llm: clean text in blocks of about 1,000 tokens, each with start and end time (also in the chunks field). srt / vtt: subtitle files.

## `includeMetadata` (type: `boolean`):

Adds title, channel, channelId and durationSeconds to each result. It comes from the same request as the transcript, so it costs nothing extra.

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

How many videos to take from each channel or playlist link (newest first for channels). There is no upper limit: the run never lists more videos than your maximum cost per run can pay for. Single video links are always processed.

## `maxVideosPerSearch` (type: `integer`):

How many videos to take from each search.

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

Optional. Skip channel, playlist and search videos published before this date: a date (YYYY-MM-DD, UTC) or a relative period such as "30 days" or "2 weeks". Single video links are always processed.

## `includeShorts` (type: `boolean`):

When off, channels give only regular videos and live replays, and searches only regular videos. A /shorts channel tab link always gives Shorts. Playlists are taken as they are.

## `aiFallback` (type: `boolean`):

For videos that have no subtitles at all, download the audio and transcribe it with Whisper (whisper-large-v3-turbo on Groq). Charged per started minute of audio, only after the transcription succeeded and within your maximum cost per run (the budget is set aside before the download); nothing is charged if the download or the transcription fails. Available on paid Apify plans.

## `maxAiMinutesPerVideo` (type: `integer`):

Transcribe at most the first N minutes of each video with AI (you pay only for the minutes transcribed).

## `skipAiOverMinutes` (type: `integer`):

Videos without subtitles longer than this are not transcribed by AI at all (they fail with TranscriptNotFound and cost nothing).

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

How many videos are fetched at the same time. Higher is faster; lower is gentler on YouTube.

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

One YouTube link: video, Shorts, youtu.be, channel or playlist. It is enough on its own to start a run, e.g. {"url": "https://www.youtube.com/watch?v=UF8uR6Z6KLc"}: every other setting keeps its default (English transcript, outputFormat json, title and channel included; on paid plans, videos without any subtitles are transcribed by AI, charged per minute: turn off aiFallback to avoid it). When YouTube URLs are filled in too, this link is processed first, together with them.

## `compact` (type: `boolean`):

Each result has only url, videoId, title, language, transcriptText, status, errorCode, errorMessage and warning (plus the timestamped segments when Include segments is on). Fewer tokens for AI agents and fewer fields to map in workflows. Off: the full result with all 24 fields.

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

Compact output only: also return the timestamped segments in the transcript field (text, start and duration in seconds). The full output always includes them.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=UF8uR6Z6KLc"
  ],
  "languages": [
    "en"
  ],
  "anyLanguageFallback": false,
  "aiTranslationFallback": true,
  "outputFormat": "json",
  "includeMetadata": true,
  "maxVideosPerSource": 20,
  "maxVideosPerSearch": 20,
  "includeShorts": true,
  "aiFallback": true,
  "maxAiMinutesPerVideo": 60,
  "skipAiOverMinutes": 120,
  "maxConcurrency": 3,
  "compact": false,
  "includeSegments": false
}
```

# Actor output Schema

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

One item per video: transcript segments, transcript text, metadata, status and error code.

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

Success rate, errors by type and proxy traffic of the run.

# 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=UF8uR6Z6KLc"
    ]
};

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

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

```

## MCP server setup

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