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

Scrape YouTube search results, channels, playlists and videos: views, likes, exact publish date, duration, category, tags, description and channel stats. Pay only for videos returned.

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

## Pricing

$1.20 / 1,000 videos

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 **search results, channels, playlists and videos**. Every video comes with **views, likes, the exact publish date, duration, category, tags and the full description**, and you can add **channel stats** (subscribers, video count, handle). Use the data for influencer research, competitor tracking, content ideas, SEO, or as a data source for AI agents.

You pay only for videos that came back with data. Proxies are included.

### What you can scrape

| Source | Example |
|---|---|
| Search results, with filters | `best laptop 2026`, sorted by views, uploaded this month |
| Channel uploads, newest first | `https://www.youtube.com/@mkbhd` |
| Playlists | `https://www.youtube.com/playlist?list=…` |
| Single videos and Shorts | `https://www.youtube.com/watch?v=…`, `https://youtu.be/…` |

**Search filters:** sort by relevance, view count, upload date or rating, plus upload date (last hour to this year) and duration (under 4 minutes, 4–20 minutes, over 20 minutes).

### Input example

```json
{
  "searchQueries": ["web scraping tutorial"],
  "urls": ["https://www.youtube.com/@mkbhd"],
  "maxResults": 50,
  "sortBy": "views",
  "includeChannelInfo": true
}
```

### Output example

```json
{
  "status": "ok",
  "videoId": "e1q-TuHdc4Y",
  "url": "https://www.youtube.com/watch?v=e1q-TuHdc4Y",
  "title": "Dear YouTube!",
  "channelName": "Marques Brownlee",
  "channelId": "UCBJycsmduvYEL83R_U4JriQ",
  "channelUrl": "https://www.youtube.com/channel/UCBJycsmduvYEL83R_U4JriQ",
  "viewCount": 5862637,
  "likeCount": 128190,
  "durationSeconds": 743,
  "publishedAt": "2026-09-30T07:42:19-07:00",
  "category": "Science & Technology",
  "keywords": ["mkbhd", "youtube"],
  "description": "…",
  "isLive": false,
  "thumbnail": "https://i.ytimg.com/vi/e1q-TuHdc4Y/hqdefault.jpg",
  "source": "channel",
  "sourceUrl": "@mkbhd",
  "channelHandle": "@mkbhd",
  "channelSubscribers": 21400000,
  "channelVideoCount": 1800,
  "scrapedAt": "2026-10-27T17:50:47.710Z"
}
```

Videos that are private, deleted or region-locked appear with `status: "unavailable"` and are not charged.

### Pricing

You pay a fixed price per video, whether you turn on full details and channel details or not. Proxies are included. Set a maximum cost per run in the run options, and the Actor stops when it is reached.

### Tips

- For a channel's complete history, set **Max videos** high. Channels return their uploads newest first.
- YouTube applies search sorting loosely, especially together with an upload date filter. For a strict order, sort the dataset by `viewCount` or `publishedAt`.
- Search usually stops at around 500 to 700 results per query, so split broad topics into several queries.
- Need transcripts too? Use the **YouTube Transcript Scraper** by the same author.

### Is scraping YouTube legal?

The Actor reads only public video and channel information that YouTube shows to any visitor. Check that your use follows the laws and terms that apply to you, especially for personal data.

### Feedback

Found a bug or need another field? Open an issue on the **Issues** tab.

# Actor input Schema

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

What you would type into the YouTube search box.

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

Videos, Shorts, playlists or channels (for example https://www.youtube.com/@mkbhd). Channels return their latest uploads first.

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

Search usually stops at around 500 to 700 results.

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

YouTube applies sorting loosely, especially together with an upload date filter.

## `uploadDate` (type: `string`):

Only for search queries.

## `duration` (type: `string`):

Only for search queries.

## `fetchDetails` (type: `boolean`):

Likes, exact publish date, category, tags and the full description. The price is the same either way.

## `includeChannelInfo` (type: `boolean`):

Adds subscribers, video count, handle, avatar and the channel description to every video.

## `language` (type: `string`):

Affects the language of search results and texts, for example en, de, uk.

## `country` (type: `string`):

Two-letter country code for search results, for example US, GB, DE.

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

Higher is faster, but YouTube blocks more requests, so more of them are retried.

## `maxAttempts` (type: `integer`):

Each blocked request is retried with a new proxy session.

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

Apify Proxy is used by default. Residential IPs take over automatically when YouTube blocks a request. Proxy costs are included in the price.

## Actor input object example

```json
{
  "searchQueries": [
    "web scraping tutorial",
    "best laptop 2026"
  ],
  "urls": [
    "https://www.youtube.com/@mkbhd"
  ],
  "maxResults": 20,
  "sortBy": "relevance",
  "uploadDate": "any",
  "duration": "any",
  "fetchDetails": true,
  "includeChannelInfo": false,
  "language": "en",
  "country": "US",
  "maxConcurrency": 8,
  "maxAttempts": 6,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

## `results` (type: `string`):

All videos.

## `overview` (type: `string`):

The overview view of the dataset.

# 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"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("deadmist/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"],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("deadmist/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 '{
  "searchQueries": [
    "web scraping tutorial"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call deadmist/youtube-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,deadmist/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/9lR9r1T6am3xj5v9d/builds/UFvnmzvDju6o07RgX/openapi.json
