# YouTube Scraper - Extract Videos, Channels & Shorts (`santamaria-automations/youtube-scraper`) Actor

Scrape YouTube videos, channels, and Shorts without an API key. Search by keyword and extract video titles, views, likes, comments, tags, thumbnails,  descriptions, and engagement rates. Scrape channel subscriber counts, video lists, and metadata.

- **URL**: https://apify.com/santamaria-automations/youtube-scraper.md
- **Developed by:** [NanoScrape](https://apify.com/santamaria-automations) (community)
- **Categories:** Social media, Videos
- **Features:** Limited permissions
- **Stats:** 13 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 search result scrapeds

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

## YouTube Scraper

Scrape [YouTube](https://www.youtube.com/) videos, channels, Shorts, and search results. Extract views, likes, comments, tags, descriptions, thumbnails, engagement metrics, and channel info. No API key required.

### Four Scraping Modes

| Mode | Input | Output | Use Case |
|------|-------|--------|----------|
| **SEARCH** | Keywords | Videos from search results | Find videos by topic |
| **CHANNEL** | Channel URLs | Channel info + video list | Analyze a creator's content |
| **SHORTS** | Channel URLs | Channel info + Shorts list | Track short-form content |
| **VIDEO** | Video URLs/IDs | Full video metadata | Deep analysis of specific videos |

### Use with AI Agents (MCP)

Connect this actor to any MCP-compatible AI client — Claude Desktop, Claude.ai, Cursor, VS Code, LangChain, LlamaIndex, or custom agents.

**Apify MCP server URL:**

```
https://mcp.apify.com?tools=santamaria-automations/youtube-scraper
```

**Example prompt once connected:**

> "Use `youtube-scraper` to scrape data from youtube. Return results as a table."

Clients that support dynamic tool discovery (Claude.ai, VS Code) will receive the full input schema automatically via `add-actor`.

### Features

- **Multi-query support** — Search multiple keywords in a single run with per-query limits
- **Deduplication** — Same video found by different queries is only returned once
- **Detail enrichment** — Toggle `includeDetails` for likes, comments, tags, category, and full description
- **No API key needed** — Works without YouTube Data API credentials
- **Engagement rate** — Automatically calculated from likes + comments / views
- **Shorts detection** — Identifies YouTube Shorts with `is_short` flag
- **Channel metadata** — Subscriber count, video count, handle, verification status
- **Thumbnail preview** — See thumbnails directly in the Apify dataset table
- **Pay-per-result** — Only pay for results you get, no monthly fees

### Data Extracted

#### Search results (fast)

| Field | Example |
|-------|---------|
| `title` | "React Tutorial for Beginners" |
| `video_url` | "https://www.youtube.com/watch?v=..." |
| `thumbnail_url` | "https://i.ytimg.com/vi/.../hq720.jpg" |
| `view_count` | 5681802 |
| `duration` | "1:00:06" |
| `channel_name` | "Programming with Mosh" |
| `channel_url` | "https://www.youtube.com/@programmingwithmosh" |
| `published_at` | "2 years ago" |
| `is_short` | false |
| `search_query` | "react tutorial" |

#### With `includeDetails: true` (complete)

All fields above, plus:

| Field | Example |
|-------|---------|
| `like_count` | 95000 |
| `comment_count` | 1900 |
| `engagement_rate` | 1.705 |
| `description` | Full video description text |
| `tags` | \["react", "javascript", "tutorial", ...] |
| `category` | "Education" |
| `published_at` | "2024-09-16T05:00:00-07:00" (exact ISO date) |
| `channel_subscribers` | "4.2M subscribers" |

#### Channel data (channel/shorts modes)

| Field | Example |
|-------|---------|
| `name` | "MrBeast" |
| `handle` | "@MrBeast" |
| `subscriber_count` | "472M subscribers" |
| `video_count` | "960 videos" |
| `channel_url` | "https://www.youtube.com/@MrBeast" |

### Pricing

Pay-per-result pricing. You only pay for the data you receive.

| Event | Price | Description |
|-------|-------|-------------|
| Search result scraped | $0.001 | A video entry from search results |
| Video details extracted | $0.003 | Full metadata from a video page |
| Channel scraped | $0.001 | Channel info with video listings |

**Examples:**

- 1,000 search results = **$1.00**
- 500 videos with full details = **$1.50**
- 10 channels + 500 videos = **$0.51**

No monthly fees. No minimum spend.

### Input

| Field | Type | Description | Default |
|-------|------|-------------|---------|
| `mode` | string | `search`, `channel`, `video`, or `shorts` | `search` |
| `searchQueries` | string\[] | Keywords to search (search mode) | `[]` |
| `urls` | string\[] | YouTube URLs (channel/video/shorts modes) | `[]` |
| `maxResults` | integer | Maximum total results. | `100` |
| `maxResultsPerQuery` | integer | Maximum results per query/URL | `100` |
| `sortBy` | string | `relevance`, `date`, `views`, `rating` | `relevance` |
| `includeDetails` | boolean | Fetch detail pages for likes, tags, etc. | `false` |

### Usage Examples

#### Search for videos by keyword

```json
{
  "mode": "search",
  "searchQueries": ["web scraping tutorial", "python automation"],
  "maxResults": 100,
  "maxResultsPerQuery": 50,
  "sortBy": "relevance",
  "includeDetails": true
}
```

#### Scrape all videos from a channel

```json
{
  "mode": "channel",
  "urls": ["https://www.youtube.com/@MrBeast"],
  "maxResults": 200
}
```

#### Get full details for specific videos

```json
{
  "mode": "video",
  "urls": [
    "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "https://www.youtube.com/watch?v=9bZkp7q19f0"
  ]
}
```

#### Scrape Shorts from a channel

```json
{
  "mode": "shorts",
  "urls": ["https://www.youtube.com/@MrBeast"],
  "maxResults": 50
}
```

### Supported URL Formats

- `https://www.youtube.com/@MrBeast` — Channel by handle
- `https://www.youtube.com/channel/UCX6OQ3DkcsbYNE6H8uQQuVA` — Channel by ID
- `https://www.youtube.com/watch?v=dQw4w9WgXcQ` — Video URL
- `https://youtu.be/dQw4w9WgXcQ` — Short URL
- `https://www.youtube.com/shorts/abc123` — Shorts URL
- `dQw4w9WgXcQ` — Just the video ID

### Output

Results are exported to the default dataset. A **YouTube Videos** table view shows thumbnails, titles, views, likes, comments, engagement, and duration at a glance.

Export to JSON, CSV, Excel, or connect via API.

### FAQ

**Do I need a YouTube API key?**
No. This scraper works without any API key or credentials.

**What's the difference between search mode and search + details?**
Search mode returns basic data from search results (fast). With `includeDetails: true`, each video's page is also visited to get likes, comments, tags, category, and full description.

**Can I scrape comments?**
The scraper extracts the total comment count per video. Full comment text extraction is not yet supported.

**Does this work with YouTube Shorts?**
Yes. Use `shorts` mode with a channel URL, or check the `is_short` flag in other modes.

**How many videos can I scrape?**
Up to 10,000 per run. For larger volumes, run multiple instances with different queries.

### Related Actors

**Related Scrapers**

- [Google News Scraper — News articles](https://apify.com/santamaria-automations/google-news-scraper)
- [Kununu.de Scraper — Employer reviews](https://apify.com/santamaria-automations/kununu-de-scraper)
- [Eventbrite Scraper — Event listings](https://apify.com/santamaria-automations/eventbrite-scraper)
- [Similarweb Scraper — Website analytics](https://apify.com/santamaria-automations/similarweb-scraper)

**Enrich your data**

- [Website Email & Phone Scraper](https://apify.com/santamaria-automations/website-email-scraper)
- [Google Maps Scraper](https://apify.com/santamaria-automations/google-maps-scraper)
- [Website Contact Extractor](https://apify.com/santamaria-automations/website-contact-extractor)

### Issues & Feature Requests

If something is not working or you're missing a feature or data field, please [open an issue](https://console.apify.com/actors/OkoPo1EdR1NdwVEaA/issues) and we'll look into it.

# Actor input Schema

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

What to scrape: 'search' for keyword search, 'channel' for channel videos, 'video' for specific video details, 'shorts' for channel Shorts.

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

Keywords to search on YouTube (for 'search' mode). Each query runs a separate search.

## `urls` (type: `array`):

YouTube URLs to process. For 'channel' and 'shorts' modes: channel URLs (e.g., https://www.youtube.com/@MrBeast). For 'video' mode: video URLs or IDs.

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

Maximum total number of results to return across all queries/URLs. Set to 0 for unlimited.

## `maxResultsPerQuery` (type: `integer`):

Maximum results per individual search query or channel URL. Defaults to maxResults if not set.

## `sortBy` (type: `string`):

Sort order for search results. Only applies to 'search' mode.

## `includeDetails` (type: `boolean`):

Fetch each video's detail page for richer data: exact like/comment counts, full description, tags, category, language. Slower but much more complete.

## Actor input object example

```json
{
  "mode": "search",
  "searchQueries": [
    "web scraping tutorial"
  ],
  "urls": [
    "https://www.youtube.com/@MrBeast"
  ],
  "maxResults": 20,
  "maxResultsPerQuery": 0,
  "sortBy": "relevance",
  "includeDetails": false
}
```

# Actor output Schema

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

Dataset containing scraped video and channel 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 = {
    "mode": "search",
    "searchQueries": [
        "web scraping tutorial"
    ],
    "urls": [
        "https://www.youtube.com/@MrBeast"
    ],
    "maxResults": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("santamaria-automations/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 = {
    "mode": "search",
    "searchQueries": ["web scraping tutorial"],
    "urls": ["https://www.youtube.com/@MrBeast"],
    "maxResults": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("santamaria-automations/youtube-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 '{
  "mode": "search",
  "searchQueries": [
    "web scraping tutorial"
  ],
  "urls": [
    "https://www.youtube.com/@MrBeast"
  ],
  "maxResults": 20
}' |
apify call santamaria-automations/youtube-scraper --silent --output-dataset

```

## MCP server setup

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