tiktokgraph-analysisfollower-data

TikTok Follower Graph Analysis via API

Analyze TikTok follower networks via API. Map common followers between creators, find connector accounts, and measure audience overlap with Jaccard similarity.

5 min read

Scavio TikTok follower and following endpoints let you map creator networks at $0.005 per page of 20 users. Identify shared audiences between influencers, find connector accounts, and discover niche communities through graph analysis.

Three Pagination Styles

TikTok API uses three different pagination patterns. User posts use max_cursor. Search and comments use numeric cursor offsets. Followers and followings use page_token plus min_time. You need both values from the previous response to fetch the next page.

Building a Follower Network

Python
import requests, os
from collections import Counter

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

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

def get_followers(sec_uid, max_pages=10):
    followers = []
    params = {"sec_user_id": sec_uid, "count": 20}
    for _ in range(max_pages):
        resp = requests.post(f"{BASE}/api/v1/tiktok/user/followers",
            headers=HEADERS, json=params)
        data = resp.json()["data"]
        for f in data.get("followers", []):
            followers.append({
                "username": f["unique_id"],
                "followers": f["follower_count"],
                "videos": f["aweme_count"],
                "sec_uid": f["sec_uid"],
            })
        if not data.get("has_more"):
            break
        params["page_token"] = data["next_page_token"]
        params["min_time"] = data["min_time"]
    return followers

Finding Common Followers

Python
def common_followers(username_a, username_b, sample_pages=15):
    uid_a = get_sec_uid(username_a)
    uid_b = get_sec_uid(username_b)

    followers_a = {f["username"] for f in get_followers(uid_a, sample_pages)}
    followers_b = {f["username"] for f in get_followers(uid_b, sample_pages)}

    overlap = followers_a & followers_b
    only_a = followers_a - followers_b
    only_b = followers_b - followers_a

    return {
        "overlap": len(overlap),
        "only_a": len(only_a),
        "only_b": len(only_b),
        "jaccard": len(overlap) / len(followers_a | followers_b)
            if (followers_a | followers_b) else 0,
    }

Mapping Who Creators Follow

Python
def get_followings(sec_uid, max_pages=5):
    followings = []
    params = {"sec_user_id": sec_uid, "count": 20}
    for _ in range(max_pages):
        resp = requests.post(f"{BASE}/api/v1/tiktok/user/followings",
            headers=HEADERS, json=params)
        data = resp.json()["data"]
        for f in data.get("followings", []):
            followings.append({
                "username": f["unique_id"],
                "followers": f["follower_count"],
            })
        if not data.get("has_more"):
            break
        params["page_token"] = data["next_page_token"]
        params["min_time"] = data["min_time"]
    return followings

def find_connectors(creator_usernames):
    """Find accounts that multiple creators follow."""
    following_counts = Counter()
    for username in creator_usernames:
        uid = get_sec_uid(username)
        followings = get_followings(uid)
        for f in followings:
            following_counts[f["username"]] += 1

    connectors = [(user, count) for user, count
                  in following_counts.most_common(20)
                  if count >= 2]
    return connectors

# Find accounts followed by multiple niche creators
connectors = find_connectors(["creator_a", "creator_b", "creator_c"])
for user, count in connectors:
    print(f"@{user} followed by {count}/{3} creators")

Use Cases

  • Influencer marketing: measure audience overlap before booking multiple creators for the same campaign
  • Competitive intelligence: see which brands or tools your competitors follow
  • Community mapping: identify niche micro-communities through shared follower patterns
  • Fraud detection: spot follower farms by checking if followers have zero videos and follow hundreds of accounts

Cost

Sampling 200 followers for each of 3 creators costs about 32 credits ($0.16): 3 profile lookups + 10 pages each. Finding common followers between 2 creators at 15 pages each costs $0.16. Full graph analysis of 10 creators costs roughly $1.60. TikTok limits how many followers you can retrieve (typically the most recent), so this is a sample-based analysis rather than a complete census.