Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TikTok Profile Analytics & Contacts Scraper — Python Example

Pull TikTok profile data, video lists, computed engagement analytics, sponsored-post detection, and bio contacts (emails, Instagram, YouTube, WhatsApp) for bulk creator shortlists — in Python.

Apify Actor Python 3.10+ License: MIT

Working Python project that drives the TikTok Profile Pro Scraper Apify actor — purpose-built for influencer marketing, talent agency, and brand-partnership workflows. Takes a list of TikTok usernames, returns per-creator profile metadata, the last N videos, computed engagement analytics (engagement rate, average views, median views, posting frequency, top hashtags, top sounds), sponsored-post detection, and contacts extracted from the bio + bio link. First 10 videos free per profile.

What this does

Most influencer-research tools (Modash, Heepsy, Klear, GRIN) bundle TikTok creator data into $300–$2,000/month enterprise contracts. The data they sell is largely a wrapper around scraped TikTok profile pages + their own analytics layer. This actor replicates the same value: it scrapes the profile, pulls the user's last 30 videos, computes the same analytics, runs the same #ad / #sponsored / #paidpartnership heuristics, and extracts contacts from the bio and bio link — but exposes the pipeline as a programmable Apify actor with pay-as-you-go pricing.

Use cases

  • Influencer-marketing campaign sourcing — score and shortlist creators against your campaign brief (niche, engagement rate, audience country).
  • Brand-partnership prospecting — pull bio emails + Instagram handles for cold outreach to creators you want to sponsor.
  • Sponsored-post FTC compliance audit — flag every video with #ad / #sponsored / #partner markers to verify a creator is following disclosure rules.
  • Competitor influencer mapping — pull the contact list of creators currently promoting your competitor's product.
  • Trend research — surface the top hashtags and sounds across a peer group of creators in your niche.
  • Talent agency pipeline — bulk-load a roster of creators into your CRM with full analytics for pitch decks.

Requirements

  • Python 3.10+
  • A free Apify account
  • No TikTok login or developer credentials required
  • Minimum 10 profiles per run (actor input constraint)

Quick start

git clone https://github.com/pro100chok/tiktok-profile-analytics-scraper-python.git
cd tiktok-profile-analytics-scraper-python
pip install -r requirements.txt
cp .env.example .env
# paste your APIFY_API_TOKEN
python main.py

main.py analyzes 12 fitness creators on TikTok (Chris Heria, Krissy Cela, Kayla Itsines, Blogilates, Athlean-X, etc.) — last 20 videos each, full analytics, contact extraction — and prints a leaderboard sorted by follower count.

What gets scraped per profile

For each TikTok handle you pass in, the actor returns:

Field group What's in it
Profile metadata username, nickname, bio, bioLink, avatarUrl, isVerified, isPrivate, region, followerCount, followingCount, heartCount (total likes), videoCount.
Videos (maxVideosPerProfile) One record per video: id, description, createTime, playCount (views), diggCount (likes), shareCount, commentCount, duration, hashtags[], music, cover URL, videoUrl, isSponsored flag.
Reposts (includeReposts) The user's Reposts tab as a separate reposts array.
Liked videos (includeLikedVideos) The user's Liked tab (only if openFavorite=true).
Analytics (computeAnalytics) avgViews, medianViews, engagementRate, postingFrequency (posts/week), topHashtags, topSounds, sponsoredPercent.
Contacts (extractContacts) emails, phones, socials (Instagram, YouTube, Twitter/X, Telegram, WhatsApp), websites parsed from bio + bio-link landing page.

How it works

For each input handle the actor:

  1. Hits TikTok's user/detail GraphQL endpoint via residential US proxy to get profile metadata.
  2. Walks the user's primary video playlist (with an embed-page fallback if the primary endpoint rate-limits).
  3. Optionally enumerates the Reposts tab and Liked tab if those feature flags are on.
  4. Aggregates engagement metrics across the last N videos for the analytics block.
  5. Runs a hashtag + bio text regex pass for sponsored markers (#ad, #sponsored, #partner, #paidpartnership, "partnered with", "in collaboration with").
  6. If extractContacts: true, parses the bio for emails / phones / handles and fetches the bio-link landing page to extract additional contacts.

Concurrency defaults to 3 profiles in parallel — that's the sweet spot for TikTok's rate limits with residential US IPs. Setting it higher works but increases retry rate.

Example: build a fitness-creator shortlist

import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_API_TOKEN"])

run = client.actor("pro100chok/tiktok-profile-pro").call(run_input={
    "profiles": [
        "chrisheria", "krissycela", "kayla_itsines", "blogilates",
        "athleanx", "fitfoodiefinds", "wholesome", "michelle_lewin",
        "alexia_clark", "natachaoceane",
    ],
    "maxVideosPerProfile": 30,
    "extractContacts": True,
    "computeAnalytics": True,
})

for p in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(f"@{p['username']}: {p['analytics']['engagementRate']}% ER "
          f"({p['followerCount']:,} followers)")

Example output

{
  "username": "chrisheria",
  "nickname": "Chris Heria",
  "bio": "Bodyweight athlete & founder of THENX 💪\nApp & training programs ↓",
  "bioLink": "https://thenx.com",
  "isVerified": true,
  "followerCount": 12_400_000,
  "videoCount": 1834,
  "heartCount": 412_500_000,
  "videos": [
    {
      "id": "7283019283012390123",
      "description": "5-minute morning routine that changed my life. #fitness #calisthenics",
      "playCount": 8_240_000,
      "diggCount": 1_350_000,
      "commentCount": 12_300,
      "hashtags": ["fitness", "calisthenics"],
      "isSponsored": false
    }
  ],
  "analytics": {
    "avgViews": 4_120_000,
    "engagementRate": 6.2,
    "postingFrequency": 4.5,
    "sponsoredPercent": 8,
    "topHashtags": [{ "tag": "fitness", "count": 14 }]
  },
  "contacts": {
    "emails": ["chris@thenx.com"],
    "socials": {
      "instagram": "https://instagram.com/chrisheria",
      "youtube": "https://youtube.com/@chrisheria"
    },
    "websites": ["https://thenx.com"]
  }
}

Input parameters

Parameter Type Required Description
profiles string[] yes Min 10 usernames / @usernames / profile URLs per run.
maxVideosPerProfile integer no Cap on videos fetched per profile. Default 30. 0 disables video fetching.
includeReposts boolean no Also scrape the Reposts tab. Default false.
maxRepostsPerProfile integer no Cap on reposts. Default 30.
includeLikedVideos boolean no Also scrape Liked tab (only if user enabled public likes). Default false.
maxLikedVideosPerProfile integer no Cap on liked videos. Default 30.
extractContacts boolean no Pull emails / phones / socials from bio + bio link. Default true.
computeAnalytics boolean no Compute engagement-rate / posting-frequency / hashtag analytics. Default true.
detectSponsored boolean no Flag #ad / #sponsored / #partner videos. Default true.
maxConcurrency integer no Parallel profiles. Default 3.
proxyConfiguration object yes Residential US strongly recommended.

More examples

File Demonstrates
examples/01_basic_usage.py Minimal 10-profile pull.
examples/02_sponsored_detection.py FTC-compliance audit — sponsored% per creator.
examples/03_bio_contacts.py Brand-outreach contact extraction.
examples/04_export_to_csv.py Engagement-rate shortlist export.
examples/05_export_to_google_sheets.py Sheet-based creator-pipeline workflow.

FAQ

Why is the minimum 10 profiles per run? TikTok's per-IP rate limits punish low-volume drive-by requests more than steady batches. Batching by 10 lets the actor warm sessions cleanly and keeps block rates under 1%. For single-profile lookups, just include 9 throwaway accounts you don't care about.

How are sponsored posts detected? The actor inspects each video's caption / hashtags / disclosure overlay for markers — #ad, #sponsored, #partner, #paidpartnership, "@brandname x @creator", "in collab with", "use code", "discount code". Matches are flagged in isSponsored: true and rolled up into sponsoredPercent.

How accurate are the engagement-rate numbers? The actor computes engagement rate the same way most influencer-marketing tools do: (avg_likes + avg_comments + avg_shares) / followerCount × 100. The exact formula matches Modash and HypeAuditor's published methodology.

Can I scrape private accounts? Public profile metadata (follower count, bio, verification) is returned for private accounts. The video list and analytics blocks are only filled in for public profiles.

Does this work outside the US? Yes — TikTok serves the same data for most countries. The actor defaults to a US residential IP because TikTok serves fewer block pages and CAPTCHAs to US IPs. For region-specific data, override the proxy apifyProxyCountry.

What's the actor's pricing structure? The actor's "first 10 videos free per profile" tier means a 100-profile shortlist with maxVideosPerProfile: 10 costs almost nothing. Bigger batches are metered per profile + per extra video beyond the first 10.

Can I get the creator's audience demographics? TikTok doesn't expose audience-side data on public profiles — for demographics you'd need access to TikTok's Creator Marketplace API or a third-party panel-based tool. This actor only returns publicly-visible profile and content data.

Related actors

See all my actors at apify.com/pro100chok.

License

MIT — see LICENSE.


Built on top of the TikTok Profile Pro Scraper Apify actor.