# YouTube Scraper (`lentic_clockss/youtube-scraper`) Actor

YouTube scraper with transcript extraction. Search videos, scrape channels, get exact metadata, and extract subtitles/captions with timestamps. No API key, no browser. Fast HTTP-only.

- **URL**: https://apify.com/lentic\_clockss/youtube-scraper.md
- **Developed by:** [kane liu](https://apify.com/lentic_clockss) (community)
- **Categories:** Social media, Lead generation
- **Stats:** 1 total users, 1 monthly users, 50.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use 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 Scraper

Extract YouTube video data at scale — search results, channel videos, full metadata, and transcripts with timestamps — all via fast HTTP-only extraction. No browser, no login, no API key required.

### Features

- **Search YouTube** — scrape video results for any keyword with automatic pagination
- **Channel scraping** — get all videos from any YouTube channel by URL or @handle
- **Video details** — exact publish dates, categories, like counts, and full descriptions via internal YouTube APIs
- **Transcript extraction** — pull full subtitles and captions with timestamps; supports auto-generated and manually uploaded captions in any language
- **Multi-language subtitles** — specify a preferred language code; falls back gracefully to the first available language
- **Fast and lightweight** — HTTP-only extraction, no headless browser overhead
- **Auto-deduplication** — results are deduplicated by video ID across all input sources
- **Combine modes** — mix search queries, channel URLs, and video URLs in a single run

### Input

| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| `searchQueries` | array of strings | — | Keywords to search on YouTube. Each query runs independently and returns up to `maxResults` videos. |
| `channelUrls` | array of strings | — | YouTube channel URLs to scrape. Supports `/@handle`, `/channel/ID`, and `/c/name` formats. |
| `videoUrls` | array of strings | — | Individual video URLs for targeted detail or transcript extraction. |
| `maxResults` | integer | 50 | Maximum videos to return per search query or channel (1–5000). |
| `scrapeDetails` | boolean | false | Fetch full video metadata (exact publish date, category, like count, full description) for each result. Slower but more complete. |
| `includeTranscript` | boolean | false | Extract full transcript/subtitles with timestamps. Works for any video with captions (auto-generated or manual). |
| `transcriptLanguage` | string | `"en"` | Preferred transcript language code (e.g. `"en"`, `"es"`, `"ja"`, `"de"`). Falls back to the first available language if the requested one is not found. |

At least one of `searchQueries`, `channelUrls`, or `videoUrls` is required.

### Output Fields

| Field | Type | Available in | Description |
|-------|------|-------------|-------------|
| `videoId` | string | all modes | YouTube video ID |
| `title` | string | all modes | Video title |
| `url` | string | all modes | Full YouTube video URL |
| `channelName` | string | all modes | Channel display name |
| `channelId` | string | all modes | YouTube channel ID |
| `channelUrl` | string | all modes | Channel URL |
| `viewCount` | integer | all modes | Total view count |
| `duration` | string | search / channel | Human-readable duration (e.g. `"1:08:23"`) |
| `durationSeconds` | integer | all modes | Duration in seconds |
| `publishedText` | string | search / channel | Relative publish time (e.g. `"5 years ago"`) |
| `publishedAt` | string | details mode | Exact ISO 8601 publish date (e.g. `"2020-11-18T08:05:43-08:00"`) |
| `description` | string | all modes | Video description — snippet for search results, full text when details are enabled |
| `thumbnailUrl` | string | all modes | Highest-quality thumbnail URL |
| `category` | string | details mode | Video category (e.g. `"Education"`, `"Science & Technology"`) |
| `isLive` | boolean | all modes | Whether the video is an active live stream |
| `transcript` | array of objects | transcript mode | Full transcript as an array of `{ "start": float, "duration": float, "text": string }` entries |
| `transcriptLanguage` | string | transcript mode | Language code of the transcript that was returned |
| `transcriptText` | string | transcript mode | Full transcript as a single concatenated plain-text string |

### Usage Examples

#### Search YouTube

Search for videos matching one or more keywords. Pagination is handled automatically.

```json
{
  "searchQueries": ["web scraping tutorial", "python automation"],
  "maxResults": 50
}
````

#### Scrape Channel Videos

Get all videos from a YouTube channel. Use the channel's `@handle`, `/channel/ID`, or `/c/name` URL.

```json
{
  "channelUrls": [
    "https://www.youtube.com/@freecodecamp",
    "https://www.youtube.com/@TechWithTim"
  ],
  "maxResults": 200
}
```

#### Get Video Details

Fetch full metadata for specific videos — exact publish date, category, like count, and complete description.

```json
{
  "videoUrls": [
    "https://www.youtube.com/watch?v=XVv6mJpFOb0",
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
  ],
  "scrapeDetails": true
}
```

#### Extract Transcripts / Subtitles

Pull full transcripts with timestamps for any video that has captions (auto-generated or manually uploaded). This is a YouTube transcript extractor and YouTube subtitle extractor in one — no third-party captioning service required.

```json
{
  "videoUrls": ["https://www.youtube.com/watch?v=XVv6mJpFOb0"],
  "includeTranscript": true,
  "transcriptLanguage": "en"
}
```

Each transcript entry in the output looks like:

```json
{
  "start": 12.4,
  "duration": 3.2,
  "text": "Welcome to this tutorial on web scraping."
}
```

#### Search with Full Details and Transcripts

Combine all modes in one run — search for videos, enrich with exact metadata, and extract captions.

```json
{
  "searchQueries": ["machine learning explained"],
  "maxResults": 20,
  "scrapeDetails": true,
  "includeTranscript": true,
  "transcriptLanguage": "en"
}
```

### Pricing

| Mode | Approximate throughput |
|------|----------------------|
| Search only | ~50 videos per compute unit |
| Search + details | ~10 videos per compute unit |
| Search + details + transcript | ~8 videos per compute unit |

Transcript extraction is included at no extra cost — **approximately $2 per 1,000 results**, making this one of the most cost-effective YouTube scraping and transcript extraction solutions on Apify Store.

### Notes

- **No API key needed** — this actor works entirely through publicly accessible YouTube endpoints. You do not need a Google/YouTube Data API key.
- **No browser** — pure HTTP extraction means faster runs and lower cost compared to browser-based scrapers.
- **Transcript availability** — transcripts are only available for videos where captions have been enabled by the creator or auto-generated by YouTube. Videos without any captions will return an empty `transcript` field.
- **Language fallback** — if the requested `transcriptLanguage` is not available, the actor returns the first available language and reports it in `transcriptLanguage`.
- **Rate limits** — the actor uses residential proxies automatically on the Apify platform. Running locally without proxies may result in temporary rate limiting on large runs.
- **Public data only** — all extracted data is publicly visible to any YouTube visitor without an account. No authentication or login is used.

### Legal

This actor extracts publicly available data from YouTube. No login or authentication is used. All data is obtained from public pages and endpoints accessible to any internet user without an account.

# Actor input Schema

## `searchQueries` (type: `array`):

Keywords to search on YouTube. Each query runs independently and returns up to maxResults videos. Example: \["web scraping tutorial", "python automation"].

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

YouTube channel URLs to scrape all videos from. Supports @handle, /channel/ID, and /c/name formats. Example: \["https://www.youtube.com/@freecodecamp"].

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

Individual YouTube video URLs for targeted metadata or transcript extraction. Use with scrapeDetails or includeTranscript for full data.

## `maxResults` (type: `integer`):

Maximum number of videos to return per search query or channel. Applies to searchQueries and channelUrls. Default: 50.

## `scrapeDetails` (type: `boolean`):

Fetch full video metadata for each result: exact publish date (ISO 8601), category, like count, and complete description. Increases run time but provides much richer data.

## `includeTranscript` (type: `boolean`):

Extract the full transcript (subtitles/captions) with timestamps for each video. Supports both auto-generated and manually uploaded captions. Works with all input modes. Videos without captions return an empty transcript.

## `transcriptLanguage` (type: `string`):

Preferred transcript language code (e.g. "en" for English, "es" for Spanish, "ja" for Japanese). If the requested language is not available, falls back to the first available language.

## Actor input object example

```json
{
  "searchQueries": [
    "python automation",
    "machine learning beginner"
  ],
  "channelUrls": [
    "https://www.youtube.com/@freecodecamp"
  ],
  "videoUrls": [
    "https://www.youtube.com/watch?v=XVv6mJpFOb0"
  ],
  "maxResults": 50,
  "scrapeDetails": false,
  "includeTranscript": false,
  "transcriptLanguage": "en"
}
```

# Actor output Schema

## `videos` (type: `string`):

Dataset containing all scraped YouTube video data

# 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 = {
    "searchQueries": [
        "web scraping tutorial"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("lentic_clockss/youtube-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 = { "searchQueries": ["web scraping tutorial"] }

# Run the Actor and wait for it to finish
run = client.actor("lentic_clockss/youtube-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "web scraping tutorial"
  ]
}' |
apify call lentic_clockss/youtube-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=lentic_clockss/youtube-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Scraper",
        "description": "YouTube scraper with transcript extraction. Search videos, scrape channels, get exact metadata, and extract subtitles/captions with timestamps. No API key, no browser. Fast HTTP-only.",
        "version": "0.1",
        "x-build-id": "BKgqAyfPGBUPVUTkw"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/lentic_clockss~youtube-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-lentic_clockss-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/lentic_clockss~youtube-scraper/runs": {
            "post": {
                "operationId": "runs-sync-lentic_clockss-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/lentic_clockss~youtube-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-lentic_clockss-youtube-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "properties": {
                    "searchQueries": {
                        "title": "Search Queries",
                        "type": "array",
                        "description": "Keywords to search on YouTube. Each query runs independently and returns up to maxResults videos. Example: [\"web scraping tutorial\", \"python automation\"].",
                        "items": {
                            "type": "string"
                        }
                    },
                    "channelUrls": {
                        "title": "Channel URLs",
                        "type": "array",
                        "description": "YouTube channel URLs to scrape all videos from. Supports @handle, /channel/ID, and /c/name formats. Example: [\"https://www.youtube.com/@freecodecamp\"].",
                        "items": {
                            "type": "string"
                        }
                    },
                    "videoUrls": {
                        "title": "Video URLs",
                        "type": "array",
                        "description": "Individual YouTube video URLs for targeted metadata or transcript extraction. Use with scrapeDetails or includeTranscript for full data.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Max Results",
                        "minimum": 1,
                        "maximum": 5000,
                        "type": "integer",
                        "description": "Maximum number of videos to return per search query or channel. Applies to searchQueries and channelUrls. Default: 50.",
                        "default": 50
                    },
                    "scrapeDetails": {
                        "title": "Scrape Video Details",
                        "type": "boolean",
                        "description": "Fetch full video metadata for each result: exact publish date (ISO 8601), category, like count, and complete description. Increases run time but provides much richer data.",
                        "default": false
                    },
                    "includeTranscript": {
                        "title": "Include Transcript",
                        "type": "boolean",
                        "description": "Extract the full transcript (subtitles/captions) with timestamps for each video. Supports both auto-generated and manually uploaded captions. Works with all input modes. Videos without captions return an empty transcript.",
                        "default": false
                    },
                    "transcriptLanguage": {
                        "title": "Transcript Language",
                        "type": "string",
                        "description": "Preferred transcript language code (e.g. \"en\" for English, \"es\" for Spanish, \"ja\" for Japanese). If the requested language is not available, falls back to the first available language.",
                        "default": "en"
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
