# ScrapeClaw - Youtube\_Scraper (`scrapeclaw/youtube-scrapper`) Actor

Part of ScrapeClaw (https://scrapeclaw.cc/) — a suite of production-ready, agentic social media scrapers for Instagram, YouTube, X/Twitter, TikTok, and Facebook. Built with Python & Playwright. No API keys required.

- **URL**: https://apify.com/scrapeclaw/youtube-scrapper.md
- **Developed by:** [Scrapeclaw](https://apify.com/scrapeclaw) (community)
- **Categories:** AI, Lead generation, Social media
- **Stats:** 3 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / actor start

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/actors/running/actors-in-store.md#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 Channel Scraper

> Part of **[ScrapeClaw](https://www.scrapeclaw.cc/)** — a suite of production-ready, agentic social media scrapers for Instagram, YouTube, X/Twitter, and Facebook. Built with Python & Playwright. No API keys required.

[![ScrapeClaw](https://img.shields.io/badge/ScrapeClaw-Visit%20Site-blue?style=flat-square)](https://www.scrapeclaw.cc/)
[![ClawHub](https://img.shields.io/badge/ClawHub-View%20Skill-green?style=flat-square)](https://clawhub.ai/ArulmozhiV/youtube-scrapper)
[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-PayPal-yellow?style=flat-square\&logo=paypal)](https://www.paypal.com/paypalme/arulmozhivelu)

***

### What Is This?

A browser-based YouTube scraper that discovers and extracts structured data from **public YouTube channels** — without any official API. It uses Playwright for full browser automation with built-in anti-detection, fingerprinting, and human behavior simulation to scrape at scale reliably.

Two-phase workflow:

1. **Discovery** — Find YouTube channels by location and category via Google Search
2. **Scraping** — Extract full channel data, subscriber counts, videos, and metadata using a real browser session

***

### Features

| Feature | Description |
|---------|-------------|
| 🔍 **Discovery** | Find channels by city and category automatically |
| 🌐 **Browser Simulation** | Full Playwright browser — renders JavaScript, bypasses bot detection |
| 🛡️ **Anti-Detection** | Browser fingerprinting, stealth scripts, human behavior simulation |
| 📊 **Rich Data** | Channel info, subscriber counts, video metrics, influencer tier |
| 🎬 **Video Data** | Recent videos with title, views, upload date, duration, and thumbnail URL |
| 🖼️ **Media Download** | Profile pics and video thumbnails saved to Key-Value store |
| 💾 **Flexible Export** | JSON and CSV output formats |
| 🔄 **Resume Support** | Checkpoint-based resume for interrupted sessions |
| ⚡ **Smart Filtering** | Auto-skip channels below subscriber threshold |
| 🌍 **Residential Proxy** | Built-in proxy manager supporting 4 major providers |

***

### Installation

```bash
## Clone the repository
git clone https://github.com/Scrapeclaw/youtube-scrapper.git
cd youtube-scrapper

## Install Python dependencies
pip install -r requirements.txt

## Install Playwright browsers
playwright install chromium
```

#### Environment Setup

Create a `.env` file in the project root:

```env
## Google Custom Search API (optional, for discovery)
GOOGLE_API_KEY=your_google_api_key
GOOGLE_SEARCH_ENGINE_ID=your_search_engine_id

## Residential proxy (optional — see Proxy section below)
PROXY_ENABLED=false
PROXY_PROVIDER=brightdata
PROXY_USERNAME=your_proxy_user
PROXY_PASSWORD=your_proxy_pass
PROXY_COUNTRY=in
PROXY_STICKY=true
```

***

### Usage

#### Discover Channels

```bash
## Discover tech channels in India
python scripts/youtube_orchestrator.py --config resources/scraper_config_ind.json --discovery-only

## Discover gaming channels in the US
python scripts/youtube_orchestrator.py --config resources/scraper_config_us.json --discovery-only

## Discover with custom categories and locations
python scripts/youtube_orchestrator.py --config resources/scraper_config_ind.json --categories tech gaming --locations "Mumbai" "Delhi"
```

#### Scrape

```bash
## Full pipeline — discover then scrape (India preset)
python scripts/youtube_orchestrator.py --config resources/scraper_config_ind.json

## Scrape from an existing discovery queue file
python scripts/youtube_orchestrator.py --scrape-only --queue data/queue/ind/mixed_India_20260226.json

## Resume an interrupted scrape session
python scripts/youtube_orchestrator.py --config resources/scraper_config_ind.json --resume

## Run with browser window visible (for debugging)
python scripts/youtube_orchestrator.py --config resources/scraper_config_ind.json --no-headless
```

#### Run as Apify Actor

```bash
## Install Apify SDK
pip install apify-sdk

## Run the actor entry point locally
python src/main.py
```

***

### Output Data

Each scraped channel is saved as one record in the default dataset:

```json
{
  "channel_id": "TechBurner",
  "channel_name": "Tech Burner",
  "handle": "@TechBurner",
  "channel_url": "https://www.youtube.com/@TechBurner",
  "subscribers": 8500000,
  "influencer_tier": "mega",
  "video_count": 6,
  "total_views": 950000000,
  "description": "India's largest tech YouTube channel…",
  "profile_pic_url": "https://yt3.googleusercontent.com/%E2%80%A6",
  "banner_url": "https://yt3.googleusercontent.com/%E2%80%A6",
  "is_verified": true,
  "joined_date": "Jan 1, 2016",
  "country": "India",
  "category": "tech",
  "location": "India",
  "external_links": ["https://instagram.com/techburner"],
  "recent_videos": [
    {
      "video_id": "dQw4w9WgXcQ",
      "title": "Best Budget Smartphones 2025",
      "thumbnail_url": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
      "view_count": 1200000,
      "upload_date": "2 days ago",
      "duration": "12:34"
    }
  ],
  "video_urls": ["https://www.youtube.com/watch?v=dQw4w9WgXcQ"],
  "scrape_timestamp": "2026-03-03T10:30:00.000Z"
}
```

#### Influencer Tiers

| Tier | Subscribers |
|------|-------------|
| nano | < 10,000 |
| micro | 10,000 – 99,999 |
| mid | 100,000 – 999,999 |
| macro | 1,000,000 – 9,999,999 |
| mega | > 10,000,000 |

***

### Configuration Reference

Edit `resources/scraper_config_ind.json` to customise behaviour:

```json
{
  "proxy": {
    "enabled": false,
    "provider": "brightdata",
    "country": "in",
    "sticky": true,
    "sticky_ttl_minutes": 10
  },
  "categories": ["gaming", "tech", "beauty", "fashion", "fitness", "food"],
  "locations": ["India", "Mumbai", "Delhi", "Bangalore"],
  "max_videos_to_scrape": 6,
  "headless": false,
  "results_per_search": 20,
  "search_delay": [3, 7],
  "scrape_delay": [2, 5],
  "rate_limit_wait": 60,
  "max_retries": 3
}
```

***

### Project Structure

```
youtube-scrapper/
├── src/
│   └── main.py                        # Apify actor entry point
├── scripts/
│   ├── youtube_orchestrator.py        # Resilient orchestration pipeline
│   ├── youtube_channel_discovery.py   # Google Search-based channel discovery
│   ├── youtube_channel_scraper.py     # Playwright-based channel scraper
│   ├── anti_detection.py              # Fingerprinting & stealth helpers
│   └── proxy_manager.py               # Residential proxy integration
├── resources/
│   ├── scraper_config_ind.json        # India region preset
│   ├── scraper_config_us.json         # US region preset
│   ├── scraper_config_uk.json         # UK region preset
│   └── scraper_config_*.json          # Other region presets
├── .actor/
│   ├── actor.json                     # Apify actor manifest
│   ├── input_schema.json              # Input schema (UI form)
│   └── output_schema.json             # Output schema
├── Dockerfile
└── requirements.txt
```

***

### Part of ScrapeClaw

This scraper is one of several tools in the **[ScrapeClaw](https://www.scrapeclaw.cc/)** collection:

| Scraper | Description | Links |
|---------|-------------|-------|
| 🎥 **YouTube** | Channels, subscribers & video metadata | [GitHub](https://github.com/Scrapeclaw/youtube-scrapper) · [ClawHub](https://clawhub.ai/ArulmozhiV/youtube-scrapper) |
| 📸 **Instagram** | Profiles, posts, media & follower counts | [GitHub](https://github.com/Scrapeclaw/instagram-scraper) · [ClawHub](https://clawhub.ai/ArulmozhiV/instagram-scraper) |
| 📘 **Facebook** | Pages, groups, posts & engagement data | [GitHub](https://github.com/Scrapeclaw/facebook-scraper) · [ClawHub](https://clawhub.ai/ArulmozhiV/facebook-scraper) |
| 🐦 **X / Twitter** | Tweets, profiles & engagement metrics | [GitHub](https://github.com/Scrapeclaw/twitter-scraper) · [ClawHub](https://clawhub.ai/ArulmozhiV/x-twitter-scraper) |

All scrapers share the same anti-detection foundation, proxy support, and JSON/CSV export pipeline.

***

### 🚀 ScrapeClaw Customised Solutions

> **We build, you own.** No per-credit fees. Stop renting data — own your entire scraping infrastructure.

ScrapeClaw offers two commercial offerings for teams and businesses that need more than open-source:

#### 📦 Tailored Datasets

Get pre-scraped or on-demand datasets built around your exact industry, platform, or niche — delivered ready for analysis.

- Industry-specific social media datasets on demand
- Custom extraction logic ("Skills") for your use case
- One-time delivery or recurring data feeds
- Output in CSV, JSON, or direct database delivery

👉 [**Request a Dataset →**](https://www.scrapeclaw.cc/)

#### 🏗️ Private Infrastructure Setup ★ High Value

We deploy a turnkey ScrapeClaw system on your own servers — you own 100% of the infrastructure and the data.

- 🔒 **Privacy & Compliance** — data never leaves your network, ideal for FinTech & Health
- 🤖 **Self-Healing Agents** — AI-powered scrapers that adapt when sites change
- 💸 **Slash API Costs** — stop paying $1–5 per 1K requests; scrape 1M rows at flat infra cost
- Includes **1 month of managed maintenance & support**

👉 [**Book a Strategy Call →**](https://www.scrapeclaw.cc/)

***

### ☕ Support This Project

If this tool saves you time or helps your workflow, consider buying me a coffee — it keeps the project maintained and new scrapers coming!

[![Buy Me a Coffee via PayPal](https://img.shields.io/badge/☕%20Buy%20Me%20a%20Coffee-PayPal-blue?style=for-the-badge\&logo=paypal)](https://www.paypal.com/paypalme/arulmozhivelu)

👉 **[paypal.me/arulmozhivelu](https://www.paypal.com/paypalme/arulmozhivelu)**

***

### Disclaimer

This tool is intended for scraping **publicly available** data only. No login is required or used. Always comply with YouTube's Terms of Service and your local data privacy regulations. The author is not responsible for any misuse.

***

*Built by [ScrapeClaw](https://www.scrapeclaw.cc/) · [View all scrapers](https://apify.com/scrapeclaw)*

# Actor input Schema

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

full = discover channels then scrape them; discovery\_only = only find channel handles; scrape\_channels = scrape the channelHandles list directly.

## `region` (type: `string`):

Pre-configured region with relevant categories and locations. Choose 'custom' to specify your own.

## `categories` (type: `array`):

Content categories to discover (used when region = custom or to override preset).

## `locations` (type: `array`):

Geographic locations to search within (used when region = custom or to override preset).

## `channelHandles` (type: `array`):

List of YouTube channel handles or URLs to scrape directly. Used when mode = scrape\_channels.

## `maxChannels` (type: `integer`):

Maximum number of channels to scrape (0 = unlimited).

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

Number of recent videos to scrape per channel.

## `downloadThumbnails` (type: `boolean`):

If enabled, profile pics and video thumbnails are downloaded and stored in the actor's Key-Value store.

## `minSubscribers` (type: `integer`):

Skip channels with fewer subscribers than this value (0 = no filter).

## `maxDiscoveryRetries` (type: `integer`):

How many times to retry the discovery phase on failure.

## `headless` (type: `boolean`):

Run the browser in headless mode. Always true on Apify; set to false for local debugging only.

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

Apify proxy settings. Leave empty to run without a proxy or use Apify Residential proxies.

## Actor input object example

```json
{
  "mode": "full",
  "region": "ind",
  "categories": [
    "gaming",
    "tech",
    "beauty",
    "fashion",
    "fitness"
  ],
  "locations": [
    "India"
  ],
  "channelHandles": [
    "@MrBeast",
    "@Veritasium",
    "https://www.youtube.com/@mkbhd"
  ],
  "maxChannels": 100,
  "maxVideosPerChannel": 6,
  "downloadThumbnails": false,
  "minSubscribers": 0,
  "maxDiscoveryRetries": 3,
  "headless": true,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}
```

# Actor output Schema

## `channelResults` (type: `string`):

All scraped YouTube channels stored in the default dataset. Each item contains channel name, handle, subscribers, influencer tier, total views, recent videos, and more.

## `thumbnails` (type: `string`):

Profile pictures and video thumbnails downloaded to the key-value store. Only populated when the 'downloadThumbnails' input option is enabled.

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

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

# Run the Actor and wait for it to finish
run = client.actor("scrapeclaw/youtube-scrapper").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 '{
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ]
  }
}' |
apify call scrapeclaw/youtube-scrapper --silent --output-dataset

```

## MCP server setup

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

```

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/b9SVmeF4QdrvfIE6e/builds/i4uRhDad5SkGC8sLf/openapi.json
