{"id":13689578,"url":"https://github.com/lzjun567/zhihu-api","last_synced_at":"2025-05-02T00:30:40.847Z","repository":{"id":47731704,"uuid":"88390033","full_name":"lzjun567/zhihu-api","owner":"lzjun567","description":"Zhihu API for Humans","archived":false,"fork":false,"pushed_at":"2021-08-06T06:41:05.000Z","size":337,"stargazers_count":973,"open_issues_count":29,"forks_count":256,"subscribers_count":106,"default_branch":"master","last_synced_at":"2025-04-24T04:28:28.477Z","etag":null,"topics":["api","zhihu","zhihu-api"],"latest_commit_sha":null,"homepage":"http://zhihu-api.readthedocs.io/en/latest/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lzjun567.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-16T04:03:59.000Z","updated_at":"2025-04-07T09:10:57.000Z","dependencies_parsed_at":"2022-08-12T13:50:31.132Z","dependency_job_id":null,"html_url":"https://github.com/lzjun567/zhihu-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzjun567%2Fzhihu-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzjun567%2Fzhihu-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzjun567%2Fzhihu-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lzjun567%2Fzhihu-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lzjun567","download_url":"https://codeload.github.com/lzjun567/zhihu-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251966431,"owners_count":21672666,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","zhihu","zhihu-api"],"created_at":"2024-08-02T15:01:53.843Z","updated_at":"2025-05-02T00:30:35.836Z","avatar_url":"https://github.com/lzjun567.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"\n## zhihu-api\n\n[![travis](https://travis-ci.org/KellyHwong/zhihu-api.svg?branch=master)](https://travis-ci.org/KellyHwong/zhihu-api)\n[![license](https://img.shields.io/github/license/kellyhwong/zhihu-api.svg)](https://github.com/KellyHwong/zhihu-api/blob/master/LICENSE)\n\n## 关于\n\nZhihu-API 的初衷是希望提供一套简洁、优雅的、Pythonic的API接口，面向的用户是对知乎数据有兴趣的群体，它可以用在数据分析、数据挖掘、增长黑客、以及希望通过程序自动完成知乎某个操作等应用场景。\n\n注意:只支持Python3\n\n## 安装\n\n```python\npip install -U zhihu\n# 或者安装最新包\npip install git+git://github.com/lzjun567/zhihu-api --upgrade\n```\n\n## 快速上手\n\n\n```python\n\nfrom zhihu import User\nzhihu = User()\n\n#获取用户基本信息\nprofile = zhihu.profile(user_slug=\"xiaoxiaodouzi\")\nprint(profile)\n\n\u003e\u003e\u003e\n{\n    'name': '我是x',\n     'headline': '程序员',\n     'gender': -1,\n     'user_type': 'people',\n     'is_advertiser': False,\n     'url_token': 'xiaoxiaodouzi',\n     'id': '1da75b85900e00adb072e91c56fd9149',\n     'is_org': False\n}\n\n# 发送私信\n\u003e\u003e\u003e zhihu.send_message(content=\"私信测试\", user_slug=\"xiaoxiaodouzi\")\n\u003cResponse [200]\u003e\n\n# 关注用户\n\u003e\u003e\u003e zhihu.follow(user_slug=\"xiaoxiaodouzi\")\n{'follower_count': 12, 'followed': True}\n\n# 取消关注\n\u003e\u003e\u003e zhihu.unfollow(user_slug=\"xiaoxiaodouzi\")\n{'follower_count': 11, 'followed': False}\n\n\n\u003e\u003e\u003e from zhihu import Answer\n\u003e\u003e\u003e answer = Answer(url=\"https://www.zhihu.com/question/62569341/answer/205327777\")\n\n# 赞同回答\n\u003e\u003e\u003e answer.vote_up()\n{'voting': 1, 'voteup_count': 260}\n\n# 反对\n\u003e\u003e\u003e answer.vote_down()\n{'voting': -1, 'voteup_count': 259}\n\n# 中立\n\u003e\u003e\u003e answer.vote_neutral()\n{'voting': 0, 'voteup_count': 260}\n\n# 感谢回答\n\u003e\u003e\u003e answer.thank()\n{'is_thanked': True}\n\n# 取消感谢\n\u003e\u003e\u003e answer.thank_cancel()\n{'is_thanked': False}\n\n# 提取回答中的图片\n\u003e\u003e\u003e answer.images(path=\"images\")\n['8160c14ea69b3a6674152f2c1ae6cd7a_b.jpg']\n\n\n\u003e\u003e\u003e from zhihu import User\n\u003e\u003e\u003e zhihu = User()\n# 关注用户\n\u003e\u003e\u003ezhihu.follow(user_slug=\"zhijun-liu\")\n\n# 取消关注\n\u003e\u003e\u003ezhihu.unfollow(user_slug=\"zhijun-liu\")\n\n# 粉丝列表\n\u003e\u003e\u003e zhihu.followers(user_slug=\"zhijun-liu\")\n\n\n\n```\n\n\n## 贡献者\n欢迎 PR, 所有贡献者都将出现在这里，排名不分先后\n\n* [@BigBorg](https://github.com/BigBorg)\n* [@xiaowenlong100](https://github.com/xiaowenlong100)\n* [@chenghengchao](https://github.com/chenghengchao)\n* [@MaxPoon](https://github.com/MaxPoon)\n* [@Oopswc](https://github.com/Oopswc)\n* [@excitedFrog](https://github.com/excitedFrog)\n\n## 交流\n群已经加不进，可以先加微信：lzjun567 拉你入群\n\n![群](https://dn-mhke0kuv.qbox.me/30f70119cd4a840560d4.jpeg)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzjun567%2Fzhihu-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flzjun567%2Fzhihu-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flzjun567%2Fzhihu-api/lists"}