YouTube Video Details API: Extract Complete Video Information
Need detailed information about a specific YouTube video? The Video Details API returns comprehensive metadata, statistics, and engagement metrics.
What 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 timestamp |
| Tags | Video tags |
| Category | Content category |
| Thumbnail | Multiple thumbnail URLs |
| Channel | Creator information |
| Live Status | If from live stream |
Using the Video API
const response = await fetch('https://api.sociavault.com/youtube/video', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
})
});
const video = await response.json();
Sample Response
{
"id": "dQw4w9WgXcQ",
"title": "Rick Astley - Never Gonna Give You Up",
"description": "The official video for "Never Gonna Give You Up" by Rick Astley...",
"views": 1500000000,
"likes": 15000000,
"comments": 2800000,
"duration": "3:33",
"durationSeconds": 213,
"publishedAt": "2009-10-25T06:57:33Z",
"tags": ["rick astley", "never gonna give you up", "80s music"],
"category": "Music",
"thumbnails": {
"default": "https://...",
"medium": "https://...",
"high": "https://...",
"maxres": "https://..."
},
"channel": {
"id": "UCuAXFkgsw1L7xaCfnd5JJOw",
"name": "Rick Astley",
"handle": "@RickAstley",
"subscribers": 4500000,
"verified": true
},
"isLive": false,
"isShort": false
}
Use Cases
Video Performance Tracking
Monitor video metrics over time:
async function trackVideo(videoUrl) {
const video = await getVideoDetails(videoUrl);
await saveMetrics({
videoId: video.id,
views: video.views,
likes: video.likes,
comments: video.comments,
timestamp: new Date()
});
// Calculate daily change
const yesterday = await getYesterdayMetrics(video.id);
console.log(`Views: +${(video.views - yesterday.views).toLocaleString()}`);
console.log(`Likes: +${(video.likes - yesterday.likes).toLocaleString()}`);
}
Engagement Rate Calculation
const video = await getVideoDetails(url);
const engagementRate = ((video.likes + video.comments) / video.views) * 100;
console.log(`Engagement rate: ${engagementRate.toFixed(3)}%`);
Compare Multiple Videos
Analyze performance across videos:
const urls = ['url1', 'url2', 'url3'];
const videos = await Promise.all(
urls.map(url => getVideoDetails(url))
);
const comparison = videos.map(v => ({
title: v.title,
views: v.views,
engagement: ((v.likes + v.comments) / v.views * 100).toFixed(3) + '%',
viewsPerDay: Math.round(v.views / daysSincePublished(v.publishedAt))
}));
console.table(comparison);
Extract Tags for SEO
Analyze video image: "https://images.unsplash.com/photo-1611162618071-b39a2ec055fb?w=1200&h=630&fit=crop&q=80" tags:
const video = await getVideoDetails(url);
console.log('Video image: "https://images.unsplash.com/photo-1611162618071-b39a2ec055fb?w=1200&h=630&fit=crop&q=80"
tags:', video.tags);
// Compare with competitor
const competitor = await getVideoDetails(competitorUrl);
const commonTags = video.tags.filter(t => competitor.tags.includes(t));
const uniqueTags = video.tags.filter(t => !competitor.tags.includes(t));
console.log('Common image: "https://images.unsplash.com/photo-1611162618071-b39a2ec055fb?w=1200&h=630&fit=crop&q=80"
tags:', commonTags);
console.log('Unique image: "https://images.unsplash.com/photo-1611162618071-b39a2ec055fb?w=1200&h=630&fit=crop&q=80"
tags:', uniqueTags);
Identify Video Type
Determine if content is a Short, live stream, etc.:
const video = await getVideoDetails(url);
if (video.isShort) {
console.log('This is a YouTube Short');
} else if (video.isLive) {
console.log('This was a live stream');
} else {
console.log(`Regular video: ${video.duration}`);
}
Related Endpoints
- YouTube Videos Scraper - All channel videos
- YouTube Comments - Video comments
- YouTube Transcript - Video transcripts
- YouTube Channel Scraper - Channel info
Frequently Asked Questions
Can I use video ID instead of URL?
Yes, both full URLs and video IDs work: dQw4w9WgXcQ or https://www.youtube.com/watch?v=dQw4w9WgXcQ
Are Shorts supported?
Yes, Shorts are supported. The isShort field indicates if the video is a YouTube Short.
How current are view counts?
View counts are fetched in real-time and reflect the current state within minutes.
Can I get videos that are age-restricted?
Age-restricted videos return limited data. Full metadata requires authentication.
What if a video is private or deleted?
Private/deleted videos return an error. Only public videos are accessible.
Get Started
Sign up free and start extracting YouTube video data.
Documentation: /docs/api-reference/youtube/video
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.