# Youtube Video Transcript Scraper (`leandrocb88/youtube-video-transcript-scraper`) Actor

Extract transcripts and metadata from YouTube videos, channels, and search results at lightning speed. Powered by the industry-standard yt-dlp engine, this actor is designed to be lightweight, efficient, and cost-effective.

- **URL**: https://apify.com/leandrocb88/youtube-video-transcript-scraper.md
- **Developed by:** [Leandro Castellanos](https://apify.com/leandrocb88) (community)
- **Categories:** Videos
- **Features:** Limited permissions
- **Stats:** 86 total users, 4 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.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.

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

## 🚀 Fast & Cheap YouTube Transcript Scraper

Extract **transcripts (subtitles) and metadata** from YouTube videos, channels, and search results at lightning speed. Powered by the industry-standard **yt-dlp** engine, this actor is designed to be **lightweight, efficient, and cost-effective**.

### ✨ Key Features

- **⚡ Lightning Fast**: Bypasses heavy browser automation to fetch data directly via internal APIs.
- **💸 Cost Effective**: Extremely low compute usage means you pay less per run.
- **🎯 Precise**: Supports multiple languages, auto-generated captions, and timestamped outputs.
- **📚 Scalable**: Scrape single videos, entire channels, or search results in bulk.
- **🛡️ Reliable**: Uses high-quality **Residential Proxies** internally to bypass restrictions.

***

### 📖 How to Use

#### 1. Scrape Single Videos

Just paste the YouTube video URLs into the **Direct URLs** field.

**Use Case**: You have a specific list of videos you want to analyze.

#### 2. Scrape Entire Channels

Paste the channel URL (e.g., `https://www.youtube.com/@ChannelName`) into **Channel URLs**.

- Use **Max Videos per Channel** to limit how many recent videos to fetch.
- Use **Date Filter** (e.g., "7 days") to only get this week's videos.

**Use Case**: Monitoring a competitor's daily uploads.

#### 3. Scrape Search Results

Enter keywords into **Search Terms**.

- **Search Date Filter**: Only get videos from the `Last Hour`, `Today`, `This Week`, `This Month`, or `This Year`.
- **Search Sort By**: Sort by `Relevance`, `Upload Date`, `View Count`, or `Rating`.
- Good for topic monitoring and trend analysis.

***

### ⚙️ Key Configuration Options

| Setting | Description | Recommended |
|:---|:---|:---|
| **Direct URLs** | List of specific video links to scrape. | - |
| **Search Terms** | Keywords to search for on YouTube. | - |
| **Search Date Filter**| Filter search results by time (e.g., `Today`, `This Month`). | `all` |
| **Search Sort By** | Sort search results (e.g., `viewCount`, `uploadDate`). | `relevance` |
| **Channel URLs** | Links to YouTube channels to scan. | - |
| **Channel Sort By** | Sort channel videos by `Latest`, `Popular`, or `Oldest`. | `latest` |
| **Subtitle Language** | Preferred language code (e.g., `en`, `es`, `fr`). | `en` |
| **Prefer Auto-Generated** | If `true`, uses auto-captions if manual ones aren't available. | `false` |
| **Include Timestamps** | If `true`, output includes `start` and `duration`. | `true` |

***

### 📦 Output Example

The actor produces a clean JSON dataset. Each item represents one video:

```json
{
  "type": "video",
  "id": "jNQXAC9IVRw",
  "title": "Me at the zoo",
  "channel": "jawed",
  "viewCount": 320000000,
  "date": "2005-04-23T20:31:52-07:00",
  "hasCaptions": true,
  "transcript": [
    {
      "text": "All right, so here we are in front of the elephants.",
      "start": 0.5,
      "duration": 4.2
    },
    {
      "text": "The cool thing about these guys is that they have really...",
      "start": 4.7,
      "duration": 5.1
    }
  ],
  "fullText": "All right, so here we are in front of the elephants. The cool thing about these guys is that they have really..."
}
```

***

### ❓ FAQ

**Q: Do I need an API Key?**
A: No! This actor works without an official YouTube Data API key.

**Q: Can I get data from specific dates?**
A: Yes! Use the 'Date Filter Mode' when scraping Channels to only fetching videos from the last X days.

**Q: Is it expensive to run?**
A: No. Because it doesn't launch a full web browser (like Puppeteer/Playwright), it consumes very little memory and CPU, making it one of the cheapest options available.

# Actor input Schema

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

List of direct YouTube video URLs.

## `searchKeywords` (type: `array`):

List of keywords to search for.

## `maxVideosPerSearch` (type: `integer`):

Maximum regular videos to scrape per search result.

## `maxShortsPerSearch` (type: `integer`):

Maximum Shorts to scrape per search result (0 = exclude).

## `maxStreamsPerSearch` (type: `integer`):

Maximum Live Streams to scrape per search result (0 = exclude).

## `searchDateFilter` (type: `string`):

Filter search results by upload date.

## `searchSortBy` (type: `string`):

Sort order for search results.

## `channelUrls` (type: `array`):

List of Channel URLs (e.g., https://www.youtube.com/@ChannelName/videos).

## `maxVideosPerChannel` (type: `integer`):

Maximum regular videos to scrape per channel (0 = exclude videos).

## `maxShortsPerChannel` (type: `integer`):

Maximum Shorts to scrape per channel (0 = exclude shorts).

## `maxStreamsPerChannel` (type: `integer`):

Maximum Live Streams to scrape per channel (0 = exclude streams).

## `channelSortBy` (type: `string`):

Sort order when retrieving videos from a channel.

## `channelDateFilterMode` (type: `string`):

Custom strategy to stop scraping older channel videos.

## `channelDaysBack` (type: `integer`):

Stop scraping when videos are older than X days. Requires Date Filter Mode: relative.

## `channelMinDate` (type: `string`):

Stop scraping videos older than this. Format: YYYYMMDD. Requires Date Filter Mode: absolute.

## `downloadSubtitles` (type: `boolean`):

If disabled, only metadata (views, date, title) will be scraped.

## `subtitleLanguage` (type: `string`):

Preferred language code (e.g., 'en', 'es', 'fr').

## `preferAutoSubtitles` (type: `boolean`):

If true, prefers auto-generated captions over manual ones.

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

If true, output includes start/end times. If false, output is plain text.

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

Maximum number of parallel requests (default 5, min 5, max 20).

## Actor input object example

```json
{
  "startUrls": [
    "https://www.youtube.com/watch?v=jNQXAC9IVRw"
  ],
  "maxVideosPerSearch": 10,
  "maxShortsPerSearch": 10,
  "maxStreamsPerSearch": 10,
  "searchDateFilter": "all",
  "searchSortBy": "relevance",
  "maxVideosPerChannel": 10,
  "maxShortsPerChannel": 10,
  "maxStreamsPerChannel": 10,
  "channelSortBy": "latest",
  "channelDateFilterMode": "none",
  "channelDaysBack": 7,
  "downloadSubtitles": true,
  "subtitleLanguage": "en",
  "preferAutoSubtitles": false,
  "includeTimestamps": true,
  "maxConcurrency": 10
}
```

# 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=jNQXAC9IVRw"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("leandrocb88/youtube-video-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=jNQXAC9IVRw"] }

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

```

## MCP server setup

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