# YouTube Transcript Scraper API (`api_harbor/youtube-transcript-scraper`) Actor

Get the transcript of any YouTube video: full text and timestamped segments, manual or auto captions, any language. $1 per 1,000 transcripts, pay-per-transcript, failed items never charged. No API key. Callable from any MCP client (Claude, Cursor, ChatGPT).

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

## Pricing

from $1.00 / 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.

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 API

Extract the transcript of any YouTube video: the full text plus timestamped segments, from manual or auto-generated captions, in the language you choose. Built for LLM, RAG and AI agent pipelines, and callable from any MCP client (Claude, Cursor, ChatGPT). No YouTube API key, no login, no quota. Export to JSON, CSV or Excel, or call it as a YouTube transcript API.

**Price promise:** $1.00 per 1,000 transcripts, pay-per-transcript. Failed items and `error` rows are never charged. No proxy fees, no YouTube API key, no Google Cloud quota.

### What does YouTube Transcript Scraper do?

Give it a list of YouTube videos. For each video, it returns one item with:

- Video ID and title
- Caption language and whether the captions are auto-generated
- The full transcript as one plain text string
- Timestamped segments (`start`, `end` in seconds, `text`), ready for subtitles, chapters or citations

Accepted input: any YouTube URL (`watch?v=`, `youtu.be/`, `shorts/`, `live/`, `embed/`) or the 11-character video ID.

### What you get back

| Field | Type | Description |
|---|---|---|
| `videoId` | string | YouTube video ID |
| `title` | string | Video title |
| `language` | string | Caption language code, e.g. `en` |
| `autoGenerated` | boolean | `true` if the captions are auto-generated by YouTube |
| `text` | string | Full transcript as plain text, ready for an LLM prompt or embeddings |
| `segments` | array | Timestamped segments: `start` and `end` in seconds, `text` |
| `input` | string | Input that failed (error rows only) |
| `error` | string | Error message (error rows only, never charged) |

### Why this YouTube transcript API instead of the official one

- **No API key, no quota.** The YouTube Data API does not give transcripts of other people's videos. This Actor does.
- **Pay only for what you get.** $1 per 1,000 transcripts. A video without captions is reported but never charged.
- **Language choice.** Ask for `en`, `fr`, `es`... Manual captions are preferred over auto-generated ones.
- **Agent-ready.** Clean JSON, one item per video, structured errors, usable as an MCP tool.

### Use cases for LLMs, RAG and AI agents

- **RAG and knowledge bases:** chunk `segments` and embed them, with timestamps for citations back to the exact moment.
- **AI agents:** let Claude or ChatGPT read a video on demand through MCP and answer questions about it.
- **Summarization and Q\&A:** feed `text` to an LLM for summaries, key takeaways or quizzes.
- **Content repurposing:** turn videos into blog posts, newsletters, threads or show notes.
- **SEO and research:** analyze what competitors and creators say in their videos.
- **Accessibility and translation:** get a clean, timestamped text to translate or subtitle.

### How much does it cost?

| What | Price |
|---|---|
| Run start | $0.00005 per run |
| Transcript | $1.00 per 1,000 transcripts |
| Failed item (`error` row) | $0 |
| Proxies, API key | $0, included |

The Apify free plan includes $5 of monthly credit, enough for about 5,000 transcripts. Set a maximum cost per run in Apify Console and the run stops cleanly at that budget.

### How to scrape a YouTube transcript

1. Click **Try for free**.
2. Paste YouTube video URLs or IDs, and optionally a language code.
3. Click **Start**, then download your data as JSON, CSV, Excel or HTML.

Need to find videos first? Use [YouTube Search Scraper](https://apify.com/api_harbor/youtube-search-scraper). Want what viewers say? Use [YouTube Comments Scraper](https://apify.com/api_harbor/youtube-comments-scraper).

### Input

```json
{
  "videos": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
  "language": "en"
}
```

### Output example

Real item from a test run:

```json
{
  "videoId": "jNQXAC9IVRw",
  "title": "Me at the zoo",
  "language": "en",
  "autoGenerated": false,
  "text": "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",
  "segments": [
    { "start": 1.2, "end": 3.36, "text": "All right, so here we are, in front of the elephants" },
    { "start": 5.318, "end": 7.974, "text": "the cool thing about these guys is that they have really..." },
    { "start": 7.974, "end": 12.616, "text": "really really long trunks" }
  ]
}
```

A video without captions returns `{"videoId": "...", "title": "...", "error": "No transcript available for this video"}` and is not charged.

### Use it from AI agents (MCP)

This Actor is available as a tool through the Apify MCP server, so Claude, Cursor, ChatGPT or any MCP client can call it directly.

- MCP server URL: `https://mcp.apify.com/?actors=api_harbor/youtube-transcript-scraper`
- Token: Apify Console > **Settings** > **Integrations** (your Apify API token)

**Claude Desktop** (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?actors=api_harbor/youtube-transcript-scraper",
      "headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
    }
  }
}
```

**Claude Code:**

```bash
claude mcp add --transport http apify "https://mcp.apify.com/?actors=api_harbor/youtube-transcript-scraper" --header "Authorization: Bearer <APIFY_TOKEN>"
```

**Cursor** (`.cursor/mcp.json`) or **VS Code** (`.vscode/mcp.json`, use `"servers"` instead of `"mcpServers"`):

```json
{
  "mcpServers": {
    "apify": {
      "url": "https://mcp.apify.com/?actors=api_harbor/youtube-transcript-scraper",
      "headers": { "Authorization": "Bearer <APIFY_TOKEN>" }
    }
  }
}
```

Example prompts:

- "Get the transcript of https://www.youtube.com/watch?v=jNQXAC9IVRw and summarize it in 5 bullet points."
- "Fetch the French transcripts of these 3 videos and list every tool they mention, with timestamps."
- "Read this conference talk and write a blog post draft quoting the key moments."

### Use it from Python (YouTube API alternative)

```bash
pip install apify-client
```

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("api_harbor/youtube-transcript-scraper").call(run_input={"videos": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"], "language": "en"})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    if item.get("error"):
        print("failed:", item.get("input"), item["error"])  # not charged
        continue
    print(item)
```

### Fast cache and structured errors

- **Cache:** identical inputs are served from cache, so repeated requests come back in seconds.
- **Structured errors:** an item that cannot be fetched is returned as a row with an `error` field (and the failed `input`). These rows are **never charged**, and your agent or pipeline can branch on them without parsing logs.

### FAQ

**Do I need to log in or have a YouTube API key?**
No. No login, no Google account, no API key. Nothing to configure.

**What if the video has no captions in my language?**
The Actor falls back to the first available track and tells you which language it returned in `language`.

**Does it work with Shorts and live replays?**
Yes, as long as YouTube has captions for them.

**Is it legal to scrape YouTube transcripts?**
The Actor reads publicly available captions only. You are responsible for complying with copyright, your local laws and YouTube's terms for your use case.

**Is there a YouTube transcript API?**
Yes: this Actor is one. Call it through the Apify REST API (`POST https://api.apify.com/v2/acts/api_harbor~youtube-transcript-scraper/run-sync-get-dataset-items`), the Python or JavaScript client, or MCP. The official YouTube Data API does not cover this use case without quota limits.

**Can I use it from Python?**
Yes. See the Python example above with `apify-client`.

**Can I schedule runs?**
Yes. Create a schedule in Apify Console (for example every morning on a list of new videos). Each run writes a new dataset you can export or send to a webhook.

**Does it work with Make, Zapier or n8n?**
Yes. Use the official Apify integrations for Make, Zapier and n8n, or call the REST API from any HTTP node.

**Can AI agents use it through MCP?**
Yes. Add `https://mcp.apify.com/?actors=api_harbor/youtube-transcript-scraper` to Claude Desktop, Claude Code, Cursor, VS Code or any MCP client with your Apify token. See the MCP section above.

**Something is missing or broken?**
Open an issue in the **Issues** tab.

### Related Actors

- [YouTube Search Scraper API](https://apify.com/api_harbor/youtube-search-scraper): videos by keyword with views, duration and channel.
- [YouTube Comments Scraper API](https://apify.com/api_harbor/youtube-comments-scraper): comments and replies with likes and authors.
- [Website to Markdown](https://apify.com/api_harbor/website-to-markdown): turn any website into clean Markdown for LLMs and RAG.

# Actor input Schema

## `videos` (type: `array`):

YouTube video URLs (watch, youtu.be, shorts, live, embed) or 11-character video IDs.

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

Preferred caption language code, e.g. en, fr, es. Falls back to the first available track. Manual captions are preferred over auto-generated ones.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "language": "en"
}
```

# Actor output Schema

## `results` (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 = {
    "videos": [
        "https://www.youtube.com/watch?v=jNQXAC9IVRw"
    ],
    "language": "en"
};

// Run the Actor and wait for it to finish
const run = await client.actor("api_harbor/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 = {
    "videos": ["https://www.youtube.com/watch?v=jNQXAC9IVRw"],
    "language": "en",
}

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

```

## MCP server setup

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