ZhihuHelp_archived
ZhihuHelp_archived copied to clipboard
知乎api整理
用于集中记录一下目前发现的知乎v4版api
#根据问题获取问题下答案,每次最多获取20个,sort_by参数为排序依据,include参数用于在基础返回值外添加扩展内容
https://www.zhihu.com/api/v4/questions/21241873/answers?
limit=20&offset=0
&sort_by=default
&include=data[].is_normal,is_sticky,collapsed_by,suggest_edit,comment_count,collapsed_counts,reviewing_comments_count,can_comment,content,editable_content,voteup_count,reshipment_settings,comment_permission,mark_infos,created_time,updated_time,relationship.is_author,voting,is_thanked,is_nothelp,upvoted_followees;data[].author.is_blocking,is_blocked,is_followed,voteup_count,message_thread_token,badge[?(type=best_answerer)].topics
update =>
https://www.zhihu.com/api/v4/questions/51196509/answers?include=data[].is_normal,admin_closed_comment,reward_info,is_collapsed,annotation_action,annotation_detail,collapse_reason,is_sticky,collapsed_by,suggest_edit,comment_count,can_comment,content,editable_content,voteup_count,reshipment_settings,comment_permission,created_time,updated_time,review_info,relevant_info,question.detail,excerpt,relationship.is_authorized,is_author,voting,is_thanked,is_nothelp,is_labeled,is_recognized;data[].mark_infos[].url;data[].author.follower_count,badge[*].topics&limit=5&offset=10&platform=desktop&sort_by=default
将question替换为question.detail后, 即可获得问题描述数据
#根据作者用户名获取答案列表,每次最多获取20个,sort_by参数为排序依据,include参数用于在基础返回值外添加扩展内容
https://www.zhihu.com/api/v4/members/ying-ye-78/answers
?offset=5&limit=15&sort_by=created
&include=data[].is_normal,suggest_edit,comment_count,collapsed_counts,reviewing_comments_count,can_comment,content,voteup_count,reshipment_settings,comment_permission,mark_infos,created_time,updated_time,relationship.voting,is_author,is_thanked,is_nothelp,upvoted_followees;data[].author.badge[?(type=best_answerer)].topics
#根据作者用户名获取用户创建的收藏夹列表,每次最多获取20个,sort_by参数为排序依据,include参数用于在基础返回值外添加扩展内容
https://www.zhihu.com/api/v4/members/ying-ye-78/answers?
offset=5&limit=15&sort_by=created&
include=data[].is_normal,suggest_edit,comment_count,collapsed_counts,reviewing_comments_count,can_comment,content,voteup_count,reshipment_settings,comment_permission,mark_infos,created_time,updated_time,relationship.voting,is_author,is_thanked,is_nothelp,upvoted_followees;data[].author.badge[?(type=best_answerer)].topics
没看懂include参数怎么用,总是返回MalformRequestException... https://www.zhihu.com/api/v4/questions/21241873/answers?include=data[].voteup_count
方括号里差个*,https://www.zhihu.com/api/v4/questions/21241873/answers?include=data[*].voteup_count
像这种地址 https://www.zhihu.com/api/v4/people/89642c262b214ff178c612e2a6da25d0 后面的一串字符 89642c262b214ff178c612e2a6da25d0 是怎么转化为 ying-ye-78/answers 保存在本地呢?
知乎用户信息:
https://www.zhihu.com/api/v4/members/{user-id}
=>
https://www.zhihu.com/api/v4/members/yksin?include=locations,employments,gender,educations,business,voteup_count,thanked_Count,follower_count,following_count,cover_url,following_topic_count,following_question_count,following_favlists_count,following_columns_count,avatar_hue,answer_count,articles_count,pins_count,question_count,columns_count,commercial_question_count,favorite_count,favorited_count,logs_count,included_answers_count,included_articles_count,included_text,message_thread_token,account_status,is_active,is_bind_phone,is_force_renamed,is_bind_sina,is_privacy_protected,sina_weibo_url,sina_weibo_name,show_sina_weibo,is_blocking,is_blocked,is_following,is_followed,is_org_createpin_white_user,mutual_followees_count,vote_to_count,vote_from_count,thank_to_count,thank_from_count,thanked_count,description,hosted_live_count,participated_live_count,allow_message,industry_category,org_name,org_homepage,badge[?(type=best_answerer)].topics
知乎关注者信息:
https://www.zhihu.com/api/v4/members/yksin/followees?limit=10&offset=20
=>
https://www.zhihu.com/api/v4/members/yksin/followees?include=data[*].answer_count,articles_count,gender,follower_count,is_followed,is_following,badge[?(type=best_answerer)].topics&offset=0&limit=20
知乎粉丝信息:
https://www.zhihu.com/api/v4/members/yksin/followers?offset=0&limit=20
=>
https://www.zhihu.com/api/v4/members/yksin/followers?include=data[*].answer_count,articles_count,gender,follower_count,is_followed,is_following,badge[?(type=best_answerer)].topics&offset=0&limit=20
可否把上面的几条帖子格式修正一下,谢谢啦
获取自身信息可以访问:https://www.zhihu.com/api/v4/me
知乎收藏夹 =>
https://api.zhihu.com/collections/32755791
知乎收藏夹内答案摘要列表 =>
https://api.zhihu.com/collections/32755791/answers?limit=5&offset=10
知乎话题 =>
https://www.zhihu.com/api/v4/topics/19555634
知乎话题精华 =>
https://www.zhihu.com/api/v4/topics/19555634/feeds/essence?include=data%5B%3F%28target.type%3Dtopic_sticky_module%29%5D.target.data%5B%3F%28target.type%3Danswer%29%5D.target.content%2Crelationship.is_authorized%2Cis_author%2Cvoting%2Cis_thanked%2Cis_nothelp%3Bdata%5B%3F%28target.type%3Dtopic_sticky_module%29%5D.target.data%5B%3F%28target.type%3Danswer%29%5D.target.is_normal%2Ccomment_count%2Cvoteup_count%2Ccontent%2Crelevant_info%2Cexcerpt.author.badge%5B%3F%28type%3Dbest_answerer%29%5D.topics%3Bdata%5B%3F%28target.type%3Dtopic_sticky_module%29%5D.target.data%5B%3F%28target.type%3Darticle%29%5D.target.content%2Cvoteup_count%2Ccomment_count%2Cvoting%2Cauthor.badge%5B%3F%28type%3Dbest_answerer%29%5D.topics%3Bdata%5B%3F%28target.type%3Dtopic_sticky_module%29%5D.target.data%5B%3F%28target.type%3Dpeople%29%5D.target.answer_count%2Carticles_count%2Cgender%2Cfollower_count%2Cis_followed%2Cis_following%2Cbadge%5B%3F%28type%3Dbest_answerer%29%5D.topics%3Bdata%5B%3F%28target.type%3Danswer%29%5D.target.annotation_detail%2Ccontent%2Chermes_label%2Cis_labeled%2Crelationship.is_authorized%2Cis_author%2Cvoting%2Cis_thanked%2Cis_nothelp%3Bdata%5B%3F%28target.type%3Danswer%29%5D.target.author.badge%5B%3F%28type%3Dbest_answerer%29%5D.topics%3Bdata%5B%3F%28target.type%3Darticle%29%5D.target.annotation_detail%2Ccontent%2Chermes_label%2Cis_labeled%2Cauthor.badge%5B%3F%28type%3Dbest_answerer%29%5D.topics%3Bdata%5B%3F%28target.type%3Dquestion%29%5D.target.annotation_detail%2Ccomment_count%3B&limit=10&offset=10
解码版=>
https://www.zhihu.com/api/v4/topics/19555634/feeds/essence?include=data[?(target.type=topic_sticky_module)].target.data[?(target.type=answer)].target.content,relationship.is_authorized,is_author,voting,is_thanked,is_nothelp;data[?(target.type=topic_sticky_module)].target.data[?(target.type=answer)].target.is_normal,comment_count,voteup_count,content,relevant_info,excerpt.author.badge[?(type=best_answerer)].topics;data[?(target.type=topic_sticky_module)].target.data[?(target.type=article)].target.content,voteup_count,comment_count,voting,author.badge[?(type=best_answerer)].topics;data[?(target.type=topic_sticky_module)].target.data[?(target.type=people)].target.answer_count,articles_count,gender,follower_count,is_followed,is_following,badge[?(type=best_answerer)].topics;data[?(target.type=answer)].target.annotation_detail,content,hermes_label,is_labeled,relationship.is_authorized,is_author,voting,is_thanked,is_nothelp;data[?(target.type=answer)].target.author.badge[?(type=best_answerer)].topics;data[?(target.type=article)].target.annotation_detail,content,hermes_label,is_labeled,author.badge[?(type=best_answerer)].topics;data[?(target.type=question)].target.annotation_detail,comment_count;&limit=10&offset=10
知乎问题详情=>
https://www.zhihu.com/api/v4/questions/20175577?include=data[*].answer_count,follower_count,excerpt,content,detail
data[*]后边对应于问题字段, 需要通过其他途径(例如: 其他接口/前端类名)猜测question数据结构中的字段内容.猜对即可看到对应数据
知乎问题下的答案(带问题详情等信息, 在question后加逗号&key名, 即可获取question下对应项的数据) =>
https://www.zhihu.com/api/v4/questions/32314049/answers?include=data[*].is_normal,admin_closed_comment,reward_info,is_collapsed,annotation_action,annotation_detail,collapse_reason,is_sticky,collapsed_by,suggest_edit,comment_count,can_comment,content,editable_content,voteup_count,reshipment_settings,comment_permission,mark_infos,created_time,updated_time,review_info,question.detail,answer_count,follower_count,excerpt,detail,question_type,title,id,created,updated_time,relevant_info,excerpt,label_info,relationship.is_authorized,is_author,voting,is_thanked,is_nothelp,is_labeled,is_recognized&offset=&limit=3&sort_by=default&platform=desktop
data[*].answer_count,articles_count,gender,follower_count,is_followed,is_following,badge[?(type=best_answerer)].topics
您好: 您的来信已收到,查阅后尽快与您取得联系。
@mazhongbin 什么机器人