问题所在
YouTube YouTube YouTube API
Scavio 解决方案
Scavio YouTube API YouTube
之前
YouTube 2 10 YouTube API
之后
API 5 50 $0.005/
适用人群
YouTube
核心优势
- 5 50 2
- YouTube API
- $0.005/
Python 示例
Python
import requests, os
API_KEY = os.environ["SCAVIO_API_KEY"]
H = {"x-api-key": API_KEY, "Content-Type": "application/json"}
def find_influencers(niche: str, min_results: int = 10) -> list:
"""Find YouTube influencers in a niche."""
resp = requests.post(
"https://api.scavio.dev/api/v1/search",
headers=H,
json={"query": f"{niche} tutorial 2026", "platform": "youtube", "country_code": "us"},
timeout=15,
)
data = resp.json()
videos = data.get("video_results", [])[:min_results]
influencers = {}
for v in videos:
channel = v.get("channel", {}).get("name", "Unknown")
if channel not in influencers:
influencers[channel] = {
"channel": channel,
"videos": [],
"total_views": 0,
}
influencers[channel]["videos"].append(v.get("title", ""))
influencers[channel]["total_views"] += v.get("views", 0)
return sorted(influencers.values(), key=lambda x: x["total_views"], reverse=True)
# Find top fitness YouTube influencers
results = find_influencers("home workout")
for r in results[:5]:
print(f"{r['channel']}: {r['total_views']:,} views across {len(r['videos'])} videos")JavaScript 示例
JavaScript
const H = {'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json'};
async function findInfluencers(niche, minResults=10) {
const r = await fetch('https://api.scavio.dev/api/v1/search', {method:'POST', headers:H, body:JSON.stringify({query:niche+' tutorial 2026', platform:'youtube', country_code:'us'})});
const videos = (await r.json()).video_results || [];
const map = {};
for (const v of videos.slice(0,minResults)) {
const ch = v.channel?.name || 'Unknown';
if (!map[ch]) map[ch] = {channel:ch, videos:[], totalViews:0};
map[ch].videos.push(v.title||'');
map[ch].totalViews += v.views||0;
}
return Object.values(map).sort((a,b)=>b.totalViews-a.totalViews);
}
const results = await findInfluencers('home workout');
for (const r of results.slice(0,5)) {
console.log(r.channel+': '+r.totalViews+' views, '+r.videos.length+' videos');
}使用的平台
YouTube
包含转录和元数据的视频搜索
包含知识图谱、PAA和AI概览的网页搜索