If you're a content creator or marketer, you know how important it is to keep up with YouTube trends. But finding trending topics manually takes time, and the official YouTube API can be expensive.
Today, I'm going to show you how to build a simple YouTube trend tracker using a SERP API. We'll get the top trending videos for your niche directly from Google search results, and it only takes about 10 minutes.
Why Use a SERP API for YouTube Trend Tracking?
I know what you're thinking: "Why not just use the official YouTube API?"
Here's the thing:
The YouTube API requires OAuth setup, quota management, and can get expensive
You need API keys approved, and there are rate limits
If you just need to see what's ranking for your niche keywords, you don't need all that complexity
Using a SERP API, you can search Google for "your niche + YouTube" and get the top-ranked videos directly. Simpler, cheaper, and gives you exactly what you need.
Complete Code
import requests
import json
from typing import List, Dict
from datetime import datetime
class YouTubeTrendTracker:
def __init__(self, api_token: str):
self.api_token = api_token
self.endpoint = "https://serpapi.talordata.net/serp/v1/request"
def get_top_youtube_videos(self, niche: str, location: str = None) -> List[Dict]:
headers = {
"Authorization": f"Bearer {self.api_token}",
"Content-Type": "application/x-www-form-urlencoded"
}
query = f"{niche} YouTube"
data = {"engine": "google", "q": query, "json": "2"}
if location:
data["location"] = location
response = requests.post(self.endpoint, headers=headers, data=data)
response.raise_for_status()
results = response.json()
videos = []
for result in results.get("organic_results", []):
url = result.get("link", "")
if "youtube.com" in url or "youtu.be" in url:
videos.append({
"title": result.get("title"),
"url": url,
"snippet": result.get("snippet", ""),
"position": result.get("position")
})
return videos
def save_trends_to_file(self, niche: str, videos: List[Dict]):
filename = f"youtube_trends_{niche.replace(' ', '_')}_{datetime.now().strftime('%Y%m%d')}.json"
with open(filename, "w") as f:
json.dump({
"niche": niche,
"date": datetime.now().isoformat(),
"videos": videos
}, f, indent=2)
print(f"Trends saved to {filename}")
return filename
if __name__ == "__main__":
API_TOKEN = "YOUR_TALORDATA_API_TOKEN"
tracker = YouTubeTrendTracker(API_TOKEN)
NICHE = "AI tools for developers"
videos = tracker.get_top_youtube_videos(NICHE, location="United States")
print(f"\nFound {len(videos)} top YouTube videos for '{NICHE}':\n")
for i, video in enumerate(videos, 1):
print(f"{i}. {video['title']}\n {video['url']}\n")
tracker.save_trends_to_file(NICHE, videos)
What You Can Do With This
- What You Can Do With This - Run weekly and see which topics start ranking higher
- Analyze what thumbnails/titles work - Look at top-ranked videos for patterns
- Track competitors - Search for competitor channels
- Content inspiration - Get proven topics that are already ranking
Cost Breakdown
Track 10 niches once per week: 40 requests/month → $0.04













