# YouTube Transcript Scraper (`elhadj.hamlaoui/youtube-transcript-scraper`) Actor

Get the full transcript of any YouTube video with captions, plus title, channel, views and duration. Works on Shorts and any URL format. Pay only per transcript delivered.

- **URL**: https://apify.com/elhadj.hamlaoui/youtube-transcript-scraper.md
- **Developed by:** [Jamel HAMLAOUI](https://apify.com/elhadj.hamlaoui) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$4.00 / 1,000 transcript scrapeds

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

Get the full transcript of any YouTube video that has captions — plus the
title, channel, view count and duration — as JSON, CSV or Excel.

Paste a URL in any format. **No API key, no login, no quota.**

### Why this one

- **You are never charged for a video without captions.** Most scrapers in
  this category bill per dataset row, so a failed lookup still costs you.
  Here a video with no transcript is reported so you can see it, and billed
  at zero
- **Video metadata included** — title, channel, channel ID, duration, view
  count and whether it was a livestream. No second lookup needed
- **Every URL shape works** — `watch?v=`, `youtu.be`, Shorts, `/embed/`,
  `/live/`, or a bare 11-character ID
- **Human captions preferred over auto-generated**, and the output tells you
  which one you got
- **Timestamps optional** — plain text by default, or a full cue list with
  start and duration per line

### Quick start

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://youtu.be/jNQXAC9IVRw",
    "9bZkp7q19f0"
  ]
}
```

With options:

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

### Input

| Field | What it does |
|---|---|
| `videos` | URLs or IDs. Any YouTube URL format is accepted |
| `language` | Preferred caption language (`en`, `fr`, `es`…). Empty = best available |
| `includeTimestamps` | Adds a `cues` array with start, duration and text per line |
| `skipVideosWithoutTranscript` | Omit captionless videos entirely instead of reporting them |
| `proxyConfiguration` | **Leave on residential.** See the proxy section below |

If you ask for a language the video does not have, the run tells you which
languages *are* available rather than quietly returning a different one.

### Output

| Field | Description |
|---|---|
| `videoId` / `url` | Video identity |
| `title` / `channel` / `channelId` | Video and uploader |
| `durationSeconds` / `viewCount` / `isLive` | Video stats |
| `transcript` | Full text, one string |
| `cues` \* | `[{start, duration, text}]` per caption line |
| `cueCount` / `characterCount` | Size of the transcript |
| `language` / `languageName` | Caption track used |
| `isAutoGenerated` | Whether captions were machine-made |
| `availableLanguages` | Every caption language the video offers |

\* only with `includeTimestamps`

```json
{
  "videoId": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up (Official Video)",
  "channel": "Rick Astley",
  "durationSeconds": 213,
  "viewCount": 1818130915,
  "language": "en",
  "isAutoGenerated": false,
  "availableLanguages": ["de", "en", "es", "fr", "pt"],
  "cueCount": 61,
  "characterCount": 2029,
  "transcript": "[♪♪♪] ♪ We're no strangers to love ♪ ♪ You know the rules and so do I ♪ ..."
}
```

### What it is good for

- **Feeding videos to an LLM** — summaries, Q\&A, retrieval over a channel
- **Searching spoken content** across many videos at once
- **Repurposing** long videos into articles, clips or show notes
- **Research** on how topics are actually talked about, at scale

### Pricing

Pay per transcript delivered. Videos without captions cost nothing, duplicate
URLs in the same run are charged once, and there is no start fee.

### Proxy: residential is required

YouTube blocks datacenter IP ranges. Measured on the Apify platform with the
same three videos:

| Setup | Transcripts returned |
|---|---|
| Datacenter IP | **0 of 3** |
| Residential proxy | **3 of 3** |

Datacenter requests come back with "Sign in to confirm you're not a bot".
Residential proxy is therefore the default and should be left on. This is very
likely why transcript scrapers in general have a reputation for failing.

### Honest limits

- **A video with no captions has no transcript.** Nobody can extract one
  without running speech recognition, which this Actor does not do. You will
  get a row telling you so, free of charge
- Auto-generated captions carry the usual speech-recognition errors,
  especially on music and accents. `isAutoGenerated` tells you when you are
  looking at one
- Private, deleted and age-restricted videos cannot be read

### FAQ

**Do I need a YouTube API key?**
No. This does not use the YouTube Data API, so there is no quota to run out of.

**Does it work on Shorts?**
Yes, and on `/live/` and `/embed/` URLs too.

**Why did my video return an error row?**
Almost always because it has no captions at all. The row carries the reason
and is never billed.

**What if it breaks?**
This Actor depends on YouTube's internal client versions, which age out over
time. Automated contract tests catch that. Report an issue and it gets fixed.

# Actor input Schema

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

Video URLs or IDs. Accepts watch links, youtu.be, Shorts, embed and live URLs, or bare 11-character IDs.

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

Preferred caption language code, e.g. en, fr, es. Leave empty to take the human-written track when one exists, otherwise auto-generated.

## `includeTimestamps` (type: `boolean`):

Adds a `cues` array with start time, duration and text for every caption line. Leave off for just the plain text.

## `skipVideosWithoutTranscript` (type: `boolean`):

By default a video without captions is still reported as a row (never charged) so you can see which ones failed. Turn this on to omit them entirely.

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

RESIDENTIAL is required. Measured on the Apify platform: datacenter IPs return 0 of 3 transcripts because YouTube answers them with "Sign in to confirm you're not a bot", while residential returns 3 of 3. Changing this will break the Actor.

## Actor input object example

```json
{
  "videos": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "includeTimestamps": false,
  "skipVideosWithoutTranscript": false,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

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

No description

## `transcriptsCsv` (type: `string`):

No description

## `browse` (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=dQw4w9WgXcQ"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("elhadj.hamlaoui/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"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

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

```

## MCP server setup

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