# Youtube Transcript For Llm (`miledev/youtube-transcript-for-llm`) Actor

Instantly extract clean YouTube transcripts and subtitles for your LLM pipelines, RAG systems, and automations. Fast, cost-effective, and production-ready.

- **URL**: https://apify.com/miledev/youtube-transcript-for-llm.md
- **Developed by:** [Mathias Mileo](https://apify.com/miledev) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.50 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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 & LLM Chunker

Extract, clean, and format YouTube video transcripts into token-optimized chunks for **RAG pipelines**, **AI Agents**, and **LLMs** (OpenAI, Claude, Llama).

Built for high reliability with built-in proxy support to bypass YouTube rate limits and anti-scraping protections.

***

### Features

- **🚀 Instant Extraction:** Fetches full YouTube video transcripts in seconds.
- **🧩 LLM-Ready Chunking:** Automatically splits transcripts into configurable chunks for vector databases and embedding models.
- **🛡️ Anti-Blocking Architecture:** Supports Apify Residential Proxies and custom proxies (Webshare, BrightData, etc.).
- **📊 Rich Metadata:** Returns video IDs, URLs, execution status, and processing metrics.
- **⚡ n8n & Automation Friendly:** Designed for seamless integration with n8n, Make, and custom REST API endpoints.

***

### Input Parameters

| Parameter | Type | Required | Default | Description |
| :--- | :--- | :--- | :--- | :--- |
| `videoUrl` | String | **Yes** | — | YouTube Video URL or Video ID (e.g., `https://www.youtube.com/watch?v=...`) |
| `chunkSize` | Integer | No | `500` | Target chunk size in characters/tokens for LLM processing |
| `proxyUrl` | String | No | — | Custom proxy URL (e.g., `http://user:pass@host:port`). Encrypted at rest. |
| `proxyConfiguration` | Object | No | `RESIDENTIAL` | Apify proxy configuration object |

#### Sample Input JSON

````json
{
  "videoUrl": "[https://www.youtube.com/watch?v=JTSiz0W8E_o](https://www.youtube.com/watch?v=JTSiz0W8E_o)",
  "chunkSize": 500,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"]
  }
}



# Actor input Schema

## `videoUrl` (type: `string`):

L'URL complète de la vidéo YouTube (ou l'ID vidéo).
## `languages` (type: `array`):

Liste des codes de langue à essayer par ordre de priorité (ex: fr, en).
## `chunkSize` (type: `integer`):

Nombre maximal approximatif de tokens par bloc de texte.
## `overlapSize` (type: `integer`):

Nombre de tokens de chevauchement entre chaque bloc pour préserver le contexte RAG.
## `proxyUrl` (type: `string`):

URL optionnelle d'un proxy résidentiel tiers (ex: Webshare, au format http://user:pass@host:port). Si fournie, elle est utilisée en priorité sur la configuration Proxy Apify ci-dessous. Ce champ est chiffré au repos et masqué dans la Console.
## `proxyConfiguration` (type: `object`):

Utilisé uniquement si 'Custom Proxy URL' est vide. YouTube bloque la quasi-totalité des IP de datacenter : le groupe RESIDENTIAL est présélectionné par défaut pour éviter les erreurs IpBlocked/RequestBlocked. Nécessite un abonnement Apify avec accès aux proxys résidentiels.

## Actor input object example

```json
{
  "videoUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
  "languages": [
    "fr",
    "en"
  ],
  "chunkSize": 1500,
  "overlapSize": 100,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
````

# Actor output Schema

## `transcript` (type: `string`):

Default dataset item: videoId, videoUrl, fullTranscript, chunks\[] (chunkIndex, text, tokenCount, wordCount), metrics (wordCount, estimatedTotalTokens, tokenizerMethod, chunkCount, cleaningRatio, ...).

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

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

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

```

## MCP server setup

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

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/FY9pMkdNYW2OEHVEh/builds/y1P5PGeGpNUpfmTKJ/openapi.json
