Skip to content

知乎 API - 回答列表 (V1)

prod-global
GET
/api/zhihu/get-answer-list/v1

根据知乎问题ID获取该问题下的回答列表。

典型应用场景:

  • 分析用户观点,提取高质量回答。
  • 研究社区参与度和话题讨论情况。

请求参数

参数名位置类型必填说明
tokenquerystringTOKEN
questionIdquerystring问题 ID
cursorquerystring上一结果的翻页游标。
offsetqueryinteger起始偏移量,从0开始。
orderquerystring答案的排序标准。

可用值:
- _default:默认排序。
- _updated:按更新时间排序。
sessionIdquerystring先前结果中的会话 ID。

代码示例

💡 环境说明

默认示例使用 https://api.justoneapi.com (prod-global)。中国大陆地区建议替换为 http://47.117.133.51:30015 (prod-cn) 以获得更好的访问体验。详见 环境选择

bash
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
curl -X GET "https://api.justoneapi.com/api/zhihu/get-answer-list/v1?token=YOUR_API_KEY&questionId=VALUE"
text
我想使用 Just One API 提供的“回答列表 (V1)”接口。
接口地址: https://api.justoneapi.com/api/zhihu/get-answer-list/v1
HTTP 方法: GET
身份验证: 在 URL 后添加查询参数“?token=您的API密钥”。
OpenAPI 定义: https://docs.justoneapi.com/openapi/zhihu-apis/answer-list-v1-zh.json

请求参数说明:
- token (query): TOKEN (必填)
- questionId (query): 问题 ID (必填)
- cursor (query): 上一结果的翻页游标。
- offset (query): 起始偏移量,从0开始。
- order (query): 答案的排序标准。

可用值:
- `_default`:默认排序。
- `_updated`:按更新时间排序。
- sessionId (query): 先前结果中的会话 ID。

返回格式: JSON

响应处理与错误码:
1. 需通过返回体中的 "code" 字段判断业务结果(code 为 0 表示成功)。
2. 超时建议:建议将请求超时时间设置为至少 60 秒。
3. 业务码说明:
   - 0: 成功
   - 100: Token 无效或已失效
   - 301: 采集失败,请重试
   - 302: 超出速率限制
   - 303: 超出每日配额
   - 400: 参数错误
   - 500: 内部服务器错误
   - 600: 权限不足
   - 601: 余额不足

请帮我用我擅长的编程语言写一个脚本来调用这个接口,并处理返回结果。
python
# 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import requests

url = "https://api.justoneapi.com/api/zhihu/get-answer-list/v1?token=YOUR_API_KEY&questionId=VALUE"
response = requests.get(url)
print(response.json())
js
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
const response = await fetch("https://api.justoneapi.com/api/zhihu/get-answer-list/v1?token=YOUR_API_KEY&questionId=VALUE", {
  method: "GET"
});
const data = await response.json();
console.log(data);
java
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newHttpClient();
        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.justoneapi.com/api/zhihu/get-answer-list/v1?token=YOUR_API_KEY&questionId=VALUE"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.body());
    }
}
go
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	client := &http.Client{}
	url := "https://api.justoneapi.com/api/zhihu/get-answer-list/v1?token=YOUR_API_KEY&questionId=VALUE"
	req, _ := http.NewRequest("GET", url, nil)
	resp, _ := client.Do(req)
	defer resp.Body.Close()
	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
php
// 提示: 中国大陆地区建议将 https://api.justoneapi.com 替换为 http://47.117.133.51:30015
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.justoneapi.com/api/zhihu/get-answer-list/v1?token=YOUR_API_KEY&questionId=VALUE");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
$response = curl_exec($ch);
curl_close($ch);
echo $response;

响应结果

json
{
  "code": 0,
  "data": {
    "data": [
      {
        "type": "question_feed_card",
        "target_type": "answer",
        "target": {
          "admin_closed_comment": false,
          "allow_segment_interaction": 1,
          "annotation_action": null,
          "answer_type": "normal",
          "attached_info": "ogETCAQQAxiXytHkle2V8Bsg+emDEpICLgoJNzcwMjQxNDAxEhMyMDA4NzAxNTQzODQzNjUyODg3GAQiCklNQUdFX1RFWFQ=",
          "author": {
            "avatar_url": "https://pica.zhimg.com/v2-2cbd425e6d8f176296de7dd480b74b56_l.jpg?source=1def8aca",
            "avatar_url_template": "https://picx.zhimg.com/v2-2cbd425e6d8f176296de7dd480b74b56.jpg?source=1def8aca",
            "badge": [],
            "badge_v2": {
              "detail_badges": [],
              "icon": "",
              "merged_badges": [],
              "night_icon": "",
              "title": ""
            },
            "exposed_medal": {
              "avatar_url": "",
              "description": "",
              "medal_id": "0",
              "medal_name": ""
            },
            "follower_count": 52,
            "gender": 1,
            "headline": "",
            "id": "42f8a05a565b1c254c006546d5b8a2b0",
            "is_advertiser": false,
            "is_followed": false,
            "is_following": false,
            "is_org": false,
            "is_privacy": false,
            "name": "余十三",
            "type": "people",
            "url": "https://www.zhihu.com/api/v4/people/42f8a05a565b1c254c006546d5b8a2b0",
            "url_token": "not-online-70-29",
            "user_type": "people"
          },
          "business_type": "normal",
          "can_comment": {
            "reason": "",
            "status": true
          },
          "collapse_reason": "",
          "collapsed_by": "nobody",
          "comment_count": 0,
          "comment_permission": "all",
          "content": "<p data-pid=\"yHt11Jy7\">自己做的壁纸</p><figure data-size=\"normal\"><noscript><img src=\"https://picx.zhimg.c...",
          "content_mark": {},
          "content_need_truncated": false,
          "created_time": 1771691767,
          "decorative_labels": [],
          "editable_content": "",
          "excerpt": "自己做的壁纸 [图片] 效果 [图片]",
          "extras": "",
          "favlists_count": 0,
          "force_login_when_click_read_more": false,
          "has_publishing_draft": false,
          "id": "2008701543843652887",
          "is_collapsed": false,
          "is_contain_ai_content": false,
          "is_copyable": true,
          "is_jump_native": false,
          "is_mine": false,
          "is_navigator": false,
          "is_normal": true,
          "is_sticky": false,
          "is_visible": true,
          "matrix_tips": "0 赞同",
          "navigator_vote": false,
          "question": {
            "created": 1448289701,
            "id": "37811449",
            "question_type": "normal",
            "relationship": null,
            "title": "有哪些优雅的 Windows 10 壁纸?",
            "type": "question",
            "updated_time": 1521972248,
            "url": "https://www.zhihu.com/api/v4/questions/37811449"
          },
          "reaction": {
            "relation": {
              "faved": false,
              "liked": false
            },
            "statistics": {
              "down_vote_count": 0,
              "favorites": 0,
              "like_count": 0
            }
          },
          "reaction_instruction": {},
          "relationship": {
            "is_author": false,
            "is_authorized": false,
            "is_favorited": false,
            "is_nothelp": false,
            "is_thanked": false,
            "upvoted_followees": [],
            "voting": 0
          },
          "relevant_info": {
            "is_relevant": false,
            "relevant_text": "",
            "relevant_type": ""
          },
          "reshipment_settings": "allowed",
          "reward_info": {
            "can_open_reward": false,
            "is_rewardable": false,
            "reward_member_count": 0,
            "reward_total_money": 0,
            "tagline": ""
          },
          "settings": {
            "table_of_contents": {
              "enabled": false
            }
          },
          "sticky_info": "",
          "suggest_edit": {
            "reason": "",
            "status": false,
            "tip": "",
            "title": "",
            "unnormal_details": {
              "description": "",
              "note": "",
              "reason": "",
              "reason_id": 0,
              "status": ""
            },
            "url": ""
          },
          "thanks_count": 0,
          "thumbnail_info": {
            "count": 2,
            "thumbnails": [
              {
                "height": 1080,
                "token": "v2-0466d67e78ee71f7be3e0f89f3f181c9",
                "type": "image",
                "url": "https://picx.zhimg.com/80/v2-0466d67e78ee71f7be3e0f89f3f181c9_720w.jpg?source=1def8aca",
                "width": 1920
              }
            ],
            "type": "thumbnail_info"
          },
          "type": "answer",
          "updated_time": 1771691767,
          "url": "https://www.zhihu.com/api/v4/answers/2008701543843652887",
          "visible_only_to_author": false,
          "vote_next_step": "vote",
          "voteup_count": 0
        },
        "skip_count": false,
        "position": 0,
        "cursor": "abe7fc41e6e496d998ecbcf3ff1f3b85",
        "is_jump_native": false
      }
    ],
    "finished_reading_filtered_count": 0,
    "ad_info": {
      "ad": {
        "ad_verb": "",
        "brand": {
          "id": 0,
          "logo": "https://pic3.zhimg.com/v2-6bcab51aab5519d3e668f35b0a210fc3_xl.jpg?source=d6434cab",
          "name": "ima"
        },
        "category": 1,
        "click_tracks": [
          "https://sugar.zhihu.com/plutus_adreaper?ri=e0f2764e-dbf1-4920-b312-7b65d498274e&rui=e0f2764e-dbf1-49..."
        ],
        "close_track": "https://sugar.zhihu.com/plutus_adreaper?nt=0&ft=2&ar=0.003579080570489168&qetl=0&t=7&pdi=17447741095...",
        "close_tracks": [
          "https://sugar.zhihu.com/plutus_adreaper?nt=0&ft=2&ar=0.003579080570489168&qetl=0&t=7&pdi=17447741095..."
        ],
        "conversion_tracks": [
          "https://sugar.zhihu.com/plutus_adreaper?ft=2&pf=4&bn=0&ar=0.003579080570489168&ed=CjEEfx4wM30oF2VTA2..."
        ],
        "creatives": [
          {
            "app_promotion_url": "",
            "brand": {
              "id": 0,
              "logo": "https://pic3.zhimg.com/v2-6bcab51aab5519d3e668f35b0a210fc3_xl.jpg?source=d6434cab",
              "name": "ima"
            },
            "cta": {
              "value": "查看详情"
            },
            "description": "文档处理太麻烦?智能辅助腾讯ima来帮你",
            "footer": {
              "value": ""
            },
            "image": "",
            "landing_url": "https://ima.qq.com/download/?webFrom=10000435&channel=10000435&cb=https%3A%2F%2Fsugar.zhihu.com%2Fpl...",
            "title": "微信文件秒存腾讯ima知识库,以后工作文件再也不怕丢了",
            "video_watch_num": 116069
          }
        ],
        "debug_tracks": [
          "https://sugar.zhihu.com/plutus_adreaper?ar=0.003579080570489168&bn=0&s=c93e736f-b26c-4f83-bb7a-e89dc..."
        ],
        "display_advertising_tag": true,
        "download_silent": false,
        "experiment_info": "{}",
        "id": 3665260,
        "impression_tracks": [
          "https://sugar.zhihu.com/plutus_adreaper?nt=0&pty=50&idi=100010062&t=2&bn=0&s=c93e736f-b26c-4f83-bb7a..."
        ],
        "is_new_webview": true,
        "is_speeding": false,
        "name": "",
        "native_prefetch": true,
        "party_id": -2,
        "revert_close_track": "https://sugar.zhihu.com/plutus_adreaper?qpt=0&di=tower&qetl=0&pf=4&idi=100010062&ed=CjEEch4wM30oF2VT...",
        "template": "web_word",
        "view_track": "https://sugar.zhihu.com/plutus_adreaper?qetl=0&ar=0.003579080570489168&ed=CjEEeR4wM30oF2VTA2J8BUZ2W3...",
        "view_tracks": [
          "https://sugar.zhihu.com/plutus_adreaper?qetl=0&ar=0.003579080570489168&ed=CjEEeR4wM30oF2VTA2J8BUZ2W3..."
        ],
        "za_ad_info": "COza3wEQ7AEiATFdpV3TTmDZgd0B",
        "za_ad_info_json": "{\"ad_id\":3665260,\"ad_zone_id\":236,\"category\":\"1\",\"timestamp\":1773064800,\"creative_id\":3621081}"
      },
      "adjson": "{\"ads\":[{\"id\":3665260,\"ad_zone_id\":236,\"template\":\"web_word\",\"impression_tracks\":[\"https://sugar.zhi...",
      "position": 3
    },
    "session": {
      "id": "1773064804697666854"
    },
    "paging": {
      "page": 1,
      "is_end": false,
      "next": "https://www.zhihu.com/api/v4/questions/37811449/feeds?cursor=abe7fc41e6e496d9c018e7f8ff1f3b85&includ...",
      "need_force_login": false
    }
  }
}

💡 提示:为简化展示,列表类数据样例仅保留 1-2 条记录,实际返回条数以接口响应为准。