Finding creators with overlapping audiences reveals collaboration opportunities and helps brands avoid paying two influencers to reach the same people. This pipeline compares follower lists between TikTok creators, calculates overlap percentages, and identifies shared audience segments. Each follower list pull costs $0.005 through Scavio TikTok API endpoints.
Prerequisites
- Python 3.8+
- requests library
- A Scavio API key from scavio.dev
- TikTok creator usernames to compare
Walkthrough
Step 1: Pull creator profiles and follower samples
Fetch profile data and follower lists for comparison.
import os, requests, json
from collections import Counter
API_KEY = os.environ['SCAVIO_API_KEY']
TH = {'Authorization': f'Bearer {API_KEY}', 'Content-Type': 'application/json'}
def get_profile(username):
data = requests.post('https://api.scavio.dev/api/v1/tiktok/profile',
headers=TH, json={'username': username}).json()
user = data.get('user', data.get('data', {}).get('user', data))
return {'username': username, 'followers': user.get('followerCount', user.get('fans', 0)),
'following': user.get('followingCount', 0),
'likes': user.get('heartCount', user.get('heart', 0))}
def get_followers(username):
data = requests.post('https://api.scavio.dev/api/v1/tiktok/user/followers',
headers=TH, json={'username': username}).json()
followers = data.get('followers', data.get('data', {}).get('followers', []))
return [f.get('uniqueId', f.get('username', '')) for f in followers if f.get('uniqueId') or f.get('username')]
creators = ['charlidamelio', 'addisonre', 'bellapoarch']
for c in creators:
p = get_profile(c)
print(f'{c}: {p["followers"]:,} followers, {p["likes"]:,} likes')Step 2: Calculate follower overlap
Compare follower lists between creator pairs.
def overlap(creator_a, creator_b):
followers_a = set(get_followers(creator_a))
followers_b = set(get_followers(creator_b))
if not followers_a or not followers_b:
return {'pair': f'{creator_a} x {creator_b}', 'overlap': 0, 'pct_a': 0, 'pct_b': 0}
shared = followers_a & followers_b
return {
'pair': f'{creator_a} x {creator_b}',
'followers_a': len(followers_a),
'followers_b': len(followers_b),
'shared': len(shared),
'pct_a': len(shared) / len(followers_a) * 100 if followers_a else 0,
'pct_b': len(shared) / len(followers_b) * 100 if followers_b else 0,
'shared_users': list(shared)[:10]
}
result = overlap('charlidamelio', 'addisonre')
print(f'{result["pair"]}: {result["shared"]} shared ({result["pct_a"]:.1f}% of A, {result["pct_b"]:.1f}% of B)')Step 3: Build the full overlap matrix
Compare all creator pairs and build a matrix.
from itertools import combinations
def overlap_matrix(creators):
pairs = list(combinations(creators, 2))
results = []
print(f'Comparing {len(pairs)} pairs ({len(pairs) * 2} follower pulls)...')
for a, b in pairs:
r = overlap(a, b)
results.append(r)
print(f' {a:20} x {b:20} | shared: {r["shared"]:4} | {r["pct_a"]:.1f}% / {r["pct_b"]:.1f}%')
cost = len(pairs) * 2 * 0.005 # 2 follower pulls per pair
print(f'\nCost: ${cost:.3f} ({len(pairs) * 2} API calls)')
return results
results = overlap_matrix(['charlidamelio', 'addisonre', 'bellapoarch'])
# Highest overlap pair
best = max(results, key=lambda x: x['shared'])
print(f'\nHighest overlap: {best["pair"]} ({best["shared"]} shared followers)')Step 4: Generate collaboration recommendations
Rank creator pairs by overlap for brand collaboration planning.
def recommend(results, strategy='maximize_reach'):
print(f'\n=== Collaboration Recommendations ({strategy}) ===')
if strategy == 'maximize_reach':
# Low overlap = more unique reach
ranked = sorted(results, key=lambda x: x['pct_a'] + x['pct_b'])
print('Pairs with LOWEST overlap (maximum unique reach):')
else:
# High overlap = reinforced messaging
ranked = sorted(results, key=lambda x: x['pct_a'] + x['pct_b'], reverse=True)
print('Pairs with HIGHEST overlap (reinforced messaging):')
for i, r in enumerate(ranked[:5], 1):
avg_overlap = (r['pct_a'] + r['pct_b']) / 2
print(f' {i}. {r["pair"]:45} | overlap: {avg_overlap:.1f}% | shared: {r["shared"]}')
report = {'strategy': strategy, 'recommendations': ranked[:5], 'total_pairs': len(results)}
with open('overlap_report.json', 'w') as f: json.dump(report, f, indent=2, default=str)
print(f'Saved to overlap_report.json')
return report
recommend(results, 'maximize_reach')
recommend(results, 'reinforce_message')Python Example
import os, requests
TH = {'Authorization': f'Bearer {os.environ["SCAVIO_API_KEY"]}', 'Content-Type': 'application/json'}
def compare(user_a, user_b):
fa = requests.post('https://api.scavio.dev/api/v1/tiktok/user/followers',
headers=TH, json={'username': user_a}).json()
fb = requests.post('https://api.scavio.dev/api/v1/tiktok/user/followers',
headers=TH, json={'username': user_b}).json()
a = set(f.get('uniqueId', '') for f in fa.get('followers', []))
b = set(f.get('uniqueId', '') for f in fb.get('followers', []))
shared = a & b
print(f'{user_a} x {user_b}: {len(shared)} shared of {len(a)}+{len(b)} ({len(shared)/(len(a) or 1)*100:.1f}%)')
compare('charlidamelio', 'addisonre')JavaScript Example
const TH = { 'Authorization': `Bearer ${process.env.SCAVIO_API_KEY}`, 'Content-Type': 'application/json' };
async function compare(userA, userB) {
const [fa, fb] = await Promise.all([
fetch('https://api.scavio.dev/api/v1/tiktok/user/followers', {
method: 'POST', headers: TH, body: JSON.stringify({ username: userA }) }).then(r => r.json()),
fetch('https://api.scavio.dev/api/v1/tiktok/user/followers', {
method: 'POST', headers: TH, body: JSON.stringify({ username: userB }) }).then(r => r.json()),
]);
const a = new Set((fa.followers||[]).map(f => f.uniqueId));
const b = new Set((fb.followers||[]).map(f => f.uniqueId));
const shared = [...a].filter(x => b.has(x));
console.log(`${userA} x ${userB}: ${shared.length} shared of ${a.size}+${b.size}`);
}
compare('charlidamelio', 'addisonre').catch(console.error);Expected Output
charlidamelio: 155,200,000 followers, 11,800,000,000 likes
addisonre: 88,700,000 followers, 5,900,000,000 likes
bellapoarch: 93,400,000 followers, 2,300,000,000 likes
Comparing 3 pairs (6 follower pulls)...
charlidamelio x addisonre | shared: 847 | 42.3% / 38.1%
charlidamelio x bellapoarch | shared: 312 | 15.6% / 14.2%
addisonre x bellapoarch | shared: 523 | 26.2% / 23.8%
Cost: $0.030 (6 API calls)
Highest overlap: charlidamelio x addisonre (847 shared followers)
=== Collaboration Recommendations (maximize_reach) ===
Pairs with LOWEST overlap (maximum unique reach):
1. charlidamelio x bellapoarch | overlap: 14.9% | shared: 312