Get TikTok trending searches by country with Python

Updated 2026-10-03

TikTok keeps a list of the searches that are trending right now in each country. It is a quick signal for content ideas, hashtag research and market research. This guide pulls that list with a few lines of Python, saves it to a CSV, and shows how to run it every day.

What you need

Get the trending searches for a country

Call trending_searches with a two-letter country code. count is how many searches you want back.

from omarthing import Client

api = Client("YOUR_API_KEY")

data = api.trending_searches(region="US", count=10)
for rank, word in enumerate(data["words"], 1):
    print(rank, word["trendingSearchWord"])

Example output (the list changes over time):

1 Costco New Finds Haul
2 New Mac Studio Desktop From Apple
3 Wajo Fo Automates Orders
...

Each item has trendingSearchWord, the search text, and trendingSearchWordType. Full parameters are on the trending searches endpoint page.

Several countries at once

This script takes any number of country codes on the command line and prints each list:

import argparse

from omarthing import Client


def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("regions", nargs="+", help="ISO country codes, e.g. US GB SA")
    ap.add_argument("--count", type=int, default=10)
    args = ap.parse_args()
    api = Client()
    for region in args.regions:
        data = api.trending_searches(region=region.upper(), count=args.count)
        print(f"\n== {region.upper()} ==")
        for i, w in enumerate(data["words"], 1):
            print(f"{i:>2}. {w['trendingSearchWord']}")


if __name__ == "__main__":
    main()

Run it like python trending_by_country.py US GB DE --count 10.

Save the results to a CSV

Trends are only useful over time, so write each run to a file with the date and the rank. Save this as daily_trending.py:

import csv
from datetime import date

from omarthing import Client

api = Client("YOUR_API_KEY")

with open("trending.csv", "a", newline="", encoding="utf-8") as f:
    out = csv.writer(f)
    for region in ["US", "GB", "DE"]:
        words = api.trending_searches(region=region, count=20)["words"]
        for rank, word in enumerate(words, 1):
            out.writerow([date.today().isoformat(), region, rank, word["trendingSearchWord"]])

It appends one row per search: date, country, rank, search text.

Run it every day

On Linux or macOS, add a line to crontab -e. This runs it at 08:00 every day:

0 8 * * * cd /home/you/trends && OMARTHING_API_KEY=YOUR_API_KEY python3 daily_trending.py >> trending.log 2>&1

On Windows, create a daily task in Task Scheduler that runs the same Python command. Keep your key in an environment variable instead of the script when other people can read the file.

Which countries return data?

Trending searches are available for these countries: US, GB, CA, AU, DE, FR, IT, MX, KR, PH, VN, TH, NG, AR, CO. Other country codes return no data, so if a code comes back empty, try one from this list.

JavaScript or curl instead

The same call from the command line:

curl "https://dev.omar-thing.site/api/v1/trending_searches?region=US&count=10" -H "X-API-Key: YOUR_API_KEY"

And in JavaScript or TypeScript (npm install omarthing):

import { Client } from 'omarthing';

const api = new Client('YOUR_API_KEY');
const { words } = await api.trendingSearches({ region: 'US', count: 10 });
words.forEach((w, i) => console.log(i + 1, w.trendingSearchWord));

Questions

How often does the list change?

It moves during the day, so store the date (and the time, if you run it more than once a day) with every run. That is what the CSV example does.

Can I get the trending searches for any country?

Only for the countries listed above. The API returns an empty list for the others.

Is this an official TikTok API?

No. This is an unofficial API that returns public TikTok data. It is not affiliated with, endorsed by, or sponsored by TikTok or ByteDance.

Next steps