Overview
Monitor a set of TikTok hashtags hourly to detect trending momentum before competitors notice. Pull hashtag metadata (view count, video count) and the latest videos posted under each hashtag. Calculate view velocity and flag hashtags with accelerating growth.
Trigger
Hourly cron at :00
Schedule
Hourly at :00
Workflow Steps
Load hashtag watchlist
Read target hashtags from config. Each entry has the hashtag name and the previous hour's view count for delta calculation.
Pull hashtag metadata
For each hashtag, call the hashtag endpoint to get current total view count and video count.
Fetch latest videos
Call hashtag/videos to get the 20 most recent videos. Extract post times, view counts, and creator info.
Calculate velocity
Compare current view count to previous hour. Flag hashtags gaining more than 10% per hour as trending.
Alert on breakout hashtags
Send a notification (Slack, email, webhook) for hashtags that cross the velocity threshold. Include the top 3 videos driving growth.
Python Implementation
import requests, os, json, time
H = {"Authorization": f"Bearer {os.environ['SCAVIO_API_KEY']}", "Content-Type": "application/json"}
BASE = "https://api.scavio.dev"
STATE_FILE = "hashtag_state.json"
def load_state():
try:
with open(STATE_FILE) as f: return json.load(f)
except FileNotFoundError: return {}
def track_hashtags(hashtags):
state = load_state()
alerts = []
for tag in hashtags:
resp = requests.post(f"{BASE}/api/v1/tiktok/hashtag",
headers=H, json={"hashtag": tag}).json()
data = resp["data"]
views = data.get("stats", {}).get("view_count", 0)
videos = data.get("stats", {}).get("video_count", 0)
prev = state.get(tag, {}).get("views", views)
delta = (views - prev) / prev * 100 if prev > 0 else 0
state[tag] = {"views": views, "videos": videos, "ts": int(time.time())}
if delta > 10:
alerts.append({"hashtag": tag, "delta_pct": round(delta, 1), "views": views})
with open(STATE_FILE, "w") as f: json.dump(state, f)
return alerts
alerts = track_hashtags(["skincare", "booktok", "techreview"])
for a in alerts:
print(f"#{a['hashtag']} trending: +{a['delta_pct']}% ({a['views']:,} views)")JavaScript Implementation
const BASE = "https://api.scavio.dev";
const H = { Authorization: `Bearer ${process.env.SCAVIO_API_KEY}`, "Content-Type": "application/json" };
const fs = require("fs");
async function trackHashtag(tag, prevViews = 0) {
const resp = await fetch(`${BASE}/api/v1/tiktok/hashtag`, {
method: "POST", headers: H, body: JSON.stringify({ hashtag: tag })
}).then(r => r.json());
const views = resp.data?.stats?.view_count || 0;
const delta = prevViews > 0 ? ((views - prevViews) / prevViews * 100) : 0;
if (delta > 10) console.log(`#${tag} TRENDING: +${delta.toFixed(1)}% (${views.toLocaleString()} views)`);
return { tag, views, delta };
}
trackHashtag("skincare", 1000000);Platforms Used
TikTok
Trending video, creator, and product discovery