搜索用户发布帖子
搜索特定微博用户发布的帖子,使用关键词、可选的日期范围和基于页面的分页。用于从已知账号查找历史帖子以进行话题研究或活动回顾。
参数
| 参数 | 必填 | 类型 | 说明 | 示例 | 可选值 |
|---|---|---|---|---|---|
uid |
必填 | string | 微博用户ID (UID)。 | 2803301701 |
— |
q |
必填 | string | 搜索关键词。 | 咖啡 |
— |
start_day |
可选 | string | 开始日期 (yyyy-MM-dd)。 | 2026-11-17 |
— |
end_day |
可选 | string | 结束日期 (yyyy-MM-dd)。 | 2026-11-23 |
— |
page |
可选 | integer | 页码,从1开始。 | 1 |
— |
代码示例
curl -G "https://api.mofa-ai.com/v1/weibo/search_profile_v1" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'uid=2803301701' \
--data-urlencode 'q=咖啡' \
--data-urlencode 'start_day=2026-11-17' \
--data-urlencode 'end_day=2026-11-23' \
--data-urlencode 'page=1'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/weibo/search_profile_v1",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"uid": "2803301701",
"q": "咖啡",
"start_day": "2026-11-17",
"end_day": "2026-11-23",
"page": "1",
},
timeout=60,
)
body = resp.json()
if body["success"]:
print(body["cost_usd"], body["data"])
else:
print(body["error"], body["message"])
const url = new URL("https://api.mofa-ai.com/v1/weibo/search_profile_v1");
url.search = new URLSearchParams({
uid: "2803301701",
q: "咖啡",
start_day: "2026-11-17",
end_day: "2026-11-23",
page: "1",
});
const resp = await fetch(url, {
headers: { Authorization: `Bearer ${process.env.MOFA_API_KEY}` },
});
const body = await resp.json();
if (body.success) console.log(body.cost_usd, body.data);
else console.error(body.error, body.message);
在线试用
登录后可以在这里直接调用此接口,按价格从余额扣费,失败不收费。新账户赠送 $0.50 试用额度。
响应示例
采集于 2026-11-07,耗时 1338 ms · 请求参数 {"q": "咖啡", "uid": "2803301701", "page": "1", "end_day": "2026-11-06", "start_day": "2026-10-31"}
JSON
{
"success": true,
"code": 0,
"message": "success",
"request_id": "req_5f1c2a9be04d7c3a81f6e2d0",
"endpoint": "weibo.search_profile_v1",
"cost_usd": 0.02,
"data": {
"code": 0,
"data": {
"ok": 1,
"data": {
"list": [],
"total": 0
}
},
"message": null,
"requestId": "ad96a6d804994a84a06e1f29d9468cba",
"recordTime": "2026-11-08T07:58:01.215812856",
"requestParams": {
"body": null,
"query": {
"q": "咖啡",
"uid": "2803301701",
"page": "1",
"endDay": "2026-11-06",
"startDay": "2026-10-31"
}
}
}
}