Fetching Information

This section lists APIs that fetches information with GET, all calls are not visible to other Zhihu users (excluding 知乎管理员). Assuming you have created an instance:

from zhihuAPI.account import ZhihuAccount
machine = ZhihuAccount('path/to/cookie.json')

All code examples uses get_all_pages_json, it can be replaced with save_all_pages_json.

Account

My Information (账号信息)

machine.get_all_pages_json('Me','Info','')

Preview of Messages (私信预览)

machine.get_all_pages_json('Me','Messages', '')

Notifications (通知)

machine.get_all_pages_json('Me','Notifications', '')

Members

User Information (用户信息)

machine.get_all_pages_json('Members','Info', user_url_token)

Followees (关注的人)

machine.get_all_pages_json('Members','Followees', user_url_token)

Followers (关注者)

machine.get_all_pages_json('Members','Followers', user_url_token)

Following Questions (关注的问题)

machine.get_all_pages_json('Members','FollowingQuestions', user_url_token)

Following Topics (关注的话题)

machine.get_all_pages_json('Members','FollowingTopics', user_url_token)

Following Columns (关注的专栏)

machine.get_all_pages_json('Members','FollowingColumns', user_url_token)

Following Favorite Lists (关注的收藏夹)

machine.get_all_pages_json('Members','FollowingFavlists', user_url_token)

Questions (提问)

machine.get_all_pages_json('Members','Questions', user_url_token)

Answers (回答)

machine.get_all_pages_json('Members','Answers', user_url_token)

Pins (想法)

machine.get_all_pages_json('Members','Pins', user_url_token)

Articles (文章)

machine.get_all_pages_json('Members','Articles', user_url_token)

Columns (专栏)

machine.get_all_pages_json('Members','Columns', user_url_token)

Favorite Lists (收藏)

machine.get_all_pages_json('Members','Favlists', user_url_token)

Activities (动态)

machine.get_all_pages_json('Members','Activities', user_url_token)

Questions

Question Information (问题信息)

machine.get_all_pages_json('Questions','Info', question_id)

Question Followers (问题关注者)

machine.get_all_pages_json('Questions','Followers', question_id)

Question Comments (问题评论)

machine.get_all_pages_json('Questions','Comments', question_id)

Question Invitees (被邀请的人)

machine.get_all_pages_json('Questions','Invitees', question_id)

Question Invitation Candidates (可能被邀请的人)

machine.get_all_pages_json('Questions','InvitationCandidates', question_id)

Similar Questions (相关问题)

machine.get_all_pages_json('Questions','SimilarQuestions', question_id)

Answers

Answer Information (回答信息)

machine.get_all_pages_json('Answers','Info', answer_id)

Answer Upvoters (回答点赞者)

machine.get_all_pages_json('Answers','Upvoters', answer_id)

Answer Comments (回答评论)

machine.get_all_pages_json('Answers','Comments', answer_id)

Comments

Comment Information (评论信息)

machine.get_all_pages_json('Comments','Info', comment_id)

Comments With Conversation (包含某评论的对话)

machine.get_all_pages_json('Comments','CommentsWithConversation', comment_id)

Pins

Pin Information (想法信息)

machine.get_all_pages_json('Pins','Info', pin_id)

Pin Comments (想法评论)

machine.get_all_pages_json('Pins','Comments', pin_id)

Favorite Lists

Favorite Lists Information (收藏夹信息)

machine.get_all_pages_json('Favlists','Info', favlist_id)

Favorite Lists Contents (收藏夹内容)

Warning

This API exists but may not function due to bugs in Zhihu.

machine.get_all_pages_json('Favlists','Items', favlist_id)

Favorite Lists Comments (收藏夹评论)

machine.get_all_pages_json('Favlists','Comments', favlist_id)

Favorite Lists Followers (收藏夹关注者)

Warning

This API exists but does not function due to bugs in Zhihu.

machine.get_all_pages_json('Favlists','Followers', favlist_id)

Topics

Topic Information (话题信息)

machine.get_all_pages_json('Topics','Info', topic_id)

Topic Followers (话题关注者)

machine.get_all_pages_json('Topics','Followers', topic_id)

Topic Essence (话题精华)

machine.get_all_pages_json('Topics','Essence', topic_id)

Topic Top Questions (话题精华问题)

machine.get_all_pages_json('Topics','TopQuestions', topic_id)

Topic Timeline Questions (话题最新问题)

machine.get_all_pages_json('Topics','TimelineQuestions', topic_id)

Topic Best Answerers (话题优秀答主)

machine.get_all_pages_json('Topics','BestAnswerers', topic_id)

Topic Top Activities (话题精华动态)

machine.get_all_pages_json('Topics','TopActivities', topic_id)

Topic Timeline Activities (话题最新动态)

machine.get_all_pages_json('Topics','TimelineActivities', topic_id)

Articles

Article Information (文章信息)

machine.get_all_pages_json('Articles','Info', article_id)

Article Upvoters (文章点赞者)

machine.get_all_pages_json('Articles','Upvoters', article_id)

Article Comments (文章评论)

machine.get_all_pages_json('Articles','Comments', article_id)

Columns

Column Information (专栏信息)

machine.get_all_pages_json('Columns','Info', column_id)

Column Followers (专栏关注者)

machine.get_all_pages_json('Columns','Followers', column_id)

Column Posts (专栏文章)

machine.get_all_pages_json('Columns','Posts', column_id)

Other Features

These features are not usages of Zhihu APIs, they exist for historical reasons, and maybe removed in the future.

Save to HTML

This function saves static html pages. item can be set to 'Questions', 'Answers' or Articles to save all the corresponding contents of a certain user. Pictures are not downloaded, and scripts tags are removed in the saved pages to prevent a page flashing bug caused by relative path script loading.

machine.save_all_html(item, user_url_token, save_path)