TikTok Trend Board is a small Python script that shows TikTok trending hashtags by region. It pulls the trending feed for two regions (US and GB by default), counts which hashtags show up, drills into the top 3 topical hashtags and reads comments on the most-played post.
The problem
Trending hashtag lists online are often old or mix in generic reach tags like #fyp. Analysts and social teams want to see what is moving in the trending feed today, per region, with the plays and likes behind each tag.
What the app does
- Pulls the trending feed for each region.
- Counts hashtags across those posts with summed plays, likes and shares.
- Skips generic reach tags when choosing tags to drill into.
- Pulls posts for the top 3 topical hashtags.
- Reads comments on the most-played trending post.
- Writes a dated board, CSVs and a top-hashtag chart.
How it works
- Trending feed.
GET /desearch/tiktok/trending?region=US&count=30per region. - Hashtag posts.
GET /desearch/tiktok/hashtag/{tag}?count=20for the top topical tags. - Comments.
GET /desearch/tiktok/comments/{video_id}?count=20on the most-played post. - Compute hashtag counts, post age, like rate and duplicates, and log cost per call.
The code
def get(session, costs, label, path, params):
"""GET one endpoint, record latency and the billing headers. Never logs request headers (API key)."""
t0 = time.time()
try:
r = session.get(BASE + path, params=params, timeout=120)
except requests.RequestException as e: # log the type only, never the exception object
print(f" {label:<38} request failed: {type(e).__name__}", flush=True)
costs.append({"ts": dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds"), "call": label, "path": path,
"params": json.dumps(params), "status": 0, "latency_s": round(time.time() - t0, 2), "items": None,
"usage_count": None, "cost_usd": None, "service": None, "error": type(e).__name__})
return None
lat = round(time.time() - t0, 2)
try:
body = r.json()
except ValueError:
body = {"non_json": r.text[:500]}
cost = r.headers.get("X-Desearch-Cost-Usd")
n = len(body) if isinstance(body, list) else None
costs.append({"ts": dt.datetime.now(dt.timezone.utc).isoformat(timespec="seconds"), "call": label, "path": path,
"params": json.dumps(params), "status": r.status_code, "latency_s": lat, "items": n,
"usage_count": r.headers.get("X-Desearch-Usage-Count"),
"cost_usd": round(float(cost), 6) if cost else None,
"service": r.headers.get("X-Desearch-Service"),
"error": None if r.ok else json.dumps(body)[:200]})
print(f" {label:<38} {r.status_code} {lat:>5.2f}s items={n} cost={costs[-1]['cost_usd']}", flush=True)
return body if r.ok else None
The folder has one script, tiktok_board.py, a sample board in sample-output.md and the chart from that run.
Endpoints
GET /desearch/tiktok/trendingGET /desearch/tiktok/hashtag/{tag}GET /desearch/tiktok/comments/{video_id}
Example output
From a run on 2026-10-05 for US and GB: 6 calls in about 27 seconds, 107 items returned. The board shows, per region, posts returned, unique posts, median post age, total plays and median like rate, then the top hashtags with their plays, likes and shares.
Run it yourself
The public examples folder linked above includes the script and a README. Install its requirements, set DESEARCH_API_KEY from console.desearch.ai, and use the run command in that README.
Useful flags: --regions US GB, --count (trending posts per call, 1 to 100), --pulls (more samples per region), --top-tags (default 3), --no-comments, --from-raw FILE (no API calls).
What it costs
Billing is per item returned. The script prints the exact total from the X-Desearch-Cost-Usd headers at the end of each run. See pricing.
Ideas to extend it
- Run it daily and keep a history of rising tags.
- Add more regions.
- Feed the top tags into the hashtag research tool to pick tags for your niche.
