How to Scrape Every Video From a YouTube Channel (Stats Included)
Your own channel comes with analytics. A competitor's doesn't — and that's exactly the channel you most want to understand. Which of their videos blew up this quarter? What's their real upload cadence? Which titles and topics keep overperforming? To answer any of that you need the same thing: a full list of their videos with metadata (views, likes, publish date) in a format you can sort and filter.
The official YouTube Data API makes this weirdly painful — listing a channel's uploads burns quota fast and forces endless pagination. This guide does it cleanly with SociaVault: pull an entire channel into a dataset, then mine it for the stuff that actually informs your content. Code in Python (great for this kind of analysis) with a JavaScript version too.
Step 1: Pull every video
The channel-videos endpoint takes a channelId (or handle) and paginates with a continuationToken. Loop until there's no token left and you've got the whole catalog.
import requests
import pandas as pd
API_KEY = "YOUR_SOCIAVAULT_API_KEY"
def get_all_videos(channel_id):
videos, token = [], None
while True:
r = requests.get(
"https://api.sociavault.com/v1/scrape/youtube/channel-videos",
params={"channelId": channel_id, "continuationToken": token},
headers={"x-api-key": API_KEY},
).json()
if not r.get("success"):
break
data = r["data"]
# The video list may come as an array or an object — handle both.
batch = data.get("videos", [])
if isinstance(batch, dict):
batch = list(batch.values())
videos.extend(batch)
print(f"fetched {len(batch)} (total {len(videos)})")
token = data.get("continuationToken")
if not token:
break
return videos
all_videos = get_all_videos("UC_x5XG1OV2P6uZZ5FSM9Ttw")
The defensive isinstance(batch, dict) check is there because list-style responses sometimes arrive keyed by ID — log one response and you'll see which shape you're getting. You only pay one credit per page, and one page covers a lot of videos.
Step 2: Turn it into a dataset
Drop it into a DataFrame and the questions answer themselves. YouTube returns integer stat fields like viewCountInt, so you can sort numerically without parsing "1.2M" strings.
df = pd.DataFrame(all_videos)
# Top 5 most-viewed
print(df.sort_values("viewCountInt", ascending=False)
.head(5)[["title", "viewCountInt"]])
# Average views per video
print(f"Avg views: {df['viewCountInt'].mean():,.0f}")
# Which weekday do their best videos land on?
df["published"] = pd.to_datetime(df["publishedTime"], errors="coerce")
df["weekday"] = df["published"].dt.day_name()
print(df.groupby("weekday")["viewCountInt"].mean().sort_values(ascending=False))
The same pull in JavaScript
const API_KEY = process.env.SOCIAVAULT_API_KEY;
const BASE = "https://api.sociavault.com/v1/scrape/youtube";
async function getAllVideos(channelId) {
let token = null,
all = [];
do {
const params = new URLSearchParams({ channelId });
if (token) params.set("continuationToken", token);
const res = await fetch(`${BASE}/channel-videos?${params}`, {
headers: { "x-api-key": API_KEY },
});
const json = await res.json();
if (!json.success) break;
let batch = json.data.videos || [];
if (!Array.isArray(batch)) batch = Object.values(batch);
all.push(...batch);
token = json.data.continuationToken;
} while (token);
return all;
}
What to actually do with it: content-gap analysis
A full channel export is the raw material for the most useful YouTube research there is — finding a competitor's outliers. Sort their catalog by views and look for the videos that did, say, 5–10x their channel average. Those aren't flukes; they're proven topics their audience (and yours) wants. Make a better version: sharper hook, better thumbnail, your angle.
Run the export monthly and diff it against last month's, and you'll also see their cadence shifts and which new videos are climbing fast — an early read on where they're putting their bets.
Frequently Asked Questions
How do I get a list of all videos on a YouTube channel?
Call a channel-videos endpoint with the channel's ID and page through every result using the continuation token until none remains, as the code here does. That returns the full catalog with per-video metadata (views, likes, publish date) ready to drop into a spreadsheet or DataFrame.
Why not just use the official YouTube Data API?
You can, but listing a channel's uploads consumes API quota quickly and requires multi-step pagination through the uploads playlist. For a full-channel audit, a scraping API that returns the videos directly — with integer stat fields — is faster to work with and doesn't burn quota.
Are view and like counts returned as numbers?
Yes. YouTube data here includes integer fields like viewCountInt (alongside the display text), so you can sort and average without parsing "1.2M"-style strings. That makes analysis in pandas or JavaScript straightforward.
Can I scrape any channel or only my own?
Any public channel. That's the point — you can audit competitors, not just your own channel. Private or terminated channels won't return data.
How many credits does a full channel export cost?
One credit per page of results, and each page returns many videos. So even a large channel is typically a handful of credits to export completely. Re-running monthly to track changes costs the same again.
How do I find a channel's ID?
It's in the channel URL (youtube.com/channel/UC...), or you can resolve it from the channel's handle using the channel endpoint, which accepts a handle and returns the canonical channel ID.
The bottom line
A competitor's channel is a dataset waiting to happen. Export every video, sort by views, and let their outliers tell you which topics are proven winners. It's a few lines of code and a handful of credits for research that would take hours by hand.
Want to audit a channel? Start free with SociaVault with 50 credits.
Found this helpful?
Share it with others who might benefit
Ready to Try SociaVault?
Start extracting social media data with our powerful API. No credit card required.