How to Scrape TikTok Search Results with Python (2026 Guide)
TikTok search is the fastest way to see what people are posting about a topic right now. Scraping it yourself means fighting signed requests, rotating proxies and constant layout changes. This guide skips all of that: you send a keyword to a hosted API and get clean JSON back.
We will use the Advanced Search TikTok API Actor on Apify, the most used search scraper in the Novi catalog, with more than 6 million runs.
What you get per video
Every result is one TikTok video with:
aweme_idandshare_url: the video ID and its public linkdescandcreate_time: caption with hashtags, and the Unix publish timestampstatistics:play_count,digg_count(likes),comment_count,share_countauthor:unique_id(username),nickname,signature(bio)video.play_addr.url_list: playable URLs without a watermarkmusic,cha_list(hashtags) andis_ads
Step 1: Get an Apify API token
- Create a free account at Apify. The free plan includes monthly credit, which covers thousands of search results.
- Open Settings → API & Integrations in the Apify Console and copy your personal API token.
- Export it in your shell:
export APIFY_TOKEN="your-token-here"
pip install apify-client
Step 2: Choose your input
The Actor accepts these main options:
| Field | Example | Meaning |
|---|---|---|
keywords |
["skincare routine", "sunscreen"] |
One or more search phrases |
limit |
100 |
Max videos per keyword |
region |
"US" |
Country the search runs from |
sortType |
0 |
0 relevance, 1 most liked, 2 most recent |
publishTime |
"WEEK" |
ALL_TIME, YESTERDAY, WEEK, MONTH, THREE_MONTH, SIX_MONTH |
fetchUserBio |
false |
Also look up each creator’s bio |
Step 3: Run it from Python
import os
from apify_client import ApifyClient
client = ApifyClient(os.environ["APIFY_TOKEN"])
run_input = {
"keywords": ["skincare routine"],
"limit": 100,
"region": "US",
"sortType": 1, # most liked first
"publishTime": "WEEK", # only videos from the last 7 days
}
run = client.actor("novi/advanced-search-tiktok-api").call(run_input=run_input)
for video in client.dataset(run["defaultDatasetId"]).iterate_items():
stats = video.get("statistics", {})
print(
video.get("author", {}).get("unique_id"),
stats.get("play_count"),
stats.get("digg_count"),
video.get("share_url"),
)
call() waits for the run to finish, then you read the dataset. For a few hundred videos this takes well under a minute.
Step 4: Save to CSV with pandas
import pandas as pd
rows = []
for video in client.dataset(run["defaultDatasetId"]).iterate_items():
stats = video.get("statistics", {})
rows.append({
"id": video.get("aweme_id"),
"url": video.get("share_url"),
"caption": video.get("desc"),
"author": video.get("author", {}).get("unique_id"),
"plays": stats.get("play_count"),
"likes": stats.get("digg_count"),
"comments": stats.get("comment_count"),
"shares": stats.get("share_count"),
"published": pd.to_datetime(video.get("create_time"), unit="s"),
})
df = pd.DataFrame(rows)
df["engagement_rate"] = (df.likes + df.comments + df.shares) / df.plays
df.sort_values("engagement_rate", ascending=False).to_csv("tiktok_search.csv", index=False)
Now you have a ranked list of the most engaging videos for your keyword this week.
Tips
- Monitor a topic daily. Schedule the Actor in the Apify Console with
publishTime: "YESTERDAY"and you get a fresh feed every morning. - Need everything, not a sample? Set
isUnlimited: trueto keep paginating until TikTok runs out of results. - Shrink the output.
customMapFunctionlets you return only the fields you need, which keeps datasets small. - No code at all? Run the Actor from the Apify Console and click Export to download CSV, Excel or JSON.
Cost
You pay per video returned, with no monthly fee. Check the current price on the Actor page: a 1,000-video research sample usually costs well under a dollar.
Try Advanced Search TikTok API
TikTok Search Scraper - Explore, discover, and analyze TikTok content with ease. Gain valuable insights and optimize your marketing efforts. Provides no-watermark download link.