DEV Community

Tabsafely Data
Tabsafely Data

Posted on

Building a China trending-topics monitor (Weibo, Baidu, Zhihu, Douyin) in 30 lines of Python

What is China talking about right now? If you work in PR, brand monitoring, journalism or you feed LLM pipelines, that question means checking six different hot lists: Weibo hot search (微博热搜), Baidu hot search, Zhihu hot list, Douyin trending, Toutiao and Bilibili — each with its own format, none with an official public API.

I got tired of maintaining six scrapers, so I merged them into one Apify Actor that returns a single unified schema. This post shows how to turn it into a tiny keyword alert.

Disclosure: I built the Actor. Pricing is pay-per-result ($2 / 1,000 items — a full run of ~280 items costs about half a cent).

Unified output

{"platform":"weibo","rank":3,"title":"...","url":"https://s.weibo.com/weibo?q=...",
 "hotValue":1234567,"label":"hot","category":null,"fetchedAt":"2026-10-28T08:16:41Z"}
Enter fullscreen mode Exit fullscreen mode

Every platform maps to the same fields: platform, rank, title, url, hotValue, label, category, fetchedAt.

Fetch everything

import os
from apify_client import ApifyClient

client = ApifyClient(os.environ["APIFY_TOKEN"])
ACTOR = "certified_astronomy_6vi/china-trending-hotlists"

def trending(platforms=("weibo","baidu","zhihu","douyin","toutiao","bilibili"), n=50):
    run = client.actor(ACTOR).call(run_input={
        "platforms": list(platforms), "maxItemsPerPlatform": n})
    return list(client.dataset(run["defaultDatasetId"]).iterate_items())

items = trending(n=10)
for it in items:
    print(f"[{it['platform']:>8}] #{it['rank']:<2} {it['title']}  ({it.get('hotValue')})")
Enter fullscreen mode Exit fullscreen mode

Keyword alert

WATCH = ["特斯拉", "Apple", "小米", "比亚迪"]   # brands you care about

hits = [it for it in trending() if any(k.lower() in it["title"].lower() for k in WATCH)]
for h in hits:
    print(f"ALERT {h['platform']} #{h['rank']}: {h['title']} -> {h['url']}")
    # send to Slack / email / Telegram here
Enter fullscreen mode Exit fullscreen mode

Make it continuous

In the Apify console, create a Schedule (e.g. every hour) for the Actor and add a webhook on ACTOR.RUN.SUCCEEDED pointing to your own endpoint. Each run's dataset becomes one snapshot — append them to a table and you get topic lifecycles: when a topic first appears, which platform picks it up first, how long it stays.

import pandas as pd
df = pd.DataFrame(items)
print(df.groupby("platform")["title"].count())
# Cross-platform topics: same keyword appearing on 3+ lists
Enter fullscreen mode Exit fullscreen mode

English titles?

Titles stay in original Chinese. Pipe them through any translation API or an LLM — batching ~50 titles per prompt is cheap.

Responsible use

Only public trending lists, no login, no personal data, one request per platform per run.

Link: https://apify.com/certified_astronomy_6vi/china-trending-hotlists

Which platform should I add next — Xiaohongshu public trends, 36Kr, or Kuaishou? Let me know.

Top comments (0)