# YouTube Transcript Scraper (`accommodating_aptitude/youtube-transcript`) Actor

Pulls the subtitle/transcript text of YouTube videos with timestamped segments: video title, channel, language, full text and available subtitle languages. No API key needed; a robots.txt-compliant metadata mode that only lists subtitle languages is also available.

- **URL**: https://apify.com/accommodating_aptitude/youtube-transcript.md
- **Developed by:** [Korhan Coşan Ergün](https://apify.com/accommodating_aptitude) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$3.00 / 1,000 transcript founds

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/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## YouTube Transcript Scraper

Pulls the subtitle/transcript text of YouTube videos with timestamped segments.
**No API key required.**

### Output fields

| Field | Description |
|---|---|
| `video_id`, `title`, `link` | Video id, title and link |
| `channel_name`, `channel_url`, `thumbnail_url` | Channel and cover image (official oEmbed) |
| `language`, `language_name`, `is_generated` | Transcript language and whether it was auto-generated |
| `transcript_text` | The joined full text |
| `transcript_char_count`, `segment_count`, `transcript_duration_seconds` | Volume/length metrics |
| `segments[]` | `{start, duration, text}` — timestamped segments |
| `available_languages[]` | All subtitle languages available on the video |
| `error` | Error for this video (if any), otherwise `null` |

### Input

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "mode": "transcript",
  "acknowledgeUnofficialSource": true,
  "languages": ["en"],
  "includeSegments": true,
  "maxVideos": 25
}
```

`videoUrls` accepts a full URL (watch / youtu.be / shorts / embed / live) or an
11-character video ID.

### Two modes and WHY — do not skip this

According to
[the documentation](https://developers.google.com/youtube/v3/docs/captions/download),
the `captions.list` / `captions.download` methods of YouTube Data API v3 require
**OAuth 2.0 + ownership of the video**; with an API key you **cannot** download a
third-party video's transcript through the official route (it is always 403). In
other words, there is no such option as "transcripts via the official API".

The only route that works is the `youtube.com/api/timedtext` endpoint used by the
YouTube player. However, `https://www.youtube.com/robots.txt` contains:

```
User-agent: *
Disallow: /api/
Disallow: /youtubei/
```

So the transcript download path is closed to generic bots by robots.txt, while
`/watch` is open. That is why the actor runs in two modes:

- **`mode: "metadata"`** — **fully compliant** with robots.txt. It only lists the
  available subtitle languages and the video metadata from the `/watch` page. It
  does not call `/api/`. It does not return the full text.
- **`mode: "transcript"`** (default) — full text + timestamped segments. It uses
  `/api/timedtext`. It **does not run** unless
  `acknowledgeUnofficialSource: true` is given: by ticking that box you declare
  (a) that the unofficial endpoint will be used, and (b) that you have the right
  to access the subtitles in question (your own channel, a licence, fair
  use/research).

Transcript fetching is done with the
[`youtube-transcript-api`](https://github.com/jdepoix/youtube-transcript-api)
library (MIT), which continuously patches these breakages — raw `timedtext`
calls now return an empty body.

### Proxy — turn this on

YouTube frequently blocks the datacenter IPs that Apify also uses
(`RequestBlocked`). **In a real platform test (10 November 2026), 1 of 2 videos
was blocked when running without a proxy.** Therefore:

- **Turn on Apify Proxy** via `proxyConfiguration`, preferably with the
  `RESIDENTIAL` group. The actor requests a new IP (session) for every video and
  retries **3 times** with a new IP when it is blocked.
- Alternatively you can supply your own proxy with `proxyUrl`; when filled in, it
  overrides the Apify Proxy setting.

Blocked videos are still written to the dataset (with the `error` field filled in
and `transcript_text` empty) and are **not charged**.

### Pricing

Pay-per-event: **`transcript-found` → $0.003**. You are only charged when a
transcript or subtitle language is actually found; failed videos and videos
without subtitles are free.

### Local test

```bash
bash ../_common/vendor_common.sh .      # vendor apify_common
APIFY_LOCAL=1 python3 main.py           # check storage/local_run_summary.json
```

`sample_output.json` was produced from **a real live run** (10 November 2026).

# Actor input Schema

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

The YouTube videos whose transcripts should be pulled. A full URL (watch, youtu.be, shorts, embed) or an 11-character video ID is accepted.

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

metadata = lists only the available subtitle languages and the video metadata (fully compliant with YouTube's robots.txt, uses the /watch page). transcript = pulls the full subtitle text (the unofficial /api/timedtext endpoint; robots.txt closes that path to generic bots).

## `acknowledgeUnofficialSource` (type: `boolean`):

MANDATORY for mode='transcript'. The captions.download method of YouTube Data API v3 only works with the OAuth authorization of the video OWNER, so there is no official transcript route for third-party videos. By ticking this box you declare (a) that the unofficial timedtext endpoint will be used, and (b) that you have the right to access the subtitles in question (your own channel, a licence, fair use/research).

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

Language codes in order of preference (e.g. en, tr, de). The first language found is used.

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

When disabled, only the joined full text is returned (a smaller dataset).

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

Maximum number of videos to process in a single run.

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

YouTube frequently blocks the datacenter IPs that Apify also uses (RequestBlocked). In a real platform test, 1 of 2 videos was blocked when running without a proxy. Turning on Apify Proxy with the RESIDENTIAL group is strongly recommended; the actor requests a new IP for every video and retries 3 times when blocked.

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

If you want to use your own proxy instead of Apify Proxy (e.g. http://user:\*\*\*@host:port). When filled in, it overrides the Apify Proxy setting above.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "mode": "metadata",
  "acknowledgeUnofficialSource": false,
  "languages": [
    "en"
  ],
  "includeSegments": true,
  "maxVideos": 25,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

Dataset containing all records found in this 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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("accommodating_aptitude/youtube-transcript").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("accommodating_aptitude/youtube-transcript").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call accommodating_aptitude/youtube-transcript --silent --output-dataset

```

## MCP server setup

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

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/30LSfDSnZraXlfayi/builds/lYxtoktdgBv7xSGIA/openapi.json
