Need to analyze YouTube video content? This guide shows you how to extract videos, metadata, and performance metrics from any YouTube channel.
What Video Data Can You Extract?
| Field | Description |
|---|---|
| Video ID | Unique identifier |
| Title | Video title |
| Description | Full description |
| Views | View count |
| Likes | Like count |
| Comments | Comment count |
| Duration | Video length |
| Published Date | Upload date |
| Thumbnail | Thumbnail URL |
| Tags | Video tags |
| Category | Content category |
Using the Videos API
const response = await fetch('https://api.sociavault.com/v1/scrape/youtube/channel-videos?handle=MrBeast&sort=latest', {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
const videos = await response.json();
| Parameter | Type | Required | Description |
|---|---|---|---|
handle | string | No* | YouTube channel handle |
channelId | string | No* | YouTube channel ID |
sort | string | No | Sort by latest or popular |
continuationToken | string | No | Token from previous response for pagination |
*Pass either handle or channelId.
Sample Response
{
"success": true,
"data": {
"videos": {
"0": {
"type": "video",
"id": "dQw4w9WgXcQ",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"title": "I Gave Away $1,000,000",
"thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg",
"viewCountText": "125,000,000 views",
"viewCountInt": 125000000,
"publishedTimeText": "3 days ago",
"publishedTime": "2026-01-05T14:00:00Z",
"lengthText": "18:30",
"lengthSeconds": 1110
}
},
"continuationToken": "4qmFsgKrCBIYVUNkRkpXVWE..."
},
"credits_used": 1,
"endpoint": "youtube/channel-videos"
}
Note: Videos use numeric keys — use
Object.values(data.data.videos)to iterate.
## Use Cases
### Content Performance Analysis
Find top-performing videos:
```javascript
const res = await fetch('https://api.sociavault.com/v1/scrape/youtube/channel-videos?handle=competitor&sort=popular', {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const { data } = await res.json();
const videos = Object.values(data.videos);
// Top 10 by views (already sorted by popular)
const topVideos = videos.slice(0, 10);
// Calculate averages
const avgViews = Math.round(videos.reduce((s, v) => s + v.viewCountInt, 0) / videos.length);
console.log(`Top video: ${topVideos[0].title} (${topVideos[0].viewCountText})`);
console.log(`Average views: ${avgViews.toLocaleString()}`);
Title Analysis
Study what titles perform best:
const res = await fetch('https://api.sociavault.com/v1/scrape/youtube/channel-videos?handle=channel', {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const { data } = await res.json();
const videos = Object.values(data.videos);
// Analyze title patterns
const titlePatterns = {
numbers: videos.filter(v => /\d/.test(v.title)),
questions: videos.filter(v => v.title.includes('?')),
howTo: videos.filter(v => /how to/i.test(v.title)),
lists: videos.filter(v => /^\d+ |top \d+/i.test(v.title))
};
// Compare performance
for (const [pattern, patternVideos] of Object.entries(titlePatterns)) {
const avgViews = Math.round(patternVideos.reduce((s, v) => s + v.viewCountInt, 0) / patternVideos.length);
console.log(`${pattern}: ${avgViews.toLocaleString()} avg views`);
}
Duration Analysis
Find optimal video length:
const res = await fetch('https://api.sociavault.com/v1/scrape/youtube/channel-videos?handle=channel', {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const { data } = await res.json();
const videos = Object.values(data.videos);
// Group by duration
const shortVideos = videos.filter(v => v.lengthSeconds < 300);
const mediumVideos = videos.filter(v => v.lengthSeconds >= 300 && v.lengthSeconds < 900);
const longVideos = videos.filter(v => v.lengthSeconds >= 900);
const avgViews = (arr) => Math.round(arr.reduce((s, v) => s + v.viewCountInt, 0) / arr.length);
console.log(`Short videos: ${avgViews(shortVideos).toLocaleString()} avg views`);
console.log(`Medium videos: ${avgViews(mediumVideos).toLocaleString()} avg views`);
console.log(`Long videos: ${avgViews(longVideos).toLocaleString()} avg views`);
Tag Analysis
Extract and analyze video tags:
const { videos } = await getChannelVideos('channel');
const tagCounts = {};
videos.forEach(video => {
video.tags?.forEach(tag => {
tagCounts[tag] = (tagCounts[tag] || 0) + 1;
});
});
const topTags = Object.entries(tagCounts)
.sort((a, b) => b[1] - a[1])
.slice(0, 20);
console.log('Most used tags:', topTags);
Pagination
Get all videos from a channel:
async function getAllVideos(handle) {
let allVideos = [];
let cursor = null;
do {
const params = new URLSearchParams({ handle });
if (cursor) params.append('continuationToken', cursor);
const response = await fetch(`https://api.sociavault.com/v1/scrape/youtube/channel-videos?${params}`, {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const data = await response.json();
allVideos = [...allVideos, ...Object.values(data.data.videos)];
cursor = data.data.continuationToken || null;
} while (cursor);
return allVideos;
}
Related Endpoints
- YouTube Channel Scraper - Channel info
- YouTube Shorts Scraper - Shorts content
- YouTube Video Details - Single video info
- YouTube Comments - Video comments
- YouTube Transcript - Video transcripts
Frequently Asked Questions
How many videos can I get per request?
Each request returns up to 30 videos. Use pagination to retrieve more.
Can I filter by date range?
The API returns videos in chronological order (newest first). Filter by publishedAt client-side for date ranges.
Are YouTube Shorts included?
By default, both regular videos and Shorts are included. Use the Shorts endpoint for Shorts-only content.
Can I get videos from private/unlisted?
No, only public videos are accessible.
How far back can I get videos?
You can access a channel's entire video history going back to their first upload.
Get Started
Create your account and start extracting YouTube video data.
Documentation: /docs/api-reference/youtube/channel-videos
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.