# YouTube Transcript Scraper — video transcripts & metadata (`arfathyahiya/youtube-transcript-scraper`) Actor

Extract YouTube video transcripts (captions/subtitles) with timestamps, plus title, channel and thumbnail metadata. Feed into LLMs, RAG pipelines, summarizers, translators, SEO tools or subtitling workflows. Handles watch, youtu.be, shorts, embed and live URLs. Proxy-free, fast, per-video pricing.

- **URL**: https://apify.com/arfathyahiya/youtube-transcript-scraper.md
- **Developed by:** [h4ck3r\_x](https://apify.com/arfathyahiya) (community)
- **Categories:** Videos
- **Stats:** 1 total users, 1 monthly users, 81.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 video processeds

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?

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 — video transcripts, subtitles & metadata

Extract **YouTube video transcripts (captions/subtitles) with timestamps** in seconds, plus **title, channel and thumbnail metadata** for every video. One API call per video — no browser, no proxy, no login.

### Why this Actor

- **Built for AI/LLM workflows** — feed transcripts straight into summarizers, RAG pipelines, knowledge bases, chatbots, translation tools and fine-tuning datasets
- **All URL forms** — `watch?v=`, `youtu.be/`, `/shorts/`, `/embed/`, `/live/`
- **Automatic language fallback** — if your preferred language isn't available, the first available transcript is fetched (can be disabled)
- **Timestamped or plain text** — full snippet array (`start`, `duration`, `text`) plus a ready-to-use plain-text version
- **Per-video error reporting** — a broken video never kills the run; you get structured `error` fields per item
- **Fast & cheap** — async concurrency, proxy-free, charged per result

### Use cases

- 📄 **LLM training / RAG** — turn videos into searchable text for AI apps
- 🗞️ **Content repurposing** — blogs, newsletters, show notes from podcasts/videos
- 🔎 **SEO & research** — keyword mining from thousands of transcripts
- 🌐 **Subtitles & translation** — caption extraction for dubbing/subtitling workflows
- 📊 **Analytics** — transcript + metadata for video performance analysis

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `startUrls` | array | — | YouTube URLs or raw video IDs (required) |
| `languageCodes` | array | `["en"]` | Preferred languages in order |
| `strictLanguages` | bool | `false` | Skip videos without a preferred-language transcript |
| `includeTimestamps` | bool | `true` | Output snippets array + timestamped text |
| `includeMetadata` | bool | `true` | Fetch title, channel, thumbnail via oEmbed |
| `maxConcurrency` | int | `5` | Parallel videos per run (1–20) |

### Output

One dataset item per video:

```json
{
  "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "videoId": "dQw4w9WgXcQ",
  "title": "Rick Astley - Never Gonna Give You Up",
  "channelName": "Rick Astley",
  "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
  "languageCode": "en",
  "isGenerated": false,
  "snippetCount": 61,
  "transcriptText": "[00:00] We're no strangers to love ...",
  "snippets": [
    { "start": 0.0, "duration": 3.0, "text": "We're no strangers to love" }
  ]
}
```

Videos without an extractable transcript return an item with an `error` field — the run continues.

### Pricing

Pay-per-event, charged only when a result is produced:

- **$0.0007 per video result** (dataset item)
- **$0.005 per actor start**

No hidden charges. Free tier usage is free.

### FAQ

**Does it work for videos without captions?** No — the video must have manual or auto-generated captions (most videos with speech do).

**Is a proxy needed?** Not strictly — the actor works proxy-free from residential IPs. For datacenter/large-scale runs, enable the Apify proxy (default) or paste your own. If YouTube shows a "Sign in to confirm you're not a bot" error, add a cookies.txt export from a logged-in browser session (Chrome: use a cookies-export extension; Firefox: EditThisCookie → Export Netscape format).

**Can I scrape an entire channel/playlist?** Feed the actor the video URLs (e.g. export from a playlist link resolver) or run it on your list. Playlist/channel expansion is on the roadmap.

### Support

Open an issue on the actor page or contact the developer. Feature requests welcome: channel/playlist expansion, view/like counts, summary generation.

# Actor input Schema

## `startUrls` (type: `array`):

YouTube video URLs (or plain 11-char video IDs). Accepts watch?v=, youtu.be/, /shorts/, /embed/ and /live/ forms.

## `languageCodes` (type: `array`):

Language codes to try, in order (e.g. en, hi, es). Leave empty to fetch the first available transcript.

## `strictLanguages` (type: `boolean`):

If enabled, videos without a transcript in your preferred languages are skipped with an error. If disabled (default), falls back to the first available transcript.

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

Output the full snippets array with start time and duration per segment, and prefix timestamps in the plain text.

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

Fetch title, channel name and thumbnail via YouTube's oEmbed endpoint.

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

Maximum number of videos processed in parallel. Lower = safer against YouTube rate-limiting.

## `useApifyProxy` (type: `boolean`):

Route requests through the Apify proxy (residential recommended) to avoid YouTube IP throttling. Proxy traffic is billed to your Apify account.

## `cookies` (type: `string`):

Netscape-format cookies.txt from a logged-in YouTube browser session. Bypasses YouTube's bot check on datacenter IPs. See FAQ for how to export.

## `proxyUrl` (type: `string`):

Optional HTTP/HTTPS proxy URL (e.g. http://user:pass@host:port). Overrides Apify proxy.

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "languageCodes": [
    "en"
  ],
  "strictLanguages": false,
  "includeTimestamps": true,
  "includeMetadata": true,
  "maxConcurrency": 2,
  "useApifyProxy": true
}
```

# Actor output Schema

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

All extracted transcripts in the default dataset (one item per video).

## `consoleRun` (type: `string`):

Open the run in Apify Console (Output tab renders the dataset).

# 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 = {
    "startUrls": [
        "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
    ],
    "languageCodes": [
        "en"
    ]
};

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

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

```

## MCP server setup

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