Before you start
- Get an API keySign up for 100 free credits, no card. Keys start with
gs_live_. - Put it in the environmentEvery example reads it from
GROUNDSOCIAL_API_KEY:export GROUNDSOCIAL_API_KEY=gs_live_… - Set up Python
pip install requests
Call Weibo user posts API from Python
GET /v1/weibo/user/posts. Save this as main.py and run python main.py. It reads the items in data and prints text and user.followers_count for each.
import os
import requests
API = "https://api.groundsocial.dev"
HEADERS = {"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"}
res = requests.get(
f"{API}/v1/weibo/user/posts",
params={"id": "1669879400"},
headers=HEADERS,
timeout=60,
)
res.raise_for_status()
data = res.json()
for item in data["data"]:
print(item.get("text"), (item.get("user") or {}).get("followers_count"))
print("credits charged:", res.headers["x-credits-charged"])The response
A real Weibo response to this call, recorded from the live source and shortened for display: arrays keep their first items and … marks every cut. The recorded page had 8 items in data. Live calls return current data in the same shape.
{
"data": [
{
"id": "5368869603512186",
"mid": "5368869603512186",
"bid": "RsTC0eJGa",
"created_at": "Tue Nov 24 20:02:05 +0800 2026",
"text": "欢迎收看我的街角碎片🧩 ",
"reposts_count": 305277,
"comments_count": 208452,
"attitudes_count": 990719,
"user": {
"id": 1669879400,
"screen_name": "Dear-迪丽热巴",
"followers_count": "8258.2万",
"verified": true
},
"source": "",
"region_name": "发布于 上海",
"pic_num": 9,
"isLongText": false,
"url": "https://m.weibo.cn/detail/5368869603512186"
},
{
"id": "5363838444901644",
"mid": "5363838444901644",
"bid": "RqMJekz8M",
"created_at": "Tue Nov 10 22:50:03 +0800 2026",
"text": "把敬意送给云端的守护者!<a href=\"https://m.weibo.cn/search?containerid=231522type%3D1%26t%3D10%26q%3D%231111%E6%98%AF%E4%BA%BA%E6%B…",
"reposts_count": 30424,
"comments_count": 1000000,
"attitudes_count": 408606,
"user": {
"id": 1669879400,
"screen_name": "Dear-迪丽热巴",
"followers_count": "8258.2万",
"verified": true
},
"source": "",
"region_name": "发布于 上海",
"pic_num": 0,
"isLongText": false,
"url": "https://m.weibo.cn/detail/5363838444901644"
},
"… 6 more"
],
"meta": {
"result_count": 8,
"total": 1943,
"next_token": "2"
}
}Top-level fields
| Field | Type | Description |
|---|---|---|
data | WeiboPost[] | – |
meta | object | – |
Parameters
| Name | In | Type | Description |
|---|---|---|---|
handle | query | string | Screen name (昵称), matched exactly. |
id | query | string | Numeric user id (uid). Example: 1669879400. |
url | query | string | Or the profile URL. |
media_only | query | "true" | "false" | One of true, false. |
limit | query | integer | Posts per page, 1 to 50. Defaults to 20. |
after | query | string | The previous page’s meta.next_token. |
since | query | string | Only rows published on or after this date: YYYY-MM-DD (midnight UTC) or an ISO 8601 timestamp. Example: 2026-01-01. |
until | query | string | Only rows published on or before this date: YYYY-MM-DD (that whole UTC day) or an ISO 8601 timestamp. Example: 2026-12-31. |
Pagination
Pass after for the next page: The previous page’s meta.next_token. Every page is a separate call at 2 credits per call.
Errors and retries
Every error is JSON with error.code (stable: branch on it), message, hint (what to do next), docs_url and retryable. A failed call is never charged. Retry only when retryable is true, after the Retry-After header.
import os, time
import requests
def call(url, **kwargs):
headers = {"Authorization": f"Bearer {os.environ['GROUNDSOCIAL_API_KEY']}"}
for attempt in range(3):
res = requests.get(url, headers=headers, timeout=60, **kwargs)
if res.ok:
return res.json()
err = res.json()["error"]
# Branch on the stable code; the hint says what to do next.
if err["retryable"] and attempt < 2:
time.sleep(int(res.headers.get("Retry-After", 2)))
continue
raise RuntimeError(f"{err['code']}: {err.get('hint', err['message'])}")
data = call("https://api.groundsocial.dev/v1/weibo/user/posts", params={"id": "1669879400"})| Status | Meaning |
|---|---|
200 | A page of posts. |
400 | Invalid input. Nothing was charged. |
401 | Missing or invalid API key. |
402 | Not enough credits, a spend cap was reached, or payment is required. |
403 | The target is private, or the account is suspended. |
404 | The user, post or comment does not exist or has nothing public. |
429 | Too many requests. Wait for Retry-After seconds. |
503 | Weibo is temporarily unavailable. Retryable; nothing was charged. |
Every error code and what to do about it.
Pricing
| Cost | |
|---|---|
| Per call | 2 credits per call |
| 1,000 calls | $2.00 on the starter pack, $0.80 at volume |
| No key (MPP or x402) | $0.02 per call |
| Failed call | Refunded, never charged |
Every response has x-credits-charged and x-credits-remaining headers. Credits never expire. Packs and calculator.
From an AI agent (MCP)
The same call is the weibo_user_posts tool on the hosted MCP server, so Claude, Cursor or any MCP client can make it without code. Add the server once:
claude mcp add --transport http groundsocial https://api.groundsocial.dev/mcpThen ask for it in words (“A Weibo account’s posts, newest first, paginated”), or call the tool directly:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "weibo_user_posts",
"arguments": {
"id": "1669879400"
}
}
}MCP setup for Claude Desktop, Cursor, VS Code and ChatGPT.
Archive an account
Follow meta.next_token; since stops the walk.
Questions
Only posts with media?
Pass media_only=true.
Keep going
- This call in JavaScript, TypeScript, Go, PHP, cURL.
- Weibo user posts API reference: every field and status code.
- Weibo tutorials and all Python tutorials.
- Weibo API: every endpoint and price.
- How to scrape Weibo hot search with Python: Weibo’s real-time hot search list.
- How to scrape Weibo profile with Python: A Weibo profile: bio, followers, following, post counts, verification.
- How to scrape Weibo post with Python: One Weibo post with its counts, pictures and video.
- How to scrape Weibo comments with Python: Comments on a Weibo post, hot or latest first.
- How to scrape Weibo comment replies with Python: Replies to a Weibo comment.
- How to scrape Weibo search with Python: Search Weibo posts: all, latest, hot, original, verified, videos or images.
Run it on your own data
One key for Weibo and 76 more platforms, over REST or MCP. Free credits on signup, no card.
Weibo is a trademark of Weibo Corporation. We are not affiliated with or endorsed by Weibo Corporation.