Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

知乎api整理 #89

Open
YaoZeyuan opened this issue Jan 13, 2017 · 17 comments
Open

知乎api整理 #89

YaoZeyuan opened this issue Jan 13, 2017 · 17 comments

Comments

@YaoZeyuan
Copy link
Owner

YaoZeyuan commented Jan 13, 2017

用于集中记录一下目前发现的知乎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后, 即可获得问题描述数据

@YaoZeyuan
Copy link
Owner Author

YaoZeyuan commented Jan 13, 2017

#根据作者用户名获取答案列表,每次最多获取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

@YaoZeyuan
Copy link
Owner Author

#根据作者用户名获取用户创建的收藏夹列表,每次最多获取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

@oovm
Copy link

oovm commented Jan 14, 2017

没看懂include参数怎么用,总是返回MalformRequestException...
https://www.zhihu.com/api/v4/questions/21241873/answers?include=data[].voteup_count

@slobber
Copy link

slobber commented Mar 23, 2017

@qinggeouye
Copy link

像这种地址 https://www.zhihu.com/api/v4/people/89642c262b214ff178c612e2a6da25d0
后面的一串字符 89642c262b214ff178c612e2a6da25d0
是怎么转化为 ying-ye-78/answers 保存在本地呢?

@perklet
Copy link

perklet commented Apr 27, 2018

可否把上面的几条帖子格式修正一下,谢谢啦

@perklet
Copy link

perklet commented Apr 27, 2018

获取自身信息可以访问:https://www.zhihu.com/api/v4/me

@YaoZeyuan
Copy link
Owner Author

知乎收藏夹 =>

https://api.zhihu.com/collections/32755791

知乎收藏夹内答案摘要列表 =>

https://api.zhihu.com/collections/32755791/answers?limit=5&offset=10

@YaoZeyuan
Copy link
Owner Author

YaoZeyuan commented Feb 9, 2019

知乎话题 =>

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

@YaoZeyuan
Copy link
Owner Author

知乎问题详情=>

https://www.zhihu.com/api/v4/questions/20175577?include=data[*].answer_count,follower_count,excerpt,content,detail

data[*]后边对应于问题字段, 需要通过其他途径(例如: 其他接口/前端类名)猜测question数据结构中的字段内容.猜对即可看到对应数据

@QGB
Copy link

QGB commented Aug 24, 2022

data[*].answer_count,articles_count,gender,follower_count,is_followed,is_following,badge[?(type=best_answerer)].topics

@mazhongbin
Copy link

mazhongbin commented Aug 24, 2022 via email

@QGB
Copy link

QGB commented Aug 24, 2022

@mazhongbin 什么机器人

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants