Keyword Search
Search Zhihu by keyword with optional result-type, sort, time-interval, topic-display, and offset controls. Use it to find relevant answers, articles, or videos.
Parameters
| Name | Required | Type | Description | Example | Allowed values |
|---|---|---|---|---|---|
keyword |
Required | string | Search keywords. | 咖啡 |
— |
offset |
Optional | integer | Start offset, begins with 0. | 0 |
— |
show_all_topics |
Optional | string | Whether to show all topics. Available Values: - `FALSE`: Do not show topics. - `TRUE`: Show all topics. | FALSE |
FALSETRUE |
vertical |
Optional | string | Result type filter. Available Values: - `answer`: Answers only. - `article`: Articles only. - `zvideo`: Videos only. | answer |
answerarticlezvideo |
sort |
Optional | string | Sorting criteria. Available Values: - `upvoted_count`: Most upvoted. - `created_time`: Latest published. | upvoted_count |
upvoted_countcreated_time |
time_interval |
Optional | string | Publish time interval filter. Available Values: - `a_day`: Within one day. - `a_week`: Within one week. - `a_month`: Within one month. - `three_months`: Within three months. - `half_a_year`: Within half a year. - `a_year`: Within one year. | a_day |
a_daya_weeka_monththree_monthshalf_a_yeara_year |
Code samples
curl -G "https://api.mofa-ai.com/v1/zhihu/search_v1" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'keyword=咖啡' \
--data-urlencode 'offset=0' \
--data-urlencode 'show_all_topics=FALSE' \
--data-urlencode 'vertical=answer' \
--data-urlencode 'sort=upvoted_count' \
--data-urlencode 'time_interval=a_day'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/zhihu/search_v1",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"keyword": "咖啡",
"offset": "0",
"show_all_topics": "FALSE",
"vertical": "answer",
"sort": "upvoted_count",
"time_interval": "a_day",
},
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/zhihu/search_v1");
url.search = new URLSearchParams({
keyword: "咖啡",
offset: "0",
show_all_topics: "FALSE",
vertical: "answer",
sort: "upvoted_count",
time_interval: "a_day",
});
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.