YouTube analytics tools (vidIQ, TubeBuddy) charge $8-40/month for channel analysis. For developers and data-driven creators, a search API provides the raw data to build custom analysis: what competitors rank for, where content gaps exist, and which keywords have weak competition.
Prerequisites
- Python 3.8+
- A Scavio API key
- Target channels or keywords to analyze
Walkthrough
Step 1: Search for channel content
Find all videos from a specific channel that rank for target keywords.
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}
def channel_keywords(channel_name: str, keywords: list) -> dict:
results = {'channel': channel_name, 'rankings': []}
for kw in keywords:
resp = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'youtube', 'query': kw}, timeout=10)
for i, v in enumerate(resp.json().get('organic', [])):
if channel_name.lower() in v.get('channel', '').lower():
results['rankings'].append({
'keyword': kw, 'position': i + 1,
'title': v.get('title', ''), 'views': v.get('views', '')
})
break
return resultsStep 2: Find content gaps
Identify keywords where no strong video exists (low view counts or few results).
def find_content_gaps(keywords: list, view_threshold: int = 10000) -> list:
gaps = []
for kw in keywords:
resp = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'youtube', 'query': kw}, timeout=10)
videos = resp.json().get('organic', [])
# Gap conditions: few results OR top results have low views
if len(videos) < 5:
gaps.append({'keyword': kw, 'reason': 'few_videos', 'video_count': len(videos)})
elif videos and all(int(v.get('views','0').replace(',','') or '0') < view_threshold for v in videos[:3]):
gaps.append({'keyword': kw, 'reason': 'low_competition', 'top_views': videos[0].get('views','')})
return gapsStep 3: Competitor analysis
Compare your channel's keyword rankings against competitors.
def competitor_comparison(your_channel: str, competitor: str, keywords: list) -> dict:
your_ranks = channel_keywords(your_channel, keywords)
their_ranks = channel_keywords(competitor, keywords)
comparison = []
for kw in keywords:
your_pos = next((r['position'] for r in your_ranks['rankings'] if r['keyword'] == kw), None)
their_pos = next((r['position'] for r in their_ranks['rankings'] if r['keyword'] == kw), None)
comparison.append({
'keyword': kw,
'your_position': your_pos,
'their_position': their_pos,
'winning': 'you' if (your_pos and their_pos and your_pos < their_pos) else
'them' if (their_pos and (not your_pos or their_pos < your_pos)) else 'neither'
})
return {
'you': your_channel, 'competitor': competitor,
'you_winning': sum(1 for c in comparison if c['winning'] == 'you'),
'them_winning': sum(1 for c in comparison if c['winning'] == 'them'),
'details': comparison
}Python Example
import requests, os
H = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}
def yt_rank(keyword, channel):
r = requests.post('https://api.scavio.dev/api/v1/search', headers=H,
json={'platform': 'youtube', 'query': keyword}).json()
for i, v in enumerate(r.get('organic',[])):
if channel.lower() in v.get('channel','').lower():
return i + 1
return NoneJavaScript Example
async function ytRank(keyword, channel) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {
method: 'POST', headers: {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'},
body: JSON.stringify({platform: 'youtube', query: keyword})
});
const results = (await r.json()).organic || [];
const idx = results.findIndex(v => v.channel?.toLowerCase().includes(channel.toLowerCase()));
return idx >= 0 ? idx + 1 : null;
}Expected Output
A YouTube channel analyzer that tracks keyword rankings, finds content gaps, and compares performance against competitors using search API data.