{"repo":"cheezone/ZhihuVAPI","free":true,"listed":false,"github":"https://github.com/cheezone/ZhihuVAPI","clone":"git clone https://github.com/cheezone/ZhihuVAPI.git","description":"优雅地玩知乎","language":"Python","stars":62,"topics":["zhihu","crawler","python"],"license":"MIT","category":"scrapers-browser-automation","readme_excerpt":"ZhihuVAPI:优雅地玩知乎 简介 ZhihuVAPI是什么? ZhihuVAPI 是一个可以让你以一种优雅的形式调用知乎数据的 Python 包. 怎么安装或者更新 ZhihuVAPI? pip install -U ZhihuVAPI 使用 引用 ZhihuVAPI import ZhihuVAPI as zhihu 后面的 as zhihu 是别称的意思,便于输入. 配置用户 配置脚本使用的 cookies ,一共有两种方法. 1. 什么都不管,脚本会默认读取 Chrome 或者 Cent 的 cookies.如果你是其他类 Chrome 的浏览器,你可以在 config.py 的 cookiepath 自定义cookies文件的路径. 2. 在 config.py 禁用 is use chrome cookies 后,你可以在里面自定义 headers . Mac 用户需要设置自定义的 cookie 和 hash 登录之后 Zhihu 后，访问 这个接口，拿到 json 对象第一层的 id 值。 配置 ZhihuVAPI/config.py 文件， is use chrome cookies = False ，并且添加你的 hash 属性到文件中，同时使用自定义的 headers，注意将自己知乎页面的 cookie 值填入（仅补全 Cookie': ' xsrf=...; z c0=...' 省略号代表的值即可）。 使用 pip install -U --no-dependencies ZhihuVAPI 来下载依赖可以略过 pywin32 的依赖下载。 读取自己 输出: 基本操作 ZhihuVAPI 支持以下三种初始化: 1. URL 初始化 : zhihu.People('https://www.zhihu.com/people/iCheez/activities') 2. ID 初始化 : zhihu.People('e4f87c3476a926c1e2ef51b4fcd18fa3') 3. URL Token 初始化(仅对用户对象有效) : zhihu.People('iCheez') 对于点赞列表,粉丝列表等数据,ZhihuVAPI支持以下方式调用: 获取列表的所有项 获取列表的指定数量的项 获取列表的从某处开始的指定数量的项 获取列表的从某页开始的指定数量的项 获取答案 输出: 获取用户 获取专栏 获取文章 获取收藏夹 获取问题","default_branch":null,"files":null,"tree":[],"storefront":"/r/cheezone","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cheezone/ZhihuVAPI/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}