Answers
How do I get alerted when my brand or a keyword hits Weibo hot search?
Short answer
Poll Weibo hot search every 10 minutes and match each topic against your brand names; 144 checks a day cost $0.288. When a topic matches, run one Weibo post search on it ($0.002 a page) so the alert arrives with the posts driving it, not just the headline.
The classic PR failure goes like this: a complaint about a drink brand reaches Weibo hot search at 11 pm, and the team learns about it from a journalist at 9 the next morning. A small job that checks the board every 10 minutes closes most of that gap. When the brand, a product or the CEO's name shows up, someone gets a message with the rank, the heat and the five loudest posts on the topic.
Two endpoints
- Weibo hot search returns the whole board in one call: rank, topic, heat and a search link.
- Weibo post search is called only when a topic matches. Sorted by hot, its first page of about 10 posts shows who is driving the topic and how many reposts they have.
What it costs
| Setup | Calls | Cost |
|---|---|---|
| Board every 10 minutes, one day | 144 | $0.288 |
| Board every 10 minutes, 30 days | 4,320 | $8.64 |
| 30 days plus 10 matches, 2 search pages each | 4,320 + 20 | {{cost:weibo.trends.list4320+weibo.posts.search20}} |
The alert job
import json, os, requests
API = "https://api.okdata.online"
H = {"Authorization": f"Bearer {os.environ['OKDATA_API_KEY']}"}
WATCH = ["山野咖啡", "椰云拿铁", "shanye"] # brand, products, nicknames
SEEN = "alerted.json"
def call(path, **params):
r = requests.get(API + path, headers=H, params=params, timeout=30).json()
if r["code"] != "ok":
raise RuntimeError(f"{r['code']}: {r['message']}")
return r["data"]["items"]
seen = set(json.load(open(SEEN))) if os.path.exists(SEEN) else set()
for row in call("/v1/weibo/trends/list"):
hit = any(w.lower() in row["name"].lower() for w in WATCH)
if not hit or row["name"] in seen:
continue
posts = call("/v1/weibo/posts/search", query=row["name"], sort="hot",
fields="text,author.name,metrics.reposts")
print(f"#{row['rank']} {row['name']} heat={row['heat']}")
for p in posts[:5]:
print(" ", p["author"]["name"], p["metrics"]["reposts"], p["text"][:80])
seen.add(row["name"])
json.dump(sorted(seen), open(SEEN, "w"), ensure_ascii=False)
Swap the print lines for a post to your Slack, Feishu or WeCom webhook, and schedule the script every 10 minutes.
Where this falls short
- A topic about you can trend without your name in it, for example a store incident described by place and product. Keep the watch list broad, and run keyword monitoring on posts as well; hot search is only the loudest layer.
- At a 10-minute rate you can be up to 10 minutes late. Five minutes doubles the cost and rarely changes the outcome.
- Comments under the posts are not in the catalog. The alert tells you what is trending and who started it, and the comment threads are still read on Weibo.
- The board has no history. If the job was down, it cannot tell you what you missed.
Other routes
Social listening platforms offer the same alerting with sentiment charts and a support team, and suit a company that wants a dashboard and no code. On launch days, a person keeping the hot search page open is still the fastest reader there is. For a fuller playbook see word of mouth.
Updated