TikTok Competitor Intelligence via API
Monitor TikTok competitors: posting frequency, engagement rates, hashtag strategy. Pipeline using profile + posts endpoints at $0.01 per competitor check.
Monitoring TikTok competitors manually means opening profiles daily, scrolling through posts, and guessing at engagement rates. The TikTok API alternative: pull profile stats, recent posts, and engagement metrics programmatically. Cost: 2 API calls per competitor per check (profile + posts) at $0.005 each = $0.01 per competitor.
What you can track
- Posting frequency: how often competitors post and at what times
- Engagement rates: likes, comments, shares per video relative to follower count
- Content themes: which topics and formats get the most engagement
- Audience growth: follower count changes over time
- Hashtag strategy: which hashtags competitors use and which perform best
Step 1: get competitor profile
import requests, os
KEY = os.environ["SCAVIO_API_KEY"]
H = {"Authorization": f"Bearer {KEY}", "Content-Type": "application/json"}
BASE = "https://api.scavio.dev/api/v1/tiktok"
def get_profile(username: str):
"""Get TikTok profile data including follower count."""
resp = requests.post(f"{BASE}/profile",
headers=H, json={"username": username})
data = resp.json()
return {
"username": username,
"sec_uid": data.get("sec_uid"),
"followers": data.get("follower_count"),
"following": data.get("following_count"),
"likes": data.get("heart_count"),
"videos": data.get("video_count"),
}
profile = get_profile("competitor_username")
print(f"Followers: {profile['followers']}, Videos: {profile['videos']}")Step 2: analyze recent posts
def get_recent_posts(sec_uid: str, count: int = 20):
"""Get recent posts and calculate engagement metrics."""
resp = requests.post(f"{BASE}/user/posts",
headers=H, json={"sec_uid": sec_uid, "count": count})
posts = resp.json().get("posts", [])
return [{
"desc": p.get("desc", "")[:100],
"likes": p.get("digg_count", 0),
"comments": p.get("comment_count", 0),
"shares": p.get("share_count", 0),
"views": p.get("play_count", 0),
"created": p.get("create_time"),
} for p in posts]
def engagement_summary(posts: list, follower_count: int):
"""Calculate engagement rate and posting frequency."""
if not posts or not follower_count:
return None
total_engagement = sum(p["likes"] + p["comments"] + p["shares"] for p in posts)
avg_engagement = total_engagement / len(posts)
avg_views = sum(p["views"] for p in posts) / len(posts)
return {
"avg_engagement_rate": round(avg_engagement / follower_count * 100, 2),
"avg_views": int(avg_views),
"avg_likes": int(sum(p["likes"] for p in posts) / len(posts)),
"posts_analyzed": len(posts),
}
# Full competitor analysis: 2 API calls = $0.01
profile = get_profile("competitor_username")
posts = get_recent_posts(profile["sec_uid"])
summary = engagement_summary(posts, profile["followers"])
print(f"Engagement rate: {summary['avg_engagement_rate']}%")
print(f"Avg views: {summary['avg_views']}")Step 3: track over time
import json
from datetime import date
def daily_snapshot(competitors: list):
"""Take daily snapshot of competitor metrics."""
snapshots = []
for username in competitors:
profile = get_profile(username)
posts = get_recent_posts(profile["sec_uid"])
summary = engagement_summary(posts, profile["followers"])
snapshots.append({
"date": date.today().isoformat(),
"username": username,
"followers": profile["followers"],
**summary,
})
return snapshots
# 5 competitors x 2 calls each = 10 API calls/day = $0.05/day = $1.50/mo
competitors = ["brand_a", "brand_b", "brand_c", "brand_d", "brand_e"]
snapshots = daily_snapshot(competitors)Alerting on changes
Set thresholds for alerts: follower growth exceeding 5% in a week, a video exceeding 10x average views (potential viral content), or a new hashtag appearing in their top posts. Run the snapshot daily via cron and compare against the previous day's data. The cost at 5 competitors is $1.50/mo -- negligible compared to the competitive intelligence value.