# Youtube Channel Scraper (`scrapeai/youtube-channel-scraper`) Actor

YouTube channel scraper built with Puppeteer/Playwright that extracts channel name, description, subscribers, total views, video count, joined date, country, and external links (Instagram, TikTok, website, etc.). Handles “...more” popup, parses redirect URLs, and stores clean structured JSON output.

- **URL**: https://apify.com/scrapeai/youtube-channel-scraper.md
- **Developed by:** [ScrapeAI](https://apify.com/scrapeai) (community)
- **Categories:** Developer tools, Automation, Social media
- **Stats:** 4 total users, 0 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: 5.00 out of 5 stars

## Pricing

$3.99/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

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

## 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 Channel Scraper

This actor visits the **Videos** tab of a YouTube channel and by default outputs **one record** containing the channel's details and the most recent video. You can now request multiple video entries using the `numberOfVideos` input parameter.

---

### Features

- Dynamic channel name/handle input
- Automatically constructs `https://www.youtube.com/{{channelName}}/videos` URL
- Outputs one or more channel/video records per run (controlled via `numberOfVideos`)
- Scrapes additional field(s) such as the full header description and any social/pop‑up links
- Collects channel profile and About page info (active since, views, description, country, links)
- Outputs a rich JSON record

---

### Input

```json
{
  "channelName": "@NationalGeographic"
}
````

#### Input Fields

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `channelName` | string | ✅ Yes | Channel handle or name (defaults to `@zara`) |
| `numberOfVideos` | integer | ❌ No | How many videos to return (1 = just the most recent, higher numbers produce multiple records) |

***

### How It Works

1. Accepts `channelName` (and optional `numberOfVideos`) from user input.
2. Builds a channel videos URL: `https://www.youtube.com/{{channelName}}/videos`.
3. Opens the channel page and handles popups.
4. Extracts subscriber count and profile picture from the channel header.
5. Visits the About tab to gather channel info (active since, view count, description, country, links).
6. Grabs metadata for the first *N* videos on the page, where **N** equals `numberOfVideos`.
7. Each record is enqueued into the dataset; the default dataset will contain multiple entries if you requested more than one video.
8. Outputs a **single JSON record** combining all channel and video data.

***

> **Note:**
> By default `Actor.pushData(data)` writes to the **default** dataset (local path
> `storage/datasets/default/`). Opening a named dataset such as
> the former if you want all results in the default dataset; the latter if you
> need a dedicated dataset with its own view schema.

#### Example Record

```json
{
  "title": "PAIN HUSTLERS | Emily Blunt & Catherine O'Hara Clip | Netflix",
  "author": "@netflix",
  "videoUrl": "https://www.youtube.com/watch?v=mEbVjufYiFE",
  "coverImage": "https://i.ytimg.com/vi/mEbVjufYiFE/hqdefault.jpg",
  "subscriberCount": "27,2 M d'abonnés",
  "likeCount": null,
  "description": "Emily Blunt, Chris Evans, Catherine O'Hara, and Andy Garcia in PAIN HUSTLERS.",
  "viewCount": 29280,
  "commentCount": null,
  "publishedAt": "5 months ago",
  "id": "mEbVjufYiFE",
  "amountOfVideos": null,
  "profilePicture": null,
  "channelInfo": {
    "actifFrom": "Actif depuis le 17 juil. 2012",
    "viewCounter": "7 569 331 655 vues",
    "channelDescription": "Netflix is the world's leading streaming entertainment service.",
    "country": "États-Unis",
    "link": {
      "Netflix": "signup.netflix.com",
      "Facebook": "facebook.com/netflixus",
      "Twitter": "twitter.com/netflix",
      "Instagram": "instagram.com/netflix",
      "Tumblr": "netflix.tumblr.com"
    },
    "externalLinks": [
      { "title": "Netflix", "url": "https://signup.netflix.com" },
      { "title": "Facebook", "url": "https://facebook.com/netflixus" }
    ],
    "headerDescription": "Learn about Netflix and our latest releases.",
    "moreLinks": [
      { "title": "More info", "href": "https://netflix.com/about" }
    ]
  }
}
```

#### Output Schema

| Field | Type | Description |
|-------|------|-------------|
| `title` | string | Title of the video |
| `author` | string | Channel handle (e.g. `@netflix`) |
| `videoUrl` | string | Full YouTube video URL |
| `coverImage` | string | Thumbnail image URL |
| `subscriberCount` | string|null | Subscriber count text (e.g. `"27,2 M d'abonnés"`) |
| `likeCount` | number|null | Like count (null if not available) |
| `description` | string | Video description snippet |
| `viewCount` | number|null | View count as integer |
| `commentCount` | number|null | Comment count (null if not available) |
| `publishedAt` | string|null | Upload time text (e.g. `"5 months ago"`) |
| `id` | string|null | YouTube video ID |
| `amountOfVideos` | number|null | Total videos on channel |
| `profilePicture` | string|null | Channel profile picture URL |
| `channelInfo.actifFrom` | string|null | Channel creation date text |
| `channelInfo.viewCounter` | string|null | Total channel views text |
| `channelInfo.channelDescription` | string|null | Full channel description from About tab |
| `channelInfo.country` | string|null | Channel country |
| `channelInfo.link` | object|null | Key-value map of channel links (name → URL) |
| `channelInfo.externalLinks` | array|null | Array of objects `{ title, url }` scraped from the redirect‑cleaned external links list |
| `channelInfo.headerDescription` | string|null | Full description text visible on channel header (expanded if truncated) |
| `channelInfo.moreLinks` | array|null | Array of objects `{ title, href }` scraped from the "more links" popup |

***

### Example

**Channel name:** `@zara`

**Generated URL:** `https://www.youtube.com/@zara/videos`

# Actor input Schema

## `channelName` (type: `string`):

YouTube channel name or handle (e.g. '@zara' or 'NationalGeographic')

## `max_results` (type: `integer`):

Maximum number of videos to scrape

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

Use Apify Proxy or custom HTTP proxy to avoid IP blocking.

## Actor input object example

```json
{
  "channelName": "@zara",
  "max_results": 10,
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "IN"
  }
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapeai/youtube-channel-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("scrapeai/youtube-channel-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 '{}' |
apify call scrapeai/youtube-channel-scraper --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Youtube Channel Scraper",
        "description": "YouTube channel scraper built with Puppeteer/Playwright that extracts channel name, description, subscribers, total views, video count, joined date, country, and external links (Instagram, TikTok, website, etc.). Handles “...more” popup, parses redirect URLs, and stores clean structured JSON output.",
        "version": "1.0",
        "x-build-id": "A6oD1tKBfIc2jhjux"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapeai~youtube-channel-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapeai-youtube-channel-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/scrapeai~youtube-channel-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapeai-youtube-channel-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/scrapeai~youtube-channel-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapeai-youtube-channel-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",
                "required": [
                    "channelName"
                ],
                "properties": {
                    "channelName": {
                        "title": "Channel Name or Handle",
                        "type": "string",
                        "description": "YouTube channel name or handle (e.g. '@zara' or 'NationalGeographic')",
                        "default": "@zara"
                    },
                    "max_results": {
                        "title": "Max Results",
                        "type": "integer",
                        "description": "Maximum number of videos to scrape",
                        "default": 10
                    },
                    "proxyConfiguration": {
                        "title": "Proxy Configuration",
                        "type": "object",
                        "description": "Use Apify Proxy or custom HTTP proxy to avoid IP blocking.",
                        "default": {
                            "useApifyProxy": true,
                            "apifyProxyGroups": [
                                "RESIDENTIAL"
                            ],
                            "apifyProxyCountry": "IN"
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
