# YouTube Transcript Scraper: Channels & Playlists (`datarelay/youtube-transcript-api`) Actor

Collect existing YouTube captions as JSON, SRT or VTT from videos, channels and playlists. Sync new videos and fetch fresh metadata. Result fees plus Apify usage.

- **URL**: https://apify.com/datarelay/youtube-transcript-api.md
- **Developed by:** [DataRelay](https://apify.com/datarelay) (community)
- **Categories:** Videos, Developer tools
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 2 total users, 1 monthly users, 98.1% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.99 / 1,000 combined video and captions

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

Collect the captions YouTube already provides, from individual videos, channels or playlists. Export text, timed JSON, SRT and VTT, and fetch video metadata during the run.

Start with one video, build a playlist archive, or schedule a channel import that skips completed videos with `onlyNew`. Multiple output formats reuse the same fetched captions. Ready-made examples: [captions as JSON, SRT and VTT](https://apify.com/datarelay/youtube-transcript-json-srt-vtt), [transcripts from a channel](https://apify.com/datarelay/youtube-channel-transcripts), [transcripts from a playlist](https://apify.com/datarelay/youtube-playlist-transcripts).

Pricing is result fees plus Apify usage. A recorded one-video captions-and-metadata run used about $0.00192 in resources; adding the $0.00199 package fee gives about $0.00391 for that case. Costs vary with input, proxy traffic and retries. This is an example, not a fixed total price – see [measured examples](#measured-examples-fee--usage).

This Actor reads captions already provided by YouTube: creator-written or YouTube-generated. It does not recognize speech from audio, generate summaries or analyze video images. A video without usable captions does not become a successful transcript.

### Try one video first

1. Open the Input tab and choose JSON.
2. Paste the example below. It requests one English caption track and the video's current metadata.
3. Keep the small limits while checking the result. On Apify, omitted proxy input uses US residential proxy. The example explicitly selects that same configuration. Direct access can be chosen with useApifyProxy: false, but was blocked in our private platform checks. The Actor does not silently fall back to direct access if your selected proxy is unavailable. Local runs with omitted proxy input stay direct.
4. Start the Actor and inspect the Transcript text, SRT and WebVTT, or Fresh video statistics output view.
5. Download the Dataset as JSON, CSV or Excel. The run's key-value store contains an OUTPUT summary.

```json
{
    "startUrls": ["https://www.youtube.com/watch?v=Ks-_Mh1QhMc"],
    "mode": "combined",
    "languages": ["en"],
    "formats": ["text", "json", "srt", "vtt"],
    "maxVideos": 1,
    "maxConcurrency": 1,
    "maxRunSecs": 120,
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US"
    }
}
```

The source video and its available tracks can change. An explicit error or unavailable status is part of the output contract; it is not a transcript.

### Choose what to collect

| Mode       | Successful result                                                                                  |
| ---------- | -------------------------------------------------------------------------------------------------- |
| combined   | Metadata and one caption transcript per delivered language                                         |
| transcript | Existing captions in the requested formats                                                         |
| metadata   | Fresh video title, channel, duration, views, dates, thumbnails and likes when YouTube returns them |
| tracks     | Caption languages and whether each track is manual, automatic and translatable                     |
| list       | Discovered video IDs and canonical URLs, without transcript text                                   |

Metadata is fetched during the run. `metadata.fetchedAt` and `transcript.fetchedAt` record separate retrieval times. Missing source fields stay absent rather than being replaced with invented zeros.

Inputs accept video IDs and standard watch, Shorts, short-link, live and embed URLs. Channel handles/URLs and canonical `/playlist?list=...` URLs expand into videos. A watch URL containing `list=` still selects that single video. Use `searchQueries` for keywords; a YouTube search-results URL is not supported.

### Example output

This is a projection of **recorded metadata for the quick-start video**, fetched during a private run on **2026-10-29**. It is not today's data or evidence of a new-release test. Counters and timestamps are omitted from this shortened illustration; the prepared sample files retain recorded values and provenance.

```json
{
    "type": "video",
    "videoId": "Ks-_Mh1QhMc",
    "status": "ok",
    "metadata": {
        "videoId": "Ks-_Mh1QhMc",
        "title": "Your Body Language May Shape Who You Are | Amy Cuddy | TED",
        "channelName": "TED"
    }
}
```

A combined row also includes a transcript with `languageCode`, `originalLanguageCode`, `isGenerated`, `isTranslated`, `fetchedAt` and requested formats:

| Field               | Contents                                                   |
| ------------------- | ---------------------------------------------------------- |
| transcript.text     | Caption text as one string                                 |
| transcript.segments | Objects with text, start and duration; times in seconds    |
| transcript.srt      | A SubRip subtitle string when requested                    |
| transcript.vtt      | A WebVTT subtitle string when requested                    |
| status / errorCode  | Delivery status and a safe reason when data is unavailable |

Each language is a separate row. Comments and downloads use `comment`, `audio_file` and `video_file` rows. A failed additional language produces a `transcript_error`; it does not erase a successful original transcript.

### Languages and subtitle formats

`languages` is an ordered list. Within a language, `preferManual` controls preference; it is not a strict manual-only or automatic-only filter. `allowLanguageFallback: false` prevents silently returning an unrelated language. Enable it to accept another available track.

`captionType` is `any` by default. Choose `manual` or `generated` to strictly filter native tracks; the other type is never substituted. `CAPTION_TYPE_UNAVAILABLE` with `no_captions` means the requested type is absent, not necessarily that every type is absent. In manual mode, translated targets must have a native manual track: YouTube machine translation is not used as a substitute, and an unavailable optional target leaves the original intact. Generated mode may explicitly translate its generated source through YouTube and keeps `isGenerated`/`isTranslated` separate.

`allLanguages` requests one eligible preferred track per language; `maxTracks` bounds the work. JSON, text, SRT and VTT for one language come from the same segments and do not count as four transcripts.

`translateTo` uses a native target-language track first, otherwise YouTube's translation facility. **Forced translation returned HTTP 403/429 in our checks and is not guaranteed.** A native Polish track is not evidence that machine translation worked. We do not provide a separate AI translation service.

Before a forced translation request, the Actor waits until 60 seconds have elapsed since caption-track extraction. Original and native target requests do not wait. Each language is saved and charged as soon as its requested output is ready. The original is available in the Dataset while the run is still running and waiting for a translated target. To benefit, read Dataset items before run completion; an integration that waits for completion will still wait for the remaining languages. A later target failure adds a separate `transcript_error` row and does not rewrite the already-delivered original. Read those rows and the final `OUTPUT` for the complete request outcome; the original row describes its own delivered language. If the remaining run budget cannot cover this wait and a 20-second request allowance, the target reports `TRANSLATION_TIME_LIMIT`; the original is retained and the missing target has no result fee. This preventive wait adds runtime usage and does not guarantee access. A blocked target is not retried on the same session.

Forced YouTube translation is best effort. Earlier checks on 2026-11-06 returned `IP_BLOCKED` for the target while retaining the original. One isolated validation with the preventive wait then delivered 535 English automatic segments and 523 genuinely translated Polish segments, with both caption requests returning HTTP 200. That run took about 72 seconds; one successful video does not establish reliability across other videos or sessions. A native second-language track is separate from this translation path. Inspect `transcript_error` rows; an undelivered target has no result fee. No separate AI translation fallback is provided.

### Download subtitle files and work with transcript text

`saveSubtitleFiles: ["txt", "srt", "vtt"]` saves requested files in the run's key-value store and returns `transcript.files` with links, format, content type and byte count. Inline `formats` and downloadable formats are independent. Normal storage/transfer usage and retention apply. `maxSubtitleFileMb` bounds each file (default 5 MiB). File errors are listed in `transcript.fileErrors`; the valid original stays available with `partial: true`.

`includeChunks` adds overlapping passages in `transcript.chunks`. Configure `chunkSizeChars` (default 2000), `chunkOverlapChars` (200) and `maxChunksPerTranscript` (200). These are character limits, not tokens or AI-generated summaries.

`searchPhrases` adds actual quotes, context and video jump links in `transcript.phraseMatches`. It finds literal phrases in the fetched captions, including across segments. Defaults ignore letter case and return up to 100 matches across all phrases. Use `phraseCaseSensitive`, `maxPhraseMatches` and `phraseContextChars` to adjust that. No matches is a valid result; the delivered transcript remains its normal result unit.

```json
{
    "startUrls": ["Ks-_Mh1QhMc"],
    "mode": "transcript",
    "captionType": "manual",
    "languages": ["en"],
    "saveSubtitleFiles": ["txt", "srt", "vtt"],
    "includeChunks": true,
    "chunkSizeChars": 2000,
    "chunkOverlapChars": 200,
    "maxChunksPerTranscript": 20,
    "searchPhrases": ["body language", "confidence"],
    "maxPhraseMatches": 10,
    "maxVideos": 1,
    "maxConcurrency": 1,
    "maxRunSecs": 120
}
```

Each passage/hit gives original text, source segment indices, start/end seconds and a timestamp link. Timing covers the containing caption segments, not exact words. Offsets and character budgets use UTF-16 units; complete surrogate pairs are preserved. `chunking`/`phraseSearch` state returned counts and explicit truncation reasons. Analysis reads at most the first 2 million character units/100,000 segments and caps each derived array at 512 KiB; the original transcript is retained. Phrase count, match count, context, run time and output limits also apply.

These options reuse fetched captions. They make no additional YouTube call and introduce no per-file/per-chunk/per-hit result event. Processing, KVS writes/URL generation and transfer can still cost platform usage. Only transcript/combined modes enable files/tools; tracks also supports strict type filtering.

### Discovery, filters and limits

Choose channel videos, Shorts or streams with `channelTabs`. Playlist and search discovery follows continuation pages up to `maxPagesPerSource`. `sort` applies to keyword searches; it does not change channel ordering. Channel discovery returns videos, not a complete channel profile.

Date, duration and minimum-view filters use fetched metadata. **maxVideos counts unique attempted videos, including failures and filtered videos.** Ten attempts need not yield ten matching transcripts. Page, scan, time and charge limits can stop work earlier; OUTPUT lists stop reasons.

Short-video URLs are accepted. Bounded platform checks returned five Shorts on the first page and 60 unique Shorts over two pages from one channel. This does not guarantee coverage of every channel or an unlimited export. Not every Short or live-stream replay has captions; ongoing live transcription is not supported.

### Collect only new videos

Set `onlyNew: true` and keep the same `syncKey` to skip completed videos on later runs. The first run delivers results; a later run may correctly return no rows. Use a new key or `resetSync: true` when changing sources, languages, formats or filters.

Successful optional files/tools have completion markers. If a file write or processing step fails after the original was charged, a later compatible sync can emit an uncharged `subtitle_files` or `transcript_analysis` follow-up with the same `transcript.*` field paths. Source/storage work may repeat; the original transcript unit is not charged twice. Changing enabled feature options needs a new key or reset; disabled defaults preserve existing checkpoints.

Run only one job per key at a time. Synchronization remembers completed units, not a pagination cursor. Discovery restarts from the source, so large channels need sufficient page/scan limits. Missing videos are not automatically reported as deleted.

#### Schedule a channel archive

A simple pipeline without extra services:

1. Save a task with the channel URL in `startUrls`, `onlyNew: true` and a fixed `syncKey` (for example the channel handle). Keep `maxVideos` and the page/scan limits large enough for the channel.
2. In Apify Console, add a **Schedule** for the task (for example daily). Each run delivers only videos not completed before; an empty run is a valid result.
3. Read the new rows from the run's Dataset (`GET /v2/actor-tasks/<taskId>/runs/last/dataset/items`) and the run summary from its key-value store record `OUTPUT`.
4. Store them in your own database or bucket, for example from a script that runs after the schedule or from an Apify webhook on `ACTOR.RUN.SUCCEEDED`.

This is a recommended setup, not a tested integration with a specific storage service. Results stay in Apify storage only for its retention period.

### Example tasks

The example workflows below use bounded task presets. Public presets appear in the Example tasks tab. Their source videos are examples, and each source can change. Result fees and variable Apify usage apply, including usage on empty/failed work.

| Task                                             | Purpose                                          |
| ------------------------------------------------ | ------------------------------------------------ |
| Get YouTube captions as JSON, SRT and VTT        | One video, inline formats and subtitle files     |
| Get fresh YouTube views, likes and publish dates | A small metadata-only batch                      |
| Collect transcripts from a YouTube channel       | Up to five attempted channel videos              |
| Export transcripts from a YouTube playlist       | Up to five attempted playlist videos             |
| Find YouTube video links by keyword              | Search IDs and links without captions            |
| Collect only new videos from a YouTube channel   | Repeat runs that skip completed results          |
| Download existing Polish YouTube captions        | A native Polish track, without translation       |
| List available YouTube caption languages         | Track discovery before language selection        |
| Export captions from a four-hour YouTube course  | Existing captions, without downloading audio     |
| Find recent short YouTube tutorials              | Date and duration filters on newest-first search |

### Optional comments and media

`includeExtraMetadata` retrieves available chapters, format descriptions and additional public counters through yt-dlp. `maxComments` requests bounded comments and optional replies. Author identity is excluded unless `includeCommentAuthors` is enabled. Downloader failures distinguish `YTDLP_BOT_CHECK`, `YTDLP_AGE_RESTRICTED` and `YTDLP_AUTH_REQUIRED` when the source message identifies the restriction. These codes report an observed restriction, not a guarantee that authentication will resolve it. Raw source diagnostics are never returned.

`downloadAudio` and `downloadVideo` store bounded media files in the run's key-value store and return links. Rejected media reports its `section` and a specific `errorCode`, such as `MEDIA_DURATION_LIMIT`, `MEDIA_SIZE_LIMIT`, `MEDIA_FORMAT_UNAVAILABLE` or `YTDLP_ACCESS_DENIED`. The valid core result is retained; an undelivered file has no file result fee. Raw downloader diagnostics and proxy credentials are never returned. Set size, duration and resolution limits; live streams are excluded. These modules are separate from caption collection. Configured result fees are listed below; actual customer billing and cost limits still require verification. The example tasks do not enable these modules.

### Experimental native-video routing

`proxyRouting: "auto"` is an opt-in route for native video requests. It uses datacenter transport for page/caption requests and residential transport for the player request. One retryable failure can use a fresh all-residential attempt for that video, shared with filtering. Empty/unavailable answers do not trigger recovery. Source failures may remain after recovery. The default is `single`; both attempts can incur usage.

To select automatic routing, omit `proxyConfiguration` entirely (including the Console's prefilled residential object):

```json
{
    "startUrls": ["Ks-_Mh1QhMc"],
    "mode": "combined",
    "languages": ["en"],
    "proxyRouting": "auto",
    "maxVideos": 1,
    "maxConcurrency": 1,
    "maxRunSecs": 120
}
```

Any explicit proxy configuration, including direct/custom proxies, groups, country or an empty object, keeps the selected single transport. Local runs, list mode and requests with `translateTo` also keep their existing transport. Discovery, comments and media continue using the selected proxy. There is no direct fallback when proxy access fails. `OUTPUT.routing` reports the effective strategy/reason and recovery counters; platform usage can be incurred by both attempts even if no result fee is assigned.

Small tests found workload-dependent savings, with recovery sometimes needed. They do not establish a universal cost reduction or production success rate. Compare your actual run usage and output before enabling auto on a larger workload.

### Pricing and result units

**Pricing is pay per event + actual Apify platform usage.** Check the current Pricing tab before starting a run. The table below lists result fees, rather than an all-in price.

**The prices below are result fees. Compute, residential proxy traffic, storage and other Apify usage are additional. Usage can be charged even when the run delivers no useful results.**

| Result                        |                          Service fee |
| ----------------------------- | -----------------------------------: |
| Captions + fresh metadata     | $1.99 / 1,000 video-language results |
| Captions only                 | $0.99 / 1,000 video-language results |
| Video metadata                |                 $0.49 / 1,000 videos |
| Available caption tracks      |                 $0.49 / 1,000 videos |
| Discovery IDs and URLs        |         $0.19 / 1,000 unique results |
| Optional extended metadata    |       +$0.99 / 1,000 enriched videos |
| Optional comments and replies |              +$0.49 / 1,000 comments |
| Optional audio                |           +$0.00099 / delivered file |
| Optional video                |           +$0.00199 / delivered file |

The configured service fees are the same across discount tiers. Actual platform usage is variable. One observed long-caption combined run would total approximately $0.00470 including the configured result fee and measured usage; this is an illustration, not a price cap or a live customer invoice.

#### Measured examples (fee + usage)

Recorded owner runs on the BRONZE tier ($8/GB residential proxy, $0.20/compute unit), projected with the current result fees. They show how a total is made up; they are not price caps, quotes or customer invoices.

| Scenario                                      | Build | Result fees | Apify usage |    Total |
| --------------------------------------------- | ----- | ----------: | ----------: | -------: |
| One video: captions (428 segments) + metadata | 0.9.6 |    $0.00199 |    $0.00192 | $0.00391 |
| 20 videos, metadata only, one run             | 0.90  |    $0.00980 |    $0.00211 | $0.01191 |
| One video: metadata + extended + 100 comments | 0.9.5 |    $0.05048 |    $0.01122 | $0.06170 |

Usage depends on the input, video length, proxy traffic and retries. Batching several videos in one run spreads the fixed part of the usage.

Several formats of one language do not multiply the result unit. Each additional delivered language is a full unit for the selected mode. Combined needs both captions and basic metadata; it does not add a separate metadata event or automatically bill an unsuccessful package as metadata instead.

The code assigns no result event to an error row, a filtered video or a completed synchronization unit. Their underlying platform usage may still cost money. A delivered original remains a unit when an extra translation fails; the failed target has no result fee. Comments, extra metadata and audio/video downloads use separate units. Subtitle files, chunks and phrase matches do not add result units. No synthetic start or automatic Dataset-item fee is configured.

Start with a small workload and a spending limit that leaves room for platform usage; inspect the output and charges before increasing it. The event preflight does not reserve CPU, proxy or storage costs. A very small total limit can cause Apify to abort a run before comments or other optional operations finish, even when their result fee alone would fit. Results already saved remain in the Dataset. No AI-provider fee or speech-to-text service is included.

### Use the API

Send the same input through the Apify API. This command starts a run and may consume credits. Keep your token in an environment variable rather than a shared URL.

```bash
curl --request POST \
  --url 'https://api.apify.com/v2/acts/datarelay~youtube-transcript-api/run-sync-get-dataset-items?timeout=120&format=json' \
  --header "Authorization: Bearer $APIFY_TOKEN" \
  --header 'Content-Type: application/json' \
  --data '{"startUrls":["Ks-_Mh1QhMc"],"mode":"combined","languages":["en"],"maxVideos":1,"maxRunSecs":90,"proxyConfiguration":{"useApifyProxy":true,"apifyProxyGroups":["RESIDENTIAL"],"apifyProxyCountry":"US"}}'
```

For longer work, start an asynchronous run and read its Dataset during execution to receive completed languages early. Read the final OUTPUT and any error rows after completion to check the whole request. Apify provides schedules, webhooks, API access and integrations such as Make and n8n; those are platform features.

### FAQ and support

**Does it create captions for a video without them?** No. It does not run speech-to-text or require an AI-provider key. Use metadata or tracks to inspect available data.

**Why no_captions or language_unavailable?** Captions may not exist, may still be processing, or may not exist in the requested language. Inspect the available tracks and fallback settings.

**Why was a public video blocked?** YouTube can reject an automated request or IP. Public availability in a browser does not guarantee automated access. Check the proxy input and safe error code. Retryable failures request fresh proxy identities when IP rotation is available.

**Can an unsuccessful run cost money?** Under the configured event + usage model, yes. No result fee is assigned to missing data, but requests, proxy traffic, processing and storage can still incur Apify usage charges. An empty scheduled synchronization can also have usage costs.

**Why is a repeated sync run empty?** Scanned videos may already be complete. Inspect skipped counts and stop reasons; change the key when changing the job.

**Does it provide private analytics?** No private/member-only access, login bypass, dislikes or private channel analytics. Optional public fields appear only when the source supplies them.

**Can I republish the content?** A public URL does not grant reuse rights. Process content you are entitled to use and follow the source's terms.

**How do I report a problem?** Open an issue on the Actor's Apify page. Include the run ID, expected result, safe error code and minimal input, with credentials and private information removed. No uptime or response-time guarantee is offered.

### HTTP and MCP access

This Actor also declares a single-tenant server interface, using the same input, source engine and result prices as batch runs. For large jobs, use batch.

- **Apify MCP:** configure `https://mcp.apify.com/?tools=datarelay/youtube-transcript-api` with your Apify bearer token. This starts ordinary Actor runs.
- **DataRelay MCP:** copy this Actor's server URL from Apify Console and append `/mcp`; authenticate with the same bearer token.
- **HTTP:** POST JSON input to `<SERVER_URL>/v1/run`. `<SERVER_URL>/openapi.json` lists the domain shortcuts.

Each server run belongs to your account. Default idle timeout: 60 seconds. You pay platform usage, including startup/idle time, plus existing event fees. Discovery and health checks produce no data events, but can start a billed run. A warm run charges its start event at most once on its first paid result.

Responses include a preview (first 100 rows / 1 MB), `resultCount`, `previewLimited`, `interrupted`, and links to this request's complete Dataset slice and summary. Use batch for work exceeding the 120-second soft deadline. Check `outcome`, summaries and result statuses; source limitations remain unchanged. Use the stable Actor-level server URL for clients. The server becomes available when this build is deployed and its server settings are enabled.

# Actor input Schema

## `startUrls` (type: `array`):

Public video IDs/URLs, channel URLs or playlist URLs. Strings or objects with a url field.

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

Search phrases. Each query is paginated up to the configured limit.

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

Preferred caption languages in priority order.

## `translateTo` (type: `array`):

Additional target languages for native captions or YouTube translations. Each delivered language is a separate paid result.

## `formats` (type: `array`):

Output representations. Formats do not multiply paid rows.

## `channelTabs` (type: `array`):

Channel tabs to crawl, including Shorts and streams.

## `preferManual` (type: `boolean`):

Prefer manually uploaded captions within the selected language.

## `allowLanguageFallback` (type: `boolean`):

Allow a different available language if none of the requested languages exist.

## `allLanguages` (type: `boolean`):

Fetch one track per available language, up to maxTracks. Each delivered language is billed.

## `onlyNew` (type: `boolean`):

Remember completed results for subsequent runs with the same syncKey. Use one run per syncKey at a time.

## `resetSync` (type: `boolean`):

Clear the saved completed-result history for this syncKey.

## `includeExtraMetadata` (type: `boolean`):

Fetch chapters, formats, comment count, subscriber count and other public fields with yt-dlp.

## `includeReplies` (type: `boolean`):

Include comment replies within the overall maxComments limit.

## `includeCommentAuthors` (type: `boolean`):

Include public author identity fields in comment output.

## `downloadAudio` (type: `boolean`):

Download and store an audio file. Separately billed; uses transfer and storage.

## `downloadVideo` (type: `boolean`):

Download and store a video file. Separately billed; uses transfer and storage.

## `maxTracks` (type: `integer`):

Maximum original/translated caption tracks per video. Too many tracks produces an explicit limit error.

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

Maximum unique videos attempted in this run, including unavailable and filtered videos.

## `maxScannedVideos` (type: `integer`):

Maximum unique discovered IDs scanned, including already completed videos.

## `maxPagesPerSource` (type: `integer`):

Maximum pages per search, playlist or channel tab. Increase for larger channels.

## `maxRunSecs` (type: `integer`):

Soft run time budget in seconds.

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

Concurrent video jobs. Media downloads can require more memory.

## `minDurationSeconds` (type: `number`):

Minimum duration; checked against fresh metadata.

## `maxDurationSeconds` (type: `number`):

Maximum duration; checked against fresh metadata.

## `minViews` (type: `integer`):

Minimum public view count; checked against fresh metadata.

## `maxComments` (type: `integer`):

Maximum total comments and replies per video. Zero disables comments. Each comment is a separate paid row.

## `videoHeight` (type: `integer`):

Maximum downloaded video height.

## `maxMediaMb` (type: `integer`):

Maximum stored media file size in MiB. Actual download traffic can be higher when streams are merged.

## `maxMediaDurationSeconds` (type: `integer`):

Maximum duration for media downloads. Live streams are excluded.

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

Choose metadata, captions, a combined package, track discovery or a video-ID list.

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

YouTube interface language.

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

YouTube content region, not a guaranteed proxy exit country.

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

YouTube search sorting. Channel videos use the selected tab default order.

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

Only videos published on or after this ISO date/time.

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

Only videos published on or before this ISO date/time. A date without a time means midnight UTC.

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

Saved-state name. Changing selection requires another key or resetSync.

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

Comment sort order.

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

On Apify, omitted proxy input uses US residential proxy. Explicit direct access or custom proxy settings override this default. No automatic fallback to direct access if the selected proxy is unavailable. Local omitted input stays direct.

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

single keeps the selected proxy for every request. Experimental auto uses datacenter for native-video pages/captions and residential for player API, with at most one fresh-residential recovery per video. Only on Apify with proxyConfiguration omitted and no translateTo. Explicit proxy settings, local runs and list mode keep single routing. Leave single until validating auto for your workload.

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

Strictly allow any, manual or YouTube-generated native captions. Unlike preferManual, manual/generated never substitute the other type. Manual also requires native manual translation targets.

## `saveSubtitleFiles` (type: `array`):

Optional TXT, SRT and WebVTT files in the run key-value store. Reuses fetched captions; no extra result fee per format. Normal storage/transfer usage and retention apply.

## `includeChunks` (type: `boolean`):

Create bounded overlapping character-based passages with original text and segment timestamps. No AI or tokenizer.

## `searchPhrases` (type: `array`):

Up to 50 literal phrases, each up to 200 characters. Searches these fetched transcripts, including across segments; returns exact quotes and segment timestamps.

## `phraseCaseSensitive` (type: `boolean`):

Require matching letter case. Phrases remain literal; whitespace can span segments.

## `maxSubtitleFileMb` (type: `integer`):

Maximum size of each subtitle file. Oversize/write failures preserve the transcript with explicit file errors.

## `chunkSizeChars` (type: `integer`):

Target maximum characters per chunk; not tokens. Segment timestamps are retained; output also has a fixed byte cap.

## `chunkOverlapChars` (type: `integer`):

Overlap between neighboring chunks. Must be smaller than chunkSizeChars.

## `maxChunksPerTranscript` (type: `integer`):

Returned chunks per language. Truncation and its reason are explicit.

## `maxPhraseMatches` (type: `integer`):

Combined match limit across all phrases, returned in source order.

## `phraseContextChars` (type: `integer`):

Characters before and after each actual quote; segment-level timing is not word alignment.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "searchQueries": [],
  "languages": [
    "en"
  ],
  "translateTo": [],
  "formats": [
    "text",
    "json"
  ],
  "channelTabs": [
    "videos"
  ],
  "preferManual": true,
  "allowLanguageFallback": false,
  "allLanguages": false,
  "onlyNew": false,
  "resetSync": false,
  "includeExtraMetadata": false,
  "includeReplies": true,
  "includeCommentAuthors": false,
  "downloadAudio": false,
  "downloadVideo": false,
  "maxTracks": 20,
  "maxVideos": 100,
  "maxScannedVideos": 1000,
  "maxPagesPerSource": 20,
  "maxRunSecs": 1800,
  "maxConcurrency": 3,
  "maxComments": 0,
  "videoHeight": 720,
  "maxMediaMb": 100,
  "maxMediaDurationSeconds": 3600,
  "mode": "combined",
  "language": "en",
  "country": "US",
  "sort": "relevance",
  "syncKey": "default",
  "commentsSort": "new",
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  },
  "proxyRouting": "single",
  "captionType": "any",
  "saveSubtitleFiles": [],
  "includeChunks": false,
  "searchPhrases": [],
  "phraseCaseSensitive": false,
  "maxSubtitleFileMb": 5,
  "chunkSizeChars": 2000,
  "chunkOverlapChars": 200,
  "maxChunksPerTranscript": 200,
  "maxPhraseMatches": 100,
  "phraseContextChars": 80
}
```

# Actor output Schema

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

No description

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

No description

# 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 = {
    "startUrls": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ],
        "apifyProxyCountry": "US"
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("datarelay/youtube-transcript-api").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 = {
    "startUrls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
        "apifyProxyCountry": "US",
    },
}

# Run the Actor and wait for it to finish
run = client.actor("datarelay/youtube-transcript-api").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 '{
  "startUrls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}' |
apify call datarelay/youtube-transcript-api --silent --output-dataset

```

## MCP server setup

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

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/qLQf6DJ0ipR1gvEBi/builds/2wwb3I1puernum1cI/openapi.json
