# YouTube Competitor Analyzer (`hasnainnisar67/youtube-competitor-analyzer`) Actor

Compare up to 5 YouTube channels side-by-side. Returns subscriber count, total views, video count, top-viewed videos, latest uploads, oldest uploads, and full video list per channel. Ideal for content strategy, niche research, and SEO benchmarking.

- **URL**: https://apify.com/hasnainnisar67/youtube-competitor-analyzer.md
- **Developed by:** [Hasnain Nisar](https://apify.com/hasnainnisar67) (community)
- **Categories:** Videos
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

$0.99 / 1,000 channel analyzeds

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/platform/actors/running/actors-in-store#pay-per-event

## 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 Competitor Analyzer - Compare Channels Side-by-Side

**Compare up to 5 YouTube channels in a single run.** See subscriber counts, top-performing videos, posting cadence, and average views — perfect for competitor research, influencer due diligence, and content strategy.

### What this YouTube Competitor Analyzer does

Pass 1–5 YouTube channel URLs and the actor:

1. Pulls each channel's metadata in parallel (subscribers, total views, video count, description)
2. Extracts the latest N videos from each channel (configurable, default 30)
3. Identifies each channel's **top 3 most-viewed**, **latest 3**, and **oldest 3** videos in the fetched window
4. Returns a single comparison record + per-channel records for easy filtering

The output drops straight into Google Sheets, Notion, Airtable, or your BI tool — ready for charts and side-by-side dashboards.

### Why use this YouTube Competitor Analyzer?

- **No YouTube Data API key** — the official API caps you at 10,000 units/day
- **Up to 5 channels in a single run** — perfect for category benchmarking
- **Pre-sorted highlights** — top, latest, oldest delivered ready to chart
- **Predictable cost** — analyses complete in 30–60 seconds for 5 channels at 30 videos each
- **Resilient input** — accepts handles, channel IDs, custom URLs, or video URLs

### Use cases

- **Competitor benchmarking** — compare your channel against 4 rivals in your niche
- **Influencer due diligence** — qualify creators before sponsoring or partnering
- **Content gap analysis** — see what video formats your competitors crush at
- **Niche research** — identify which channels are growing fastest in a category
- **Pitch decks & reports** — generate clean comparison tables in minutes

### Input

```json
{
    "channelUrls": [
        "https://www.youtube.com/@MrBeast",
        "https://www.youtube.com/@MarkRober",
        "https://www.youtube.com/@VeritasiumYT"
    ],
    "maxVideos": 30
}
````

| Field | Type | Default | Description |
|-------|------|---------|-------------|
| `channelUrls` | array of 1-5 strings | required | Channel URLs to compare |
| `maxVideos` | integer | 30 | Videos to consider per channel (5–500) |

### Output

The first dataset item is the full comparison object:

```json
{
    "channels": [
        {
            "channel_name": "MrBeast",
            "subscriber_count": 250000000,
            "view_count": 50000000000,
            "video_count": 800,
            "videos_fetched": 30,
            "top_viewed": [ /* top 3 most-viewed in fetched window */ ],
            "latest_videos": [ /* most recent 3 uploads */ ],
            "oldest_videos": [ /* oldest 3 in window — useful for posting-cadence math */ ],
            "all_videos": [ /* … */ ]
        },
        { /* next channel */ }
    ]
}
```

Each subsequent dataset item is a single-channel record (one per competitor) — the same shape returned by the standalone YouTube Channel Scraper.

### How it works

The actor uses [yt-dlp](https://github.com/yt-dlp/yt-dlp) with `extract_flat='in_playlist'` and runs all channel pulls concurrently with `asyncio.gather`. No Playwright, no API tokens, no rate limits.

### Related actors

- **YouTube Channel Scraper** — single-channel deep dive
- **YouTube Video Info Scraper** — full per-video metadata
- **YouTube Downloader** — downloadable MP4 / MP3 URLs

### FAQ

**Q: Can I compare more than 5 channels?**
The actor caps at 5 to keep runtimes predictable. Run multiple jobs and combine the datasets if you need more.

**Q: Is the data live?**
Yes — every run hits YouTube fresh. There is no staleness window.

**Q: Does it handle very large channels (1M+ videos)?**
Set `maxVideos` to whatever window you actually need (e.g. last 100). The actor's runtime scales linearly with this value.

# Actor input Schema

## `channelUrls` (type: `array`):

Provide between 1 and 5 YouTube channel URLs to analyze in parallel. Accepts /@handle, /channel/UC..., /c/, /user/, or any video URL.

## `maxVideos` (type: `integer`):

How many recent videos to consider per channel.

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

yt-dlp is routed through this proxy. Apify datacenter IPs are aggressively rate-limited by YouTube, so a proxy is required to populate top\_viewed / latest\_videos / oldest\_videos (which need per-video metadata).

## Actor input object example

```json
{
  "channelUrls": [
    "https://www.youtube.com/@MrBeast",
    "https://www.youtube.com/@MarkRober"
  ],
  "maxVideos": 30,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# 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 = {
    "channelUrls": [
        "https://www.youtube.com/@MrBeast",
        "https://www.youtube.com/@MarkRober"
    ],
    "proxyConfiguration": {
        "useApifyProxy": true
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("hasnainnisar67/youtube-competitor-analyzer").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 = {
    "channelUrls": [
        "https://www.youtube.com/@MrBeast",
        "https://www.youtube.com/@MarkRober",
    ],
    "proxyConfiguration": { "useApifyProxy": True },
}

# Run the Actor and wait for it to finish
run = client.actor("hasnainnisar67/youtube-competitor-analyzer").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 '{
  "channelUrls": [
    "https://www.youtube.com/@MrBeast",
    "https://www.youtube.com/@MarkRober"
  ],
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}' |
apify call hasnainnisar67/youtube-competitor-analyzer --silent --output-dataset

```

## MCP server setup

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

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "YouTube Competitor Analyzer",
        "description": "Compare up to 5 YouTube channels side-by-side. Returns subscriber count, total views, video count, top-viewed videos, latest uploads, oldest uploads, and full video list per channel. Ideal for content strategy, niche research, and SEO benchmarking.",
        "version": "0.1",
        "x-build-id": "5NjbCN7AT1MpHPwb1"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/hasnainnisar67~youtube-competitor-analyzer/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-hasnainnisar67-youtube-competitor-analyzer",
                "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/hasnainnisar67~youtube-competitor-analyzer/runs": {
            "post": {
                "operationId": "runs-sync-hasnainnisar67-youtube-competitor-analyzer",
                "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/hasnainnisar67~youtube-competitor-analyzer/run-sync": {
            "post": {
                "operationId": "run-sync-hasnainnisar67-youtube-competitor-analyzer",
                "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": [
                    "channelUrls"
                ],
                "properties": {
                    "channelUrls": {
                        "title": "Competitor channel URLs (1-5)",
                        "type": "array",
                        "description": "Provide between 1 and 5 YouTube channel URLs to analyze in parallel. Accepts /@handle, /channel/UC..., /c/, /user/, or any video URL.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxVideos": {
                        "title": "Max videos per channel",
                        "minimum": 5,
                        "maximum": 500,
                        "type": "integer",
                        "description": "How many recent videos to consider per channel.",
                        "default": 30
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "yt-dlp is routed through this proxy. Apify datacenter IPs are aggressively rate-limited by YouTube, so a proxy is required to populate top_viewed / latest_videos / oldest_videos (which need per-video metadata).",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "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
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
