回答列表
获取知乎问题的回答,具有排序和分页控制功能。用于浏览已知问题的回答,并继续查看更多的回答页面。
参数
| 参数 | 必填 | 类型 | 说明 | 示例 | 可选值 |
|---|---|---|---|---|---|
question_id |
必填 | string | 问题 ID | 19550225 |
— |
cursor |
可选 | string | 上一结果的翻页游标。 | — | — |
offset |
可选 | integer | 起始偏移量,从0开始。 | 0 |
— |
order |
可选 | string | 答案的排序标准。 可用值: - `_default`:默认排序。 - `_updated`:按更新时间排序。 | _updated |
_default_updated |
session_id |
可选 | string | 先前结果中的会话 ID。 | — | — |
代码示例
curl -G "https://api.mofa-ai.com/v1/zhihu/get_answer_list_v1" \
-H "Authorization: Bearer $MOFA_API_KEY" \
--data-urlencode 'question_id=19550225' \
--data-urlencode 'offset=0' \
--data-urlencode 'order=_updated'
import os
import requests
resp = requests.get(
"https://api.mofa-ai.com/v1/zhihu/get_answer_list_v1",
headers={"Authorization": f"Bearer {os.environ['MOFA_API_KEY']}"},
params={
"question_id": "19550225",
"offset": "0",
"order": "_updated",
},
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/get_answer_list_v1");
url.search = new URLSearchParams({
question_id: "19550225",
offset: "0",
order: "_updated",
});
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 试用额度。
响应示例
这个接口暂无响应示例。