ScavioScavio
ProductPricingDocs
Sign InGet Started
Blog
youtubecontent-researchapicreator-tools

How to find outlier YouTube videos with an API

Pull YouTube search results with view counts, take the median, and flag any video scoring 5x or more. Runnable Python and JS, with the honest limits.

June 2, 2026
6 min read

How do I find outlier YouTube videos with an API?

Pull a batch of videos for a keyword, take the median view count of that batch, then flag any video whose views divide the median by 5 or more. That ratio is the outlier score, and an API like Scavio's YouTube search gives you the raw views/likes/comments in JSON so you never touch a browser. A Reddit creator recently open-sourced an "outlier finder" doing exactly this, and a data scientist on the same subreddit showed why view-count outliers, not impression decay, are what you can actually measure from the outside.

What counts as an outlier video?

An outlier is a video that massively beats the typical performance of its peer set. The peer set is either one channel's recent uploads or one search query's top results in a niche. The formula is simple:

outlier_score = video_views / median_views_of_peer_set

Use the median, not the mean. One viral hit drags the average up and hides every other breakout, while the median stays anchored to what "normal" looks like. A score of 1.0 is dead average. A score >= 5x is a strong outlier worth dissecting: that topic, title, or thumbnail format broke out of the pack for a reason. Below ~2x is noise. Most creators study the 5x-and-up bucket because that's where a repeatable pattern usually hides.

Python: pull a niche, compute the median, flag the outliers

This hits Scavio's YouTube search, grabs view counts, and prints anything at 5x or above. It runs as-is once you drop in a key.

Python
import requests
import statistics

API_KEY = "sk_live_..."
NICHE = "home espresso setup"
THRESHOLD = 5.0

resp = requests.post(
    "https://api.scavio.dev/api/v1/youtube/search",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={"search": NICHE},
)
resp.raise_for_status()
videos = resp.json()["videos"]

views = [v["view_count"] for v in videos if v.get("view_count")]
median = statistics.median(views)

for v in videos:
    vc = v.get("view_count") or 0
    score = vc / median if median else 0
    if score >= THRESHOLD:
        print(f"{score:.1f}x  {vc:>10,}  {v['title']}")

Field names depend on the live response shape, so print one item first if view_count or videos doesn't match. One call is 1 credit ($0.005), so scanning ten niches costs five cents.

JavaScript: the same call with fetch

JavaScript
const resp = await fetch("https://api.scavio.dev/api/v1/youtube/search", {
  method: "POST",
  headers: {
    "Authorization": "Bearer sk_live_...",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ search: "home espresso setup" }),
});
const { videos } = await resp.json();
const views = videos.map((v) => v.view_count).filter(Boolean).sort((a, b) => a - b);
const median = views[Math.floor(views.length / 2)];
const outliers = videos.filter((v) => (v.view_count || 0) / median >= 5);
console.log(outliers);

The honest tradeoff: discovery data, not channel analytics

Scavio returns ranked search results with public view, like, and comment counts. That's exactly what you want for discovery and for scanning across niches fast, at 1 credit per call. What it does not give you is private, per-video time-series: impression counts, click-through rate, average view duration, the watch-time curve. Those live behind a login. So a view-count outlier tells you a video overperformed; it cannot tell you whether the thumbnail won the click or the topic held the watch.

If you need per-video metadata beyond search results, pair it with POST https://api.scavio.dev/api/v1/youtube/metadata for a richer pull on a specific video. But for your own channel's impression and CTR decay, YouTube Studio and the official YouTube Data API win outright. The Reddit data scientist who measured impression decay was working from Studio exports for exactly this reason. Scavio is the outside view of public performance; Studio is the inside view of your own funnel.

Why an API beats scraping public search

YouTube search results are public and indexed, so a structured API hands you clean JSON with no proxy rotation, no CAPTCHA solving, no headless browser to babysit. You ask, you get views and titles back. The catch is the same as the tradeoff above: this is public discovery data. It is not a backdoor into private channel metrics, and no API gives you someone else's impressions or CTR. Treat it as a research telescope, not an analytics dashboard.

The decision rule

Use a search-data API like Scavio when you want to scan many niches for breakout topics and reverse-engineer winning titles and formats from public outliers at a few cents a sweep. Pair it with /youtube/metadata for deeper per-video pulls. Switch to YouTube Studio or the official Data API the moment your question is about your own impressions, CTR, or retention. Outlier hunting is discovery; channel optimization is analytics, and one tool should not pretend to be both.

Continue reading

exasearch-api

Why Exa Search Costs So Much (and Cheaper Alternatives) in 2026

7 min read
reddit-apilead-generation

Mine Reddit for Product Demand That Already Exists

7 min read
ScavioScavio

Real-time search API for AI agents. Search every platform, not just Google.

Product

  • Features
  • Pricing
  • Dashboard
  • Affiliates

Developers

  • Documentation
  • API Reference
  • Quickstart
  • MCP Integration
  • Python SDK

Alternatives

  • Tavily Alternative
  • SerpAPI Alternative
  • Firecrawl Alternative
  • Exa Alternative

Tools

  • JSON Formatter
  • cURL to Code
  • Token Counter
  • All Tools

© 2026 Scavio. All rights reserved.

Featured on TAAFT
Terms of ServicePrivacy Policy