DEV Community

豪豪景
豪豪景

Posted on AI-assisted

How to get China's trending topics (Weibo, Douyin, Zhihu, Baidu) in Python

If you do social listening, news monitoring or market research on China, the "hot search" lists (热搜) are the fastest signal of what people there are talking about right now. Each big platform publishes its own:

Platform List Good for
Weibo 微博 Hot Search, ~50 items celebrity, entertainment, breaking news
Douyin 抖音 Hot list, ~50 viral video topics
Zhihu 知乎 Hot list, 30 longer questions and debates
Baidu 百度 Realtime, plus Novel/Movie/TV/Car lists what people search
Toutiao 今日头条 Hot board, 50 mainstream news
Bilibili Hot search, 50 gaming, anime, younger audience
Tieba 贴吧 Hot topics, 30 forums, esports, fandoms

The hard part is that every source has a different format, Chinese-only docs, and they change without notice. This tutorial uses an API that returns all seven lists in one format, then goes a step further: finding topics that trend on several platforms at once, which is a much stronger signal than any single list.

Setup

pip install requests
export RAPIDAPI_KEY="your-key"
Enter fullscreen mode Exit fullscreen mode
import os, requests

HOST = "china-trends-api-weibo-douyin-zhihu-baidu-hot-search.p.rapidapi.com"
HEADERS = {"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"], "X-RapidAPI-Host": HOST}

def get(path, **params):
    r = requests.get(f"https://{HOST}{path}", params=params, headers=HEADERS, timeout=30)
    r.raise_for_status()
    body = r.json()
    if not body.get("success"):
        raise RuntimeError(body)
    return body
Enter fullscreen mode Exit fullscreen mode

Every response looks like {"success": true, "data": ...}, so one check is enough.

1. One platform's list

weibo = get("/trends/weibo", limit=10, include_pinned="false")
for item in weibo["data"]["items"][:5]:
    print(item["rank"], item["title"], item["hotValue"], item["label"])
Enter fullscreen mode Exit fullscreen mode

Output (captured 2026-11-01):

1 W盛典红毯 1348949 hot
2 35岁保时捷女销售登顶全国销冠 924205 new
3 今年乌镇峰会首次向社会开放预约 681434 new
4 苏醒发文澄清 655586 new
5 孙颖莎vs王艺迪 655324 new
Enter fullscreen mode Exit fullscreen mode

label is normalized to English (hot, new, pinned), and labelOriginal keeps the Chinese. Weibo pins an official topic at rank 0, and include_pinned=false drops it.

2. Several platforms in one call

multi = get("/trends", platforms="zhihu,douyin,bilibili", limit=3)
for board in multi["data"]:
    print(board["platform"], [i["title"] for i in board["items"]])
Enter fullscreen mode Exit fullscreen mode

Every item has the same fields whatever the platform: platform, rank, title, description, hotValue, label, url, imageUrl. If one platform is temporarily down you still get the others, and failedPlatforms tells you which one failed, so a dashboard doesn't break because one site hiccupped.

3. Is my keyword on a hot list?

A one-line brand monitor: search every current list for a keyword.

hits = get("/search", keyword="苹果")   # "Apple"
for h in hits["data"]:
    print(h["platform"], h["rank"], h["title"])
Enter fullscreen mode Exit fullscreen mode
bilibili 2 供应链视角看苹果折叠屏问题在哪
zhihu 18 自媒体博主称苹果Duo中国版偷工减料,取消了卫星通信、UWB等组件,是真的吗?使用体验会受到影响吗?
zhihu 23 苹果宣布 Apple 智能即将登陆中国,部分功能将接入阿里巴巴千问,有哪些信息值得关注?
Enter fullscreen mode Exit fullscreen mode

Run it on a schedule (cron or GitHub Actions) and notify yourself when the result count goes from 0 to more than 0, and you have a basic "we're trending in China" alert.

4. Cross-platform trends

The same story gets a different headline on every platform, so exact matching finds almost nothing. The /cross-platform endpoint groups titles by similarity (threshold, 0.3 to 1.0) and scores each group by how many platforms carry it and how high it ranks:

cross = get("/cross-platform", min_platforms=3, limit=5)
for t in cross["data"]:
    print(f'{t["topic"]}  ({t["platformCount"]} platforms, score {t["score"]})')
    for a in t["appearances"]:
        print(f'   {a["platform"]:>8} #{a["rank"]:<3} {a["title"]}')
Enter fullscreen mode Exit fullscreen mode

Real output (one group):

BLG零封HLE晋级八强  (3 platforms, score 88.3)
     douyin #40  BLG零封HLE晋级八强
   bilibili #10  韩国解说看BLG零封HLE
      tieba #6   战胜心魔!BLG横扫HLE晋级八强
Enter fullscreen mode Exit fullscreen mode

An esports result (Bilibili Gaming beating HLE at the LoL Worlds) showing up on a video app, a forum and a short-video app at the same time is exactly the kind of topic that breaks out of its niche.

5. Ideas to build on

  • Daily digest: save /cross-platform results to SQLite every 30 minutes and email yourself the topics that stayed on 3+ platforms for more than 2 hours.
  • Translation: titles come back in the original Chinese, so pipe title through any translation API or LLM you like.
  • Category lists: /trends/baidu?tab=movie (also novel, teleplay, car) gives ranked lists of what people search in those categories.

The upstream lists refresh every few minutes and the API caches each one for 5 minutes, so polling more often than that gains nothing.


Disclosure: I'm the author of the API used here, China Trends API on RapidAPI (free plan available). This article was written with AI assistance.

Top comments (0)