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

Grab the full transcript of any public YouTube video from a URL or ID. Pick the caption language and get clean transcript text plus timed snippets (text, start, duration) with the video details. Uses YouTube’s own InnerTube endpoint — no Data API key, no headless browser.

- **URL**: https://apify.com/receptional\_blender/youtube-transcript-grabber.md
- **Developed by:** [Assia Fadli](https://apify.com/receptional_blender) (community)
- **Categories:** Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

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

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## YouTube Transcript Scraper

**YouTube Transcript Scraper** turns any public YouTube video into its full transcript. Give it a
single video link (or an 11-character ID), pick a language, and get back the complete transcript as
clean text plus a timed, machine-friendly list of snippets — ready to drop into subtitles,
summaries, search indexes or an LLM pipeline.

No YouTube Data API key. No headless browser. It talks to YouTube's own **InnerTube** endpoint (the
same one the mobile app uses) with the ANDROID client, so caption downloads aren't blocked by the
Proof-of-Origin / PoToken wall that breaks web-based scrapers.

Built for creators, researchers, localisation teams and developers who need reliable transcripts
without maintaining scraping infrastructure.

### What you get

For the video you provide, the actor writes a single dataset record:

| Field | Description |
| --- | --- |
| `lang` | The requested transcript language code (e.g. `en`) |
| `videoDetails` | The video's InnerTube details (title, author, channelId, lengthSeconds, viewCount, thumbnails, …) |
| `text` | The full transcript as one space-joined string |
| `snippets` | Array of `{ text, start, duration }` — one entry per caption line, with timings in seconds |

If the transcript can't be read (captions disabled, video private/removed, or the language isn't
available), the actor still writes a row — `{ "lang": "...", "error": "..." }` — instead of failing.

### Input

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `videoUrl` | string | ✅ | YouTube video URL (`watch?v=`, `youtu.be/`, `/shorts/`, `/embed/`, `/live/`) or a bare 11-char ID. Also accepted as `url`. |
| `language` | string | — | BCP-47 caption language code. Defaults to `en`. Also accepted as `lang`. |
| `proxyCountryCode` | string | — | Two-letter residential-proxy country code (e.g. `US`, `GB`, `DE`). Defaults to `US`. |

#### Example input

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "language": "en"
}
```

#### Example output row

```json
{
  "lang": "en",
  "videoDetails": {
    "videoId": "dQw4w9WgXcQ",
    "title": "Rick Astley - Never Gonna Give You Up (Official Video)",
    "author": "Rick Astley",
    "lengthSeconds": "212"
  },
  "text": "Never gonna give you up Never gonna let you down ...",
  "snippets": [
    { "text": "Never gonna give you up", "start": 0.0, "duration": 3.5 },
    { "text": "Never gonna let you down", "start": 3.5, "duration": 4.2 }
  ]
}
```

### How it works

The actor sends a `POST` to `https://www.youtube.com/youtubei/v1/player` using the InnerTube
**ANDROID** client, reads the caption track for your chosen language (preferring the auto-generated
track and falling back to a manual one), downloads the timedtext XML, decodes HTML entities and
parses each line into a `{ text, start, duration }` snippet. Requests route through Apify residential
proxies with an automatic fallback to a direct request.

### Pricing

This actor uses Apify's **pay-per-event** model. You're charged once per delivered transcript
(`transcript-scraped`); error rows are never billed.

### Use cases

- Generate subtitles or closed captions for accessibility and translation
- Feed clean transcript text into summarisation, search or LLM pipelines
- Build language-learning and study tools from real video captions
- Archive or repurpose video content as searchable text

### Tech

Written in **TypeScript** on the Apify SDK. HTTP-only, so builds are fast and runs are cheap.

### License

MIT © Assia Fadli

# Actor input Schema

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

The YouTube video to grab the transcript from. Accepts a full URL in any form (watch?v=, youtu.be/, /shorts/, /embed/, /live/) or a bare 11-character video ID.

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

The caption language to fetch. The actor prefers the auto-generated track for this language and falls back to a manual one. Defaults to English.

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

Optional 2-letter country code (e.g. US, GB, DE) for the Apify residential proxy. Defaults to US. If the proxy is unavailable the actor falls back to a direct request.

## Actor input object example

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=Qac6E9be7mE",
  "language": "en"
}
```

# 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 = {
    "videoUrl": "https://www.youtube.com/watch?v=Qac6E9be7mE",
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("receptional_blender/youtube-transcript-grabber").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 = {
    "videoUrl": "https://www.youtube.com/watch?v=Qac6E9be7mE",
    "language": "en",
}

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

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

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

```

## CLI example

```bash
echo '{
  "videoUrl": "https://www.youtube.com/watch?v=Qac6E9be7mE",
  "language": "en"
}' |
apify call receptional_blender/youtube-transcript-grabber --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/Zvl8YTBLbBDX6soT0/builds/hnHo4ehSHHjb7uKEI/openapi.json
