# YouTube Outlier Finder (`pietro_wagaitho/youtube-outlier-finder`) Actor

Find breakout YouTube videos: each video scored by its views against the median of the uploads around it. Scan channels or a topic search. No API key, no login.

- **URL**: https://apify.com/pietro_wagaitho/youtube-outlier-finder.md
- **Developed by:** [Peter Gaitho](https://apify.com/pietro_wagaitho) (community)
- **Categories:** Social media, Videos, For creators
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 channel analyseds

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 Outlier Finder

Find the videos that broke out: the ones that got **many times more views than the channel normally gets**. Give it channels, or a topic to search, and it returns each breakout video with its outlier score, its views, and the channel's normal views around that time.

No YouTube API key. No login. Nothing is downloaded.

### What the score means

`outlierScore = views / median views of the ~10 uploads published just before and after it`

A score of **5** means the video got five times what that channel was normally getting at the time.

Comparing each video with its neighbours, instead of the channel's all-time average, matters:

- **Growing channels are not misread.** Against an all-time average, every recent video on a fast-growing channel looks like a hit. Against its neighbours, only real breakouts do.
- **New videos are left out** (default: younger than 7 days), from both the results and the baseline, because their view counts are still climbing.
- **Shorts are only compared with Shorts**, long videos only with long videos.

### Two ways to use it

**Channel mode.** List channels (`@handle`, `UC...` ID, or URL). You get each channel's top breakouts.

**Topic mode.** Give search queries, for example `why housing is expensive`. Every search result is scored against its own channel, so you see which videos on that topic over-performed for the channel that made them: the ideas that worked beyond the creator's own audience.

### Output (one row per outlier)

| Field | Meaning |
|---|---|
| `outlierScore` | Views divided by the channel's norm at the time |
| `views`, `baselineViews` | The video's views and that norm |
| `title`, `url`, `thumbnailUrl` | The video |
| `channelName`, `channelSubscribers`, `viewsPerSubscriber` | The channel |
| `isShort`, `durationSeconds`, `publishedAt` | `publishedAt` is exact for the newest ~15 uploads, otherwise empty |
| `baselineMethod` | `neighbouring-uploads-median`, or `channel-recent-median` for a search hit older than the uploads read |

A run summary (channels analysed, rows written, channels that failed) is saved as `SUMMARY` in the key-value store.

### Pricing

Pay per event:

- **Channel analysed**: charged once per channel that was read and baselined successfully.
- **Outlier**: charged once per row in your results.

Channels that cannot be read are **not** charged. Set a maximum cost per run and the Actor stops cleanly when it is reached.

### Use it from an AI agent

Works as a tool through the Apify MCP server. Example request: *"Find the top outliers for @PolyMatter and @HowMoneyWorks with a score above 3."*

### Limits

- View counts are YouTube's public, rounded figures (for example 1.2M).
- Exact publish dates come from the channel's public feed, which covers only the newest ~15 uploads.
- Members-only, private, and age-restricted videos are skipped.

# Actor input Schema

## `channels` (type: `array`):

Channels to scan. Accepts @handles, channel IDs (UC...), or youtube.com channel URLs.

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

Find outliers in a topic: each search result is scored against its own channel's normal views. One channel-analyzed charge per distinct channel in the results.

## `resultsPerQuery` (type: `integer`):

How many search results to check per query.

## `minOutlierScore` (type: `number`):

Keep videos with at least this many times the views of their neighbouring uploads. 2 means double the channel's norm.

## `minViews` (type: `integer`):

Skip videos with fewer views than this. Small numbers make noisy scores.

## `minChannelNormViews` (type: `integer`):

Skip channels whose normal video gets fewer views than this. On tiny channels one share can make a 100x score.

## `videosPerChannel` (type: `integer`):

How many recent uploads form the baseline. More reaches further back in time.

## `maxOutliersPerChannel` (type: `integer`):

Cap on rows per channel (channel mode). 0 means no cap.

## `includeShorts` (type: `boolean`):

Also scan the Shorts tab. Shorts are scored only against other Shorts.

## `minVideoAgeDays` (type: `integer`):

Brand-new videos are still gaining views, so they are left out of both the results and the baseline.

## `concurrency` (type: `integer`):

How many channels are read at the same time.

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

Optional. Only needed if YouTube starts refusing requests.

## Actor input object example

```json
{
  "channels": [
    "@HowMoneyWorks",
    "@EconomicsExplained"
  ],
  "resultsPerQuery": 30,
  "minOutlierScore": 2,
  "minViews": 1000,
  "minChannelNormViews": 500,
  "videosPerChannel": 60,
  "maxOutliersPerChannel": 10,
  "includeShorts": false,
  "minVideoAgeDays": 7,
  "concurrency": 4
}
```

# Actor output Schema

## `outliers` (type: `string`):

One row per breakout video, highest outlier score first within each channel or query.

## `summary` (type: `string`):

Channels analysed, rows written, and channels that could not be read (not charged).

# 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 = {
    "channels": [
        "@HowMoneyWorks",
        "@EconomicsExplained"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pietro_wagaitho/youtube-outlier-finder").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 = { "channels": [
        "@HowMoneyWorks",
        "@EconomicsExplained",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("pietro_wagaitho/youtube-outlier-finder").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 '{
  "channels": [
    "@HowMoneyWorks",
    "@EconomicsExplained"
  ]
}' |
apify call pietro_wagaitho/youtube-outlier-finder --silent --output-dataset

```

## MCP server setup

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

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/RkqsopihUQqomvLzh/builds/xN7mPRbI2eWpEdBRL/openapi.json
