# YouTube Transcript Scraper - Bulk, Timestamps, SRT, Chapters (`bachiembmt/youtube-transcript-batch`) Actor

YouTube transcript scraper and API: extract captions for many videos in bulk as timestamped segments, full text or SRT, with chapters, metadata and any caption language. Charged only when a transcript is returned. For LLM/RAG, SEO and subtitles. No API key.

- **URL**: https://apify.com/bachiembmt/youtube-transcript-batch.md
- **Developed by:** [Ha Phan Thanh Hai](https://apify.com/bachiembmt) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.00 / 1,000 video transcript scrapeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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: bulk transcripts, timestamps, SRT, chapters

Get **YouTube transcripts for many videos in one run**: timestamped segments, full text or SRT, chapters and metadata, in the caption language you choose. No login, no API key.

### What does YouTube Transcript Scraper do?

- Accepts watch, youtu.be, shorts and embed URLs or bare video IDs.
- Prefers manual captions, then auto-generated, in your language priority list.
- Output as JSON (segments + full text), plain text or SRT.
- Video metadata: title, channel, publish date, duration, available caption languages.
- Chapters parsed from the description.
- Optional `translateTo` using YouTube's own translation (best effort).

### Why use it

- **Pay only for transcripts returned**: videos with errors are free.
- **Bulk-ready**, with clear per-video error codes.
- **Reliable via residential proxy by default**, with retries on bot checks.
- **No API key, no video download.**

### Use cases

- Feeding video content to LLMs, RAG and summarisers.
- Content research and keyword analysis of competitor channels.
- Subtitles (SRT) for repurposing, translation or accessibility.
- Searchable archives with timestamped quotes.
- Podcast and course transcripts for study notes.

### How to use

1. Open the Actor on Apify and click **Try for free** (or call it through the API).
2. Paste **video URLs or IDs** and set preferred **languages** and **format**.
3. Click **Start**, then download the dataset as JSON, CSV, Excel or HTML, or read it through the API.

#### Input example

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ", "https://youtu.be/9bZkp7q19f0", "https://www.youtube.com/shorts/xxxxxxxxxxx", "aircAruvnKk"],
  "languages": ["en"],
  "format": "json",
  "includeChapters": true,
  "translateTo": "es",
  "proxyConfiguration": {"useApifyProxy": true, "apifyProxyGroups": ["RESIDENTIAL"]}
}
```

- `videoUrls`: watch / youtu.be / shorts / embed URLs or bare 11-char IDs.
- `languages`: priority list. For each language: manual captions first, then auto-generated. Nothing matches: the first available track is returned (see `language`).
- `format`: `json` (segments + fullText), `text` (fullText only), `srt` (adds `srt`).
- `translateTo`: optional machine translation of the track (see limitations).

### Output example

```json
{
  "videoId": "aircAruvnKk",
  "url": "https://www.youtube.com/watch?v=aircAruvnKk",
  "title": "But what is a neural network? | Deep learning chapter 1",
  "channel": "3Blue1Brown",
  "channelId": "UCYO_jab_esuFRV4b17AJtAw",
  "publishedAt": "2017-10-05T08:15:00-07:00",
  "durationSec": 1112,
  "language": "en",
  "isAutoGenerated": false,
  "availableLanguages": [{"code": "en", "autoGenerated": false, "translatable": true}],
  "segments": [{"start": 4.22, "dur": 1.18, "text": "This is a three."}],
  "fullText": "This is a three. ...",
  "srt": null,
  "chapters": [{"start": 0, "title": "Introduction example"}],
  "error": null
}
```

Videos that cannot be transcribed are still returned (not charged) with `error` set to one of: `no_captions`, `age_restricted`, `bot_check`, `private_video`, `login_required`, `unavailable`, `invalid_url`, `transcript_fetch_failed`.

### Pricing

Pay per event, no subscription. You pay only for what is returned:

| Event | Price per 1,000 | 1,000 | 10,000 | 100,000 |
|---|---|---|---|---|
| video | $3.00 | $3.00 | $30.00 | $300.00 |

Example: 1,000 videos cost $3.00; 10,000 cost $30.00.

Videos without a returned transcript are not charged. Residential proxy traffic is **not** included: it is billed to you as Apify platform usage, about 0.2 MB per video. Check the run cost in the Apify console for your own mix.

### Integrations & API

Run it from code with the Apify API. Replace `<APIFY_TOKEN>` with your API token.

**Python** (`pip install apify-client`)

```python
from apify_client import ApifyClient

client = ApifyClient("<APIFY_TOKEN>")
run = client.actor("bachiembmt/youtube-transcript-batch").call(run_input={"videoUrls": ["https://www.youtube.com/watch?v=aircAruvnKk"], "languages": ["en"], "format": "json", "includeChapters": True})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)
```

**cURL** (run synchronously and get dataset items)

```bash
curl -X POST "https://api.apify.com/v2/acts/bachiembmt~youtube-transcript-batch/run-sync-get-dataset-items?token=<APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"videoUrls": ["https://www.youtube.com/watch?v=aircAruvnKk"], "languages": ["en"], "format": "json", "includeChapters": true}'
```

Works with:

- **Make** and **Zapier**: use the Apify app/module to run this Actor and pass the dataset on.
- **n8n**: use the Apify node or an HTTP Request node with the API call above.
- **Google Sheets**: export the dataset as CSV, or use the Apify integration to append rows automatically.
- **Webhooks**: trigger your own endpoint when a run finishes; combine with Apify schedules for recurring jobs.
- **AI agents**: expose the Actor as a tool through the [Apify MCP server](https://mcp.apify.com).

### FAQ

**Does it work for videos without captions?**
No. It returns existing manual or auto-generated captions only; there is no speech-to-text. Those videos come back with `error: no_captions` and are free.

**Why a residential proxy?**
YouTube challenges most datacenter IPs. Residential is the default; on a bot check the Actor retries on new sessions, and if all fail the video is reported as `bot_check` (free, retry later).

**Does it download the video?**
No, only caption text.

**Do I need an account or API key for the source?**
No. The Actor needs no login or source API key. You only need an Apify account to run it.

**Is it legal to scrape this data?**
Only public caption data is read. Respect YouTube's Terms of Service and the creators' copyright when reusing transcripts. This is general information, not legal advice.

### Limitations

- Only videos that have captions (manual or auto-generated). No speech-to-text is performed.
- Age-restricted and private videos are not accessible without login and are reported as errors.
- **Proxy:** the actor uses Apify Proxy by default and, on a bot check, retries up to 3 times on a new proxy session and tries other YouTube client profiles. Default is the **RESIDENTIAL** group: YouTube challenges most datacenter IPs. Residential traffic is billed as platform usage (~0.2 MB per video).
- YouTube may show a "Sign in to confirm you're not a bot" check for some IPs; if all retries fail the video is reported as `bot_check` (not charged, retry later). Requests are throttled to ~1/s with retries.
- `translateTo` relies on YouTube's `tlang` endpoint, which may be rate-limited or refused; then the original language is returned (check `language`) and a warning is logged.
- `publishedAt` is read from the public watch page; it may be `null` if unavailable.
- Chapters are parsed from timestamps in the description (needs at least 3, first at 0:00).
- YouTube's internal API can change and temporarily break extraction.

# Actor input Schema

## `videoUrls` (type: `array`):

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

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

Language codes in priority order (en, de, es, ...). For each: manual captions first, then auto-generated. If none match, the first available track is returned.

## `format` (type: `string`):

json = segments + fullText; text = fullText only; srt = segments + fullText + srt subtitle file text.

## `includeChapters` (type: `boolean`):

Parse chapters from the timestamps in the video description.

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

YouTube may challenge datacenter IPs with a bot check. Use the RESIDENTIAL proxy group for large batches.

## `translateTo` (type: `string`):

Language code to machine-translate the transcript into (only if the track is translatable). If YouTube refuses, the original language is returned.

## Actor input object example

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "languages": [
    "en"
  ],
  "format": "json",
  "includeChapters": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `transcripts` (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 = {
    "videoUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "languages": [
        "en"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true,
        "apifyProxyGroups": [
            "RESIDENTIAL"
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bachiembmt/youtube-transcript-batch").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 = {
    "videoUrls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
    "languages": ["en"],
    "proxyConfiguration": {
        "useApifyProxy": True,
        "apifyProxyGroups": ["RESIDENTIAL"],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("bachiembmt/youtube-transcript-batch").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 '{
  "videoUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "languages": [
    "en"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call bachiembmt/youtube-transcript-batch --silent --output-dataset

```

## MCP server setup

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

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/qN9xA3QaUY3WR90UH/builds/1TJIVeohathkGYtQw/openapi.json
