YouTube Search API: Build Powerful Discovery Applications
Need to search YouTube programmatically? The Search API lets you find videos, channels, and playlists—perfect for content discovery and research tools.
Search Capabilities
| Endpoint | Description |
|---|---|
| Search | General video/channel search |
| Search Hashtag | Find videos by hashtag |
General Search API
Search for videos, channels, and playlists:
const response = await fetch('https://api.sociavault.com/youtube/search', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
query: 'web scraping tutorial'
})
});
const results = await response.json();
Sample Response
{
"results": [
{
"type": "video",
"id": "abc123xyz",
"title": "Web Scraping Tutorial 2026 - Complete Guide",
"description": "Learn web scraping from scratch...",
"thumbnail": "https://...",
"views": 250000,
"publishedAt": "2026-01-05T10:00:00Z",
"duration": "25:30",
"channel": {
"name": "Tech Channel",
"handle": "@techchannel",
"verified": true
}
},
{
"type": "channel",
"id": "UCxxx",
"name": "Scraping Experts",
"handle": "@scrapingexperts",
"subscribers": 150000,
"thumbnail": "https://..."
}
],
"hasMore": true
}
Hashtag Search
Find videos using a specific hashtag:
const response = await fetch('https://api.sociavault.com/youtube/search/hashtag', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
hashtag: 'shorts'
})
});
const hashtagResults = await response.json();
Use Cases
Content Research
Find videos on a topic:
const topics = ['python tutorial', 'javascript', 'data science'];
const research = await Promise.all(
topics.map(async query => {
const results = await searchYouTube(query);
return {
topic: query,
totalResults: results.length,
avgViews: results
.filter(r => r.type === 'video')
.reduce((s, v) => s + v.views, 0) / results.filter(r => r.type === 'video').length
};
})
);
console.log('Topic research:', research);
Influencer Discovery
Find creators in a niche:
const results = await searchYouTube('fitness workout');
const channels = results
.filter(r => r.type === 'channel')
.sort((a, b) => b.subscribers - a.subscribers);
console.log('Top fitness channels:', channels.slice(0, 10));
Competitor Content Analysis
Find competing content:
const searchTerms = ['best api tool', 'scraping api review'];
for (const term of searchTerms) {
const results = await searchYouTube(term);
const videos = results.filter(r => r.type === 'video');
console.log(`\n"${term}" - ${videos.length} videos found`);
videos.slice(0, 5).forEach(v => {
console.log(`- ${v.title} (${v.views.toLocaleString()} views)`);
});
}
Hashtag Monitoring
Track content using specific hashimage: "https://images.unsplash.com/photo-1611162618479-ee3d24aaef0b?w=1200&h=630&fit=crop&q=80" tags:
const hashtags = ['shorts', 'tutorial', 'vlog'];
for (const tag of hashtags) {
const results = await searchHashtag(tag);
const recentVideos = results.filter(v =>
new Date(v.publishedAt) > new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
);
console.log(`#${tag}: ${recentVideos.length} videos this week`);
}
Build a Content Calendar
Research what's performing to plan content:
async function researchTopics(keywords) {
const insights = [];
for (const keyword of keywords) {
const results = await searchYouTube(keyword);
const videos = results.filter(r => r.type === 'video');
// Calculate competition
const avgViews = videos.reduce((s, v) => s + v.views, 0) / videos.length;
const recentVideos = videos.filter(v =>
new Date(v.publishedAt) > new Date(Date.now() - 30 * 24 * 60 * 60 * 1000)
).length;
insights.push({
keyword,
avgViews,
competition: recentVideos,
opportunity: avgViews / recentVideos // Higher = better opportunity
});
}
return insights.sort((a, b) => b.opportunity - a.opportunity);
}
Related Endpoints
- YouTube Channel Scraper - Channel details
- YouTube Videos Scraper - Channel videos
- YouTube Trending Shorts - Trending content
- TikTok Search - TikTok search
Frequently Asked Questions
How many results can I get?
Each search returns up to 20 results. Use pagination for more.
Can I filter by upload date?
Results are returned by YouTube's relevance ranking. Filter by publishedAt client-side.
Are results personalized?
No, SociaVault returns non-personalized results, giving you objective search data.
Can I search for playlists?
Yes, playlists appear in general search results alongside videos and channels.
How does hashtag search work?
Hashtag search returns videos that include the specific hashtag in their title or description.
Get Started
Create your account and start searching YouTube programmatically.
Documentation: /docs/api-reference/youtube/search
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.