Answers
How can I search Weibo posts by keyword without a login cookie?
Short answer
Use Weibo post search (/v1/weibo/posts/search) with an API key and no Weibo login: send a keyword, get posts with text, author, reposts, comments and likes. Each page of about 10 posts costs $0.002, and 1,000 posts take 100 calls, $0.20 in total.
Most open-source Weibo crawlers start the same way: log in to Weibo in a browser, copy the cookie, paste it into a config file. The cookie expires after a while, the job fails at 3 am, and an account that searches hard enough can get restricted. If all you need is posts that match a keyword, you can skip the account entirely. okdata takes an API key, runs the search on public Weibo data and returns clean JSON.
The endpoint
Weibo post search has two parameters that matter:
query: the keywords, typed as you would type them into Weibo's search box. Chinese works as is.sort:hot(the default) for posts with the most engagement, orlatestfor newest first.
Each post comes back with text, published_at, url, the author's ID, name, follower count and verification, metrics.likes, metrics.comments, metrics.reposts, images and hashtags. Video posts also carry a play count in metrics.views where Weibo shows one.
Price
| You want | Calls | Cost |
|---|---|---|
| One page | 1 | $0.002 |
| 200 posts | 20 | $0.04 |
| 1,000 posts | 100 | $0.20 |
Errors are not charged: a bad parameter, a busy upstream or a timeout all cost nothing.
curl
curl -s -G "https://api.okdata.online/v1/weibo/posts/search" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode "query=新能源 车展" \
-d sort=latest \
-d fields=id,text,published_at,author.name,metrics
# next page: pass page.next_cursor back
curl -s -G "https://api.okdata.online/v1/weibo/posts/search" \
-H "Authorization: Bearer $OKDATA_API_KEY" \
--data-urlencode "query=新能源 车展" -d sort=latest \
--data-urlencode "cursor=<page.next_cursor>"
If you get rate_limited, wait the number of seconds in the Retry-After header and send the same request again. The full list of error codes and which ones to retry is on errors.
What you give up without a login
- Comments, a user's own timeline and single-post lookups are not in the catalog. Search, the hot search board and account profiles are.
- Long posts can be cut short in search results. Ask for
view=fulland checkext.is_long_text; the full text is on the post's page. - Search shows what Weibo's search shows. Posts hidden from search will not appear here either.
- Fields Weibo does not expose, such as shares and favorites, are null and listed in
meta.unavailable.
When a cookie or the official route is better
- If you need comment threads or a full account timeline, a cookie-based crawler such as weibo-crawler or MediaCrawler gets them. Use a spare account and a slow pace.
- Weibo's open platform offers keyword search to verified developers on a plan. Choose it when your company needs a contract with Weibo itself.
- For a dozen posts, the Weibo app is free.
To run the same search from Claude or another agent, connect the MCP server.
Updated