# YouTube Video & Channel Scraper (`leorochasantos/youtube-general`) Actor

Public YouTube video and channel metadata — search, channel video lists, playlists, single-video details, Shorts and trending — in one unified, typed, null-safe dataset. No API key, no login.

- **URL**: https://apify.com/leorochasantos/youtube-general.md
- **Developed by:** [Leonardo Santos](https://apify.com/leorochasantos) (community)
- **Categories:** Videos, Social media
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.33 / 1,000 video or channel records

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/platform/actors/running/actors-in-store#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 Video & Channel Scraper

Public YouTube video and channel metadata in one unified, typed, null-safe
dataset: search, channel video lists, playlists, single-video details, Shorts
and trending. Give it a handle (`@MrBeast`), a channel URL, a search phrase, a
playlist, or a video URL — it returns clean JSON rows with stable field names
(`videoId`, `viewCount`, `publishedAt`, …) that map directly onto YouTube's own
public Data API vocabulary. No API key, no login, no download.

### Why this actor?

- **One actor for the whole metadata surface** — the incumbent splits search,
  channel, video, Shorts and playlist across four actors; this one covers all
  six modes with a single typed schema.
- **Typed, null-safe flat rows** — every row carries `recordType`, its stable id
  and `scraped_at`; absent optional fields are explicit `null`, never dropped
  rows or crashes. `*Count` fields are integers, not `"1.6M"` strings.
- **Price at the floor** — $0.0005 per record undercuts the leader's FREE-tier
  $0.004/video and matches the cheapest incumbent, for a superset of surfaces.
- **API/MCP-ready** — field names match YouTube's public Data API, so agentic
  and API consumers can map rows without re-learning a schema.
- **No upstream cost** — the public metadata surface needs no key and no
  per-video fee; you pay only for the delivered, typed rows.

### Input

```json
{
  "mode": "channel",
  "channel": "@MrBeast",
  "maxResults": 10,
  "sort": "latest",
  "includeShorts": false
}
```

`mode` is required (`channel`, `search`, `playlist`, `video`, `shorts`,
`trending`); everything else defaults sensibly. `maxResults` (default 50, hard
cap 100) is the total row budget and is enforced locally — for `channel` mode it
includes the channel record, so `maxResults: 1` returns the channel only.

### Output

One row per public record; `recordType` discriminates `video` vs `channel`:

```json
{
  "recordType": "video",
  "videoId": "dQw4w9WgXcQ",
  "title": "…",
  "channelId": "UC…",
  "channelName": "…",
  "publishedAt": "2009-10-25T06:57:33.000Z",
  "durationSeconds": 212,
  "viewCount": 1600000000,
  "likeCount": 17000000,
  "commentCount": 1300000,
  "thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
  "description": "…",
  "tags": ["…"],
  "error": null,
  "scraped_at": "2026-08-15T00:00:00.000Z"
}
```

Channel rows carry `handle`, `subscriberCount`, `videoCount` and `country`
instead of the video-only fields. Dataset views (`videos`, `channels`) split the
two shapes for you.

### Pricing

### Pricing

Pay per event, and **the platform usage is on us** — the price you see is the price you pay, with no compute bill on top.

| Event | Price | What one charge buys |
|---|---|---|
| Video or channel record | **$0.0005** | Charged once per delivered public video or channel record (one dataset row). Rows are charged only after they are pushed to the dataset; a missing/invalid mode, an unresolvable handle or id, an empty search, and an upstream bot-wall/5xx/timeout are free error items and never charged. |
| Actor Start | **$0.002** | One run, whatever it returns. |

Higher Apify subscription tiers pay less on every event (Silver −20%, Gold −35%).

### Use cases

- **Channel audits** — pull a channel's profile and its latest videos in one run.
- **Search pipelines** — keyword search over YouTube returned as typed rows.
- **Single-video enrichment** — resolve one URL to id, title, views, likes,
  comments, duration and tags.
- **LLM/MCP tooling** — clean, typed JSON with YouTube-native field names; no
  scraping or parsing the site yourself.

### FAQ

**Does this actor need an API key or login?** No. It reads YouTube's public
metadata surface; there is no upstream cost. (Reachability from datacenter IPs
is gated on an on-platform probe before this actor goes live.)

**How many rows can I get?** Up to `maxResults` (default 50, hard cap 100). The
cap is enforced locally before/instead of trusting upstream, so you are never
billed for more than you asked for.

**What is a "record" for billing?** One dataset row — one video or one channel
record. A channel enumeration returns the channel record plus its videos.

**What happens when nothing matches?** An empty search/playlist, an
unresolvable handle, a missing mode, or an upstream bot-wall becomes a free
error item with the message in the `error` field — never a charged empty
success.

***

*This Actor is an independent tool and is not affiliated with, endorsed by, or
sponsored by YouTube or Google LLC. It reads only public video and channel
metadata.*

# Actor input Schema

## `mode` (type: `string`):

What to scrape. One mode per run. `channel` resolves a handle/URL/id and returns the channel record plus its video list (bounded by maxResults). `search` runs a keyword search. `playlist` returns the videos in a playlist. `video` returns one video's details. `shorts` returns a channel's Shorts. `trending` returns the trending feed.

## `channel` (type: `string`):

A channel handle (@MrBeast), channel URL, or channel id (UC...). Required when mode is `channel` or `shorts`.

## `query` (type: `string`):

Keyword(s) to search. Required when mode is `search`.

## `playlist` (type: `string`):

A playlist URL or id. Required when mode is `playlist`.

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

A single video URL (youtube.com/watch?v=...) or bare 11-character video id. Required when mode is `video`.

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

Hard cap on the total rows delivered — the billing boundary, enforced locally before/instead of trusting upstream. For `channel` mode this includes the channel record, so maxResults=1 returns the channel only.

## `sort` (type: `string`):

Video ordering for `channel` and `shorts` modes.

## `dateRange` (type: `object`):

Optional {"from": "ISO date", "to": "ISO date"} to keep only videos published in the window. Filters after fetch — never a paid add-on. The channel record is always returned regardless of the window.

## `includeShorts` (type: `boolean`):

Include Shorts in a `channel` enumeration (they are excluded by default).

## `simulate_upstream_botwall` (type: `boolean`):

Debug/test hook: forces a YouTube bot-wall (HTTP 200 with a 'sign in to confirm' challenge) so the free error path can be verified. Never enable in production.

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

Proxy to use for outgoing requests. The metadata surface is fetched through the Apify datacenter proxy by default.

## Actor input object example

```json
{
  "mode": "channel",
  "channel": "@MrBeast",
  "query": "apify actor tutorial",
  "maxResults": 50,
  "sort": "latest",
  "includeShorts": false,
  "simulate_upstream_botwall": false,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (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 = {
    "channel": "@MrBeast",
    "query": "apify actor tutorial"
};

// Run the Actor and wait for it to finish
const run = await client.actor("leorochasantos/youtube-general").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 = {
    "channel": "@MrBeast",
    "query": "apify actor tutorial",
}

# Run the Actor and wait for it to finish
run = client.actor("leorochasantos/youtube-general").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 '{
  "channel": "@MrBeast",
  "query": "apify actor tutorial"
}' |
apify call leorochasantos/youtube-general --silent --output-dataset

```

## MCP server setup

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

```

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/DPdVoRkfMpOKlSgMd/builds/hdPqWcM54O3gb6jL1/openapi.json
