Tutorial

How to Map TikTok Creator Networks

Build follower-following network maps of TikTok creators to find collaboration clusters. Python implementation at $0.005/call.

TikTok creator networks reveal who influences whom. Mapping follower-following connections helps brands find collaboration clusters, bridge creators connecting niches, and avoid sponsoring creators with redundant audiences. This tutorial uses Scavio's TikTok follower and following endpoints at $0.005/call.

Prerequisites

  • Python 3.8+
  • requests and networkx installed
  • A Scavio API key from scavio.dev
  • Seed TikTok creators

Walkthrough

Step 1: Fetch profile and following data

Pull who each creator follows.

Python
import os, requests

API_KEY = os.environ['SCAVIO_API_KEY']
H = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}

def get_profile(username):
    user = requests.post('https://api.scavio.dev/api/v1/tiktok/profile',
        headers=H, json={'username': username}).json()['data']['user']
    return {'username': user['unique_id'], 'sec_uid': user['sec_uid'],
            'followers': user['follower_count']}

def get_following(sec_uid, limit=30):
    following = []
    params = {'sec_user_id': sec_uid, 'count': 20}
    while len(following) < limit:
        resp = requests.post('https://api.scavio.dev/api/v1/tiktok/user/followings',
            headers=H, json=params).json()['data']
        following.extend([u['unique_id'] for u in resp.get('users', [])])
        if not resp.get('has_more'): break
        params['max_cursor'] = resp.get('max_cursor', 0)
    return following[:limit]

Step 2: Build the network graph

Create edges between creators.

Python
import networkx as nx

def build_network(seeds):
    G = nx.DiGraph()
    for username in seeds:
        profile = get_profile(username)
        G.add_node(username, followers=profile['followers'])
        following = get_following(profile['sec_uid'])
        for f in following: G.add_edge(username, f)
        print(f'  @{username}: {len(following)} following')
    mutual = [(u, v) for u, v in G.edges() if G.has_edge(v, u)]
    print(f'Network: {G.number_of_nodes()} nodes, {len(mutual)} mutual follows')
    return G

G = build_network(['creator1', 'creator2', 'creator3'])

Step 3: Find bridge creators

Identify connectors with high betweenness centrality.

Python
def find_bridges(G):
    undirected = G.to_undirected()
    centrality = nx.betweenness_centrality(undirected)
    top = sorted(centrality.items(), key=lambda x: x[1], reverse=True)[:5]
    print('Bridge creators:')
    for user, score in top:
        print(f'  @{user}: centrality={score:.3f}, followers={G.nodes[user].get("followers", "?")}')

find_bridges(G)

Step 4: Estimate cost

Calculate API cost for network mapping.

Python
def estimate_cost(seed_count, pages_per=2):
    calls = seed_count + seed_count * pages_per  # profile + following pages
    cost = calls * 0.005
    print(f'{seed_count} seeds: {calls} calls, ${cost:.2f}')

estimate_cost(5)
estimate_cost(20)

Python Example

Python
import os, requests
API_KEY = os.environ['SCAVIO_API_KEY']
H = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}

def get_following(username):
    user = requests.post('https://api.scavio.dev/api/v1/tiktok/profile',
        headers=H, json={'username': username}).json()['data']['user']
    resp = requests.post('https://api.scavio.dev/api/v1/tiktok/user/followings',
        headers=H, json={'sec_user_id': user['sec_uid'], 'count': 20}).json()
    return [u['unique_id'] for u in resp['data'].get('users', [])]

for c in ['creator1']: print(f'@{c} follows: {", ".join(get_following(c)[:5])}')

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const H = { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' };
async function getFollowing(username) {
  const p = await fetch('https://api.scavio.dev/api/v1/tiktok/profile', {
    method: 'POST', headers: H, body: JSON.stringify({ username })
  }).then(r => r.json());
  const r = await fetch('https://api.scavio.dev/api/v1/tiktok/user/followings', {
    method: 'POST', headers: H,
    body: JSON.stringify({ sec_user_id: p.data.user.sec_uid, count: 20 })
  }).then(r => r.json());
  return (r.data.users || []).map(u => u.unique_id);
}
getFollowing('creator1').then(f => console.log(f.slice(0, 5))).catch(console.error);

Expected Output

JSON
  @creator1: 28 following
  @creator2: 35 following
  @creator3: 22 following
Network: 45 nodes, 12 mutual follows

Bridge creators:
  @creator2: centrality=0.340, followers=85000

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8+. requests and networkx installed. A Scavio API key from scavio.dev. Seed TikTok creators. A Scavio API key gives you 250 free credits per month.

Yes. The free tier includes 250 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Build follower-following network maps of TikTok creators to find collaboration clusters. Python implementation at $0.005/call.