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/v1/scrape/youtube/video?url=https://www.youtube.com/watch?v=dQw4w9WgXcQ', {
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
const video = await response.json();
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | YouTube video or short URL |
Sample Response
{
"success": true,
"data": {
"id": "dQw4w9WgXcQ",
"thumbnail": "https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"publishDate": "2009-10-25T06:57:33Z",
"publishDateText": "Oct 25, 2009",
"type": "video",
"title": "Rick Astley - Never Gonna Give You Up",
"description": "The official video for \"Never Gonna Give You Up\" by Rick Astley...",
"commentCountText": "2,800,000",
"commentCountInt": 2800000,
"likeCountText": "15,000,000",
"likeCountInt": 15000000,
"viewCountText": "1,500,000,000",
"viewCountInt": 1500000000,
"channel": {
"id": "UCuAXFkgsw1L7xaCfnd5JJOw",
"url": "https://www.youtube.com/@RickAstley",
"handle": "RickAstley",
"title": "Rick Astley"
},
"chapters": {},
"watchNextVideos": {},
"keywords": {},
"genre": "Music",
"durationMs": 213000,
"durationFormatted": "00:03:33",
"captionTracks": {},
"transcript": null,
"transcript_only_text": null
},
"credits_used": 1,
"endpoint": "youtube/video"
}
Use Cases
Video Performance Tracking
Monitor video metrics over time:
async function trackVideo(videoUrl) {
const res = await fetch(`https://api.sociavault.com/v1/scrape/youtube/video?url=${encodeURIComponent(videoUrl)}`, {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const { data } = await res.json();
await saveMetrics({
videoId: data.id,
views: data.viewCountInt,
likes: data.likeCountInt,
comments: data.commentCountInt,
timestamp: new Date()
});
const yesterday = await getYesterdayMetrics(data.id);
console.log(`Views: +${(data.viewCountInt - yesterday.views).toLocaleString()}`);
console.log(`Likes: +${(data.likeCountInt - yesterday.likes).toLocaleString()}`);
}
Engagement Rate Calculation
const res = await fetch(`https://api.sociavault.com/v1/scrape/youtube/video?url=${encodeURIComponent(url)}`, {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
const { data } = await res.json();
const engagementRate = ((data.likeCountInt + data.commentCountInt) / data.viewCountInt) * 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(async url => {
const res = await fetch(`https://api.sociavault.com/v1/scrape/youtube/video?url=${encodeURIComponent(url)}`, {
headers: { 'x-api-key': 'YOUR_API_KEY' }
});
return (await res.json()).data;
})
);
const comparison = videos.map(v => ({
title: v.title,
views: v.viewCountInt,
engagement: ((v.likeCountInt + v.commentCountInt) / v.viewCountInt * 100).toFixed(3) + '%',
genre: v.genre
}));
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.