# YouTube Transcript Scraper — Bulk Captions to Text & JSON (`hapster/youtube-transcript-scraper`) Actor

Bulk-download YouTube transcripts (captions/subtitles) as clean text or timestamped segments, with title, channel and language. Paste video links, Shorts or IDs, even messy pasted lists. $0.0045 per transcript; videos without one are free.

- **URL**: https://apify.com/hapster/youtube-transcript-scraper.md
- **Developed by:** [Jean C](https://apify.com/hapster) (community)
- **Categories:** Videos, Social media, AI
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.50 / 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

### What does YouTube Transcript Scraper do?

It downloads the **transcript (captions/subtitles) of public YouTube videos**, as clean plain text or as timestamped segments, together with the video's title, channel, duration and view count.

- Paste video URLs, **Shorts** links, `youtu.be` links, live/embed links or bare 11-character video IDs. Mix them freely; duplicates are removed. Links pasted with trailing punctuation, quotes or several per line (comma- or space-separated) are fine.
- **Video links only:** playlist and channel links are not expanded; they come back as `invalid` with a note to paste the video links.
- **You only pay for transcripts that are actually returned.** Videos without captions, private or deleted videos and invalid links are listed in the results with the reason, **free of charge**.
- Pick your preferred caption languages in order (e.g. `en`, `de`, `pt-BR`). Human-made captions are preferred over auto-generated ones unless you switch that off.
- No YouTube account, API key or cookies needed.

### Why use it?

- **Summaries, search and RAG**: the `text` field is a single clean string ready for summarising, embedding or chunking.
- **Content research**: analyse what competitors or creators say, find quotes, track topics across channels.
- **SEO and repurposing**: turn videos into blog posts or show notes.
- **Academic and media research**: study what is said across many videos.

### How much does it cost?

Pay per event: **$0.0045 per transcript returned**, whatever the video's length. No charge for videos without a transcript. Platform usage is included in the price.

| Videos with transcripts | Cost |
|---|---|
| 100 | $0.45 |
| 1,000 | $4.50 |
| 10,000 | $45.00 |

Set a **maximum cost per run** in the run options and the actor stops cleanly when it reaches it.

### Input

| Field | Description |
|---|---|
| `videos` (required) | List of YouTube URLs or video IDs. |
| `languages` | Preferred caption languages in order. Default `["en"]`. If none is available, the first available language is returned (and charged) with `languageMatched: false`. |
| `onlyPreferredLanguages` | Never fall back to another language: a video without your languages comes back as a free `language_unavailable` row listing what it has. Default `false`. |
| `preferManualCaptions` | Prefer creator-uploaded captions over auto-generated ones. Default `true`. |
| `outputFormat` | `both` (default), `text` or `segments`. |
| `includeMetadata` | Add title, channel, duration and view count to each transcript. Default `true`, no extra cost. |

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtu.be/jNQXAC9IVRw",
    "https://www.youtube.com/shorts/oNTaHYXQ4MM"
  ],
  "languages": ["en"],
  "outputFormat": "both"
}
```

### Output

One dataset item per video. Download as JSON, CSV, Excel or HTML, or read it through the Apify API.

```json
{
  "input": "https://youtu.be/jNQXAC9IVRw",
  "videoId": "jNQXAC9IVRw",
  "status": "ok",
  "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
  "title": "Me at the zoo",
  "channel": "jawed",
  "channelId": "UC4QobU6STFB0P71PMvOGN5A",
  "durationSeconds": 19,
  "viewCount": 441157415,
  "language": "en",
  "languageMatched": true,
  "isAutoGenerated": false,
  "availableLanguages": ["de", "en"],
  "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, "duration": 2.16, "text": "All right, so here we are, in front of the elephants" },
    { "start": 5.318, "duration": 2.656, "text": "the cool thing about these guys is that they have really..." }
  ],
  "fetchedAt": "2026-10-08T10:00:00.000000+00:00"
}
```

Videos without a transcript come back like this (not charged):

```json
{ "input": "https://www.youtube.com/shorts/oNTaHYXQ4MM", "videoId": "oNTaHYXQ4MM", "status": "no_captions",
  "url": "https://www.youtube.com/watch?v=oNTaHYXQ4MM", "error": "video has no captions", "text": "" }
```

`status` is one of `ok`, `no_captions`, `language_unavailable` (none of your languages, with `onlyPreferredLanguages`), `unavailable` (private, deleted, region-locked, members-only, age-restricted, live or upcoming), `invalid` (not a YouTube video link or ID), `blocked` or `error` (temporary YouTube refusal after several retries), or `po_token_required` (YouTube demands a token this actor doesn't generate). Only `ok` rows are charged. Rows without a transcript have `text: ""`, so pipelines that read `text` don't break; filter on `status == "ok"`.

If YouTube refuses more than half the videos in a run of 5 or more, the run ends as **Failed** (stopping early once that is clear), so a problem never hides behind a "Succeeded" run. A run of 10 or more videos where none has a transcript and almost all got the same answer also ends as Failed, because that usually means YouTube changed something. You are still charged only for the transcripts returned.

Inputs that aren't YouTube links or video IDs are skipped before anything is fetched and listed as `invalid` (up to 1,000 of them), free.

Runs where almost no video has a transcript (for example a list of music videos without captions) stop early: once more than 100 videos have no transcript and fewer than 1 in 10 checked videos has one, the run ends with a message saying how many videos were not processed. You are never charged for videos without a transcript.

### Tips

- Run via the API or schedule it, and connect it to Make, Zapier, n8n or Google Sheets through Apify integrations.
- For many videos, put them all in one run rather than one run per video: it is faster.
- **Lists over about 300 videos: start the run asynchronously** and fetch the dataset when it finishes. The synchronous API endpoint (`run-sync-get-dataset-items`, used by some n8n/Make set-ups) gives up after 300 seconds while the run keeps going, and an automatic retry would start a second paid run.
- **Results come back in the order videos finish, not input order.** Match rows on `input` or `videoId`, not on row number.
- **Spreadsheets (CSV/Excel):** choose `outputFormat: text`. With segments every line becomes its own column.
- If a run restarts on Apify's side (e.g. a server migration), videos already done are skipped, not charged again.
- Speed is about 80 videos per minute, so the default 24-hour timeout fits about 100,000 videos. For more, raise the timeout in the run options or split the list. If the timeout is near, the run stops cleanly and tells you how many videos were not processed (not charged).
- Auto-generated captions have no punctuation for some languages; `isAutoGenerated` tells you which kind you got.

### Is it legal?

The actor reads only publicly available captions and does not log in. Transcripts can contain the names or opinions of people speaking, and video content is protected by copyright. Make sure your use (e.g. research, analysis, quotation) complies with copyright law, GDPR and YouTube's terms in your jurisdiction. Don't use the transcripts to train AI models on content you have no rights to. You are responsible for any personal data in the transcripts you collect. If in doubt, ask a lawyer.

### Feedback

Found a video that should work but doesn't? Open an issue on the **Issues** tab with the video ID and we'll look into it.

# Actor input Schema

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

Video URLs (watch, youtu.be, Shorts, live, embed) or 11-character video IDs, one per line. A line may also hold several links separated by commas or spaces. Playlist and channel links are not supported: paste the video links. Duplicates are removed.

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

Caption language codes in order of preference, e.g. en, de, es, pt-BR. If none match, the video's first available language is returned (and charged), with languageMatched: false; switch on 'Only my languages' to get a free row instead.

## `onlyPreferredLanguages` (type: `boolean`):

If none of your preferred languages exists for a video, return a free row (status language_unavailable, with the available languages) instead of a transcript in another language.

## `preferManualCaptions` (type: `boolean`):

Use creator-uploaded captions over YouTube's auto-generated ones when both exist in the chosen language.

## `outputFormat` (type: `string`):

Plain text is best for LLMs and search; segments keep start time and duration for each line.

## `includeMetadata` (type: `boolean`):

Adds title, channel, channel ID, duration and view count to each transcript at no extra cost.

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

Videos fetched in parallel.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtu.be/jNQXAC9IVRw"
  ],
  "languages": [
    "en"
  ],
  "onlyPreferredLanguages": false,
  "preferManualCaptions": true,
  "outputFormat": "both",
  "includeMetadata": true,
  "maxConcurrency": 10
}
```

# Actor output Schema

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

One row per video: the transcript (status ok, charged) or the reason there is none (free).

## `runStats` (type: `string`):

Counts per status, proxy traffic per video and why the run stopped, if it stopped early.

# 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=dQw4w9WgXcQ",
        "https://youtu.be/jNQXAC9IVRw"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("hapster/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=dQw4w9WgXcQ",
        "https://youtu.be/jNQXAC9IVRw",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("hapster/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=dQw4w9WgXcQ",
    "https://youtu.be/jNQXAC9IVRw"
  ]
}' |
apify call hapster/youtube-transcript-scraper --silent --output-dataset

```

## MCP server setup

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