tiktokcompetitive-intelligenceapi

TikTok Competitor Analysis via API: Posts, Engagement, Strategy

Analyze competitor TikTok accounts programmatically. Pull posting frequency, engagement benchmarks, content themes, and detect viral outliers.

6 min read

Monitor competitor TikTok accounts via API for $0.005 per request. Track their posting frequency, engagement rates, top-performing content, and follower growth without logging into TikTok or maintaining scrapers.

What You Can Track

  • Profile metrics: follower count, following count, total videos, total likes
  • Posting frequency: how often they post and when
  • Content performance: views, likes, comments, shares per video
  • Hashtag strategy: which hashtags they use most
  • Engagement rate: average engagement relative to follower count

Competitor Profile Snapshot

Python
import requests, os, json
from datetime import datetime

API_KEY = os.environ["SCAVIO_API_KEY"]
BASE = "https://api.scavio.dev"
HEADERS = {"Authorization": f"Bearer {API_KEY}",
           "Content-Type": "application/json"}

def competitor_snapshot(username):
    resp = requests.post(f"{BASE}/api/v1/tiktok/profile",
        headers=HEADERS, json={"username": username})
    user = resp.json()["data"]["user"]

    # Get recent posts
    resp2 = requests.post(f"{BASE}/api/v1/tiktok/user/posts",
        headers=HEADERS,
        json={"sec_user_id": user["sec_uid"], "count": 20, "sort_type": "0"})
    posts = resp2.json()["data"]["aweme_list"]

    views = [p["statistics"]["play_count"] for p in posts]
    likes = [p["statistics"]["digg_count"] for p in posts]
    comments = [p["statistics"]["comment_count"] for p in posts]

    return {
        "username": user["unique_id"],
        "followers": user["follower_count"],
        "total_videos": user["aweme_count"],
        "total_likes": user["total_favorited"],
        "recent_posts": len(posts),
        "avg_views": int(sum(views) / len(views)) if views else 0,
        "avg_likes": int(sum(likes) / len(likes)) if likes else 0,
        "avg_comments": int(sum(comments) / len(comments)) if comments else 0,
        "engagement_rate": round(
            (sum(likes) + sum(comments)) / len(posts) / user["follower_count"] * 100, 2
        ) if posts and user["follower_count"] > 0 else 0,
        "top_video_views": max(views) if views else 0,
    }

competitors = ["competitor_a", "competitor_b", "competitor_c"]
for comp in competitors:
    snap = competitor_snapshot(comp)
    print(f"@{snap['username']}: {snap['followers']:,} followers, "
          f"{snap['engagement_rate']}% ER, avg {snap['avg_views']:,} views")

Content Strategy Analysis

Python
from collections import Counter

def analyze_content_strategy(username):
    resp = requests.post(f"{BASE}/api/v1/tiktok/profile",
        headers=HEADERS, json={"username": username})
    sec_uid = resp.json()["data"]["user"]["sec_uid"]

    # Fetch more posts for better analysis
    all_posts = []
    cursor = "0"
    for _ in range(5):
        resp = requests.post(f"{BASE}/api/v1/tiktok/user/posts",
            headers=HEADERS,
            json={"sec_user_id": sec_uid, "count": 20, "cursor": cursor})
        data = resp.json()["data"]
        all_posts.extend(data.get("aweme_list", []))
        if not data.get("has_more"):
            break
        cursor = str(data.get("max_cursor", "0"))

    # Hashtag frequency
    hashtags = Counter()
    for p in all_posts:
        for h in p.get("cha_list", []):
            if h.get("hashtag_name"):
                hashtags[h["hashtag_name"]] += 1

    # Posting cadence
    timestamps = sorted(p["create_time"] for p in all_posts)
    if len(timestamps) >= 2:
        days_span = (timestamps[-1] - timestamps[0]) / 86400
        posts_per_week = len(timestamps) / (days_span / 7) if days_span > 0 else 0
    else:
        posts_per_week = 0

    return {
        "total_analyzed": len(all_posts),
        "posts_per_week": round(posts_per_week, 1),
        "top_hashtags": hashtags.most_common(10),
    }

Weekly Competitor Report

Python
def weekly_report(competitors, output_file="competitor_report.json"):
    report = {"date": str(datetime.now().date()), "competitors": []}
    for username in competitors:
        snap = competitor_snapshot(username)
        strategy = analyze_content_strategy(username)
        report["competitors"].append({**snap, **strategy})

    with open(output_file, "w") as f:
        json.dump(report, f, indent=2)
    print(f"Report saved: {len(competitors)} competitors analyzed")
    return report

Cost

Monitoring 5 competitors weekly costs about $0.30 per run (profile + 5 pages of posts per competitor = 6 credits each). Monthly cost: $1.20. Add daily frequency and it is still under $10/month. Compare this to Rival IQ ($239/month), Socialbakers ($200/month+), or manual tracking by a social media analyst ($25-50/hour).