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

Get the transcript of any YouTube video, playlist, channel or search result as JSON. Timestamps, SRT, translation and RAG chunks. No API key. $3 per 1,000 transcripts.

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

## Pricing

from $3.00 / 1,000 transcript delivereds

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

Paste YouTube links, get the transcripts back as JSON. It takes single videos, playlists, channels, @handles and search queries. You don't need a YouTube API key, a login or a browser.

It reads the captions YouTube already has, either the ones the creator uploaded or the auto-generated ones. It does not listen to the audio. A video with no captions comes back as an error row, and error rows are free.

### What you get for each video

- Title, channel name and ID, publish date, length, view count, category
- The transcript as one string, plus its word count
- The caption language, and whether it is `manual`, `auto` or `translated`
- Every other caption language the video has
- Optional: timestamped lines, the same thing as SRT text, and fixed-length chunks (each with a link that opens the video at that second, which is handy for RAG)

### Input

| Field | What it does |
|---|---|
| Videos, playlists or channels | Video links (watch, youtu.be, shorts, live), playlist links, channel links, `@handles`, or a bare 11-character video ID. You can mix them. |
| YouTube search queries | Each query is searched on YouTube and the top results are transcribed. |
| Max videos per playlist, channel or search | Default 5, up to 200. Channels are read newest first. Single video links are always included. |
| Language | Caption language code such as `en`, `es`, `de`, `ja`, `zh-Hans`. Uploaded captions win over auto-generated ones. |
| If the video has no captions in that language | `original` returns the spoken language, `translate` asks YouTube to machine-translate, `skip` returns an error row and charges nothing. |
| Timestamped segments / SRT / chunk seconds | Optional extra fields. Chunk seconds of 60 gives one chunk per minute. |
| Proxy | Leave Apify Proxy on. See "Limits" below. |

Example input:

```json
{
  "urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw", "@mkbhd"],
  "searchQueries": ["python tutorial"],
  "maxVideosPerSource": 3,
  "language": "en",
  "chunkSeconds": 60
}
```

### Example output

This is a real row for a 19-second video, shortened:

```json
{
  "videoId": "jNQXAC9IVRw",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "title": "Me at the zoo",
  "channelName": "jawed",
  "channelId": "UC4QobU6STFB0P71PMvOGN5A",
  "publishedAt": "2005-04-23T20:31:52-07:00",
  "category": "Film & Animation",
  "lengthSeconds": 19,
  "language": "en",
  "captionKind": "manual",
  "availableLanguages": [
    { "code": "en", "name": "English", "kind": "manual" },
    { "code": "de", "name": "German", "kind": "manual" }
  ],
  "wordCount": 39,
  "transcript": "All right, so here we are, in front of the elephants the cool thing about these guys is that they have really... really really long trunks and that's cool (baaaaaaaaaaahhh!!) and that's pretty much all there is to say",
  "source": "video"
}
```

A video that can't be read gives a row like this instead, and you aren't charged for it:

```json
{
  "videoId": "OAZpSsu03VA",
  "errorCode": "NO_CAPTIONS",
  "error": "This video has no captions at all (neither uploaded nor auto-generated)."
}
```

Error codes: `NO_CAPTIONS`, `LANGUAGE_MISSING`, `UNAVAILABLE`, `PRIVATE`, `AGE_RESTRICTED`, `MEMBERS_ONLY`, `NOT_STARTED`, `BLOCKED`, `INVALID_INPUT`, `NO_VIDEOS`, `CHANNEL_NOT_FOUND`.

The run also saves a `SUMMARY` record with the counts per error code.

### Price

$3 per 1,000 transcripts ($0.003 each), plus a start fee of $0.00004 per run. You pay only for rows that contain a transcript. If you set a maximum cost per run, the actor stops when it is reached.

### Limits

- YouTube shows a bot check to most cloud IP addresses. The actor sends its requests through Apify Proxy (datacenter, included in every plan) and tries up to 6 different IPs per video. In a test of 30 search results, 27 came back with a transcript and 2 had no captions. The remaining one stayed `BLOCKED` on all 6 IPs. If you see many `BLOCKED` rows, run again or choose the RESIDENTIAL proxy group.
- No captions, no transcript. There is no speech-to-text fallback.
- Age-restricted, private and members-only videos can't be read.
- A live stream usually has no captions until it ends.
- `publishedAt` and `category` are sometimes `null` because YouTube doesn't always send them.
- Auto-translation (`translate`) is YouTube's machine translation, so expect the usual mistakes.
- A video of several hours with segments, SRT and chunks all switched on can produce a row larger than the 9 MB dataset item limit. Switch off what you don't need.

### Run it from code

```bash
curl -X POST "https://api.apify.com/v2/acts/night111~youtube-transcript-extractor/run-sync-get-dataset-items?token=YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"]}'
```

### Questions

Open an issue in the Issues tab of this Actor with the video link and the error code you got.

# Actor input Schema

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

Video links (watch, youtu.be, shorts, live), playlist links, channel links or @handles. A bare 11-character video ID also works. Playlists and channels are expanded into their latest videos.

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

Optional. Each query is searched on YouTube and the top results are transcribed.

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

How many videos to take from each playlist, channel or search query. Single video links are always included.

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

Caption language code, for example en, es, de, fr, ja, pt, zh-Hans. Manually uploaded captions are used first, auto-generated ones second.

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

original: return the video's own spoken language. translate: let YouTube machine-translate it to your language. skip: return an error row (not charged).

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

Adds a segments array with start (seconds), duration and text for every caption line.

## `includeSrt` (type: `boolean`):

Adds an srt field you can save as a .srt file.

## `chunkSeconds` (type: `integer`):

0 turns this off. For example 60 returns one chunk per minute, each with start, end, text and a link that opens the video at that second.

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

Keep Apify Proxy on. YouTube shows a bot check to most cloud IPs, and the default datacenter proxy gets through. If a run still reports BLOCKED, pick the RESIDENTIAL group.

## Actor input object example

```json
{
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "maxVideosPerSource": 5,
  "language": "en",
  "ifLanguageMissing": "original",
  "includeSegments": false,
  "includeSrt": false,
  "chunkSeconds": 0,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

Transcript rows, one per video.

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

How many videos were requested, delivered and failed, with error codes.

# 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=dQw4w9WgXcQ"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("night111/youtube-transcript-extractor").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=dQw4w9WgXcQ"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("night111/youtube-transcript-extractor").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=dQw4w9WgXcQ"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call night111/youtube-transcript-extractor --silent --output-dataset

```

## MCP server setup

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

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/IBncM9Fc3S08tNeLS/builds/RTE3X77e2mHE0jfcG/openapi.json
