Keyword Search
Searches Weibo posts by keyword within a required day-and-hour time range, with page-based pagination, hot or time sorting, and filters for pictures, video, music, or links. Use it to find time-bounded posts for topic research or monitoring.
Parameters
| Name | Required | Type | Description | Example | Allowed values |
|---|---|---|---|---|---|
q |
Required | string | Search Keywords. | 咖啡 |
— |
start_day |
Required | string | Start Day (yyyy-MM-dd). | 2026-11-17 |
— |
start_hour |
Required | integer | Start Hour (0-23). | 0 |
— |
end_day |
Required | string | End Day (yyyy-MM-dd). | 2026-11-23 |
— |
end_hour |
Required | integer | End Hour (0-23). | 23 |
— |
hot_sort |
Optional | boolean | Hot sort, true for hot sort, false for time sort. Default is false. | False |
— |
contains |
Optional | string | Contains filter for the result set. Available Values: - `ALL`: All - `PICTURE`: Has Picture - `VIDEO`: Has Video - `MUSIC`: Has Music - `LINK`: Has Link | ALL |
ALLPICTUREVIDEOMUSICLINK |
page |
Optional | integer | Page number, starting with 1. | 1 |
— |
Code samples
curl -G "https://api.mofa-ai.com/v1/weibo/search_all_v2" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'q=咖啡' \
--data-urlencode 'start_day=2026-11-17' \
--data-urlencode 'start_hour=0' \
--data-urlencode 'end_day=2026-11-23' \
--data-urlencode 'end_hour=23' \
--data-urlencode 'hot_sort=False' \
--data-urlencode 'contains=ALL' \
--data-urlencode 'page=1'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/weibo/search_all_v2",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"q": "咖啡",
"start_day": "2026-11-17",
"start_hour": "0",
"end_day": "2026-11-23",
"end_hour": "23",
"hot_sort": "False",
"contains": "ALL",
"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_all_v2");
url.search = new URLSearchParams({
q: "咖啡",
start_day: "2026-11-17",
start_hour: "0",
end_day: "2026-11-23",
end_hour: "23",
hot_sort: "False",
contains: "ALL",
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);
Try it
Sign in to call this endpoint from this page. Successful calls are billed to your balance, failed calls are free, and new accounts get $0.50 of trial credit.
Example response
There is no example response for this endpoint yet.