Giter Club home page Giter Club logo

zhihu-api's Introduction

项目简介

目标

出于学习目的,试图构建一个更加简洁、优雅的、Pythonic 的知乎 API。

前置条件

  • Python3.x
  • Requests2
  • BeautifulSoup4

安装

git@github.com:lzjun567/zhihu-api.git
cd  zhihu-api
pip install -r requirement.txt

API使用

用户个人公开信息

>>> from zhihu import Zhihu
>>> zhihu = Zhihu()
>>> zhihu.user(profile_url="https://www.zhihu.com/people/xiaoxiaodouzi")

{'avatar_url_template': 'https://pic1.zhimg.com/v2-ca13758626bd7367febde704c66249ec_{size}.jpg',
     'badge': [],
     'name': '我是小号',
     'headline': '程序员',
     'gender': -1,
     'user_type': 'people',
     'is_advertiser': False,
     'avatar_url': 'https://pic1.zhimg.com/v2-ca13758626bd7367febde704c66249ec_is.jpg',
     'url': 'http://www.zhihu.com/api/v4/people/1da75b85900e00adb072e91c56fd9149', 'type': 'people',
     'url_token': 'xiaoxiaodouzi',
     'id': '1da75b85900e00adb072e91c56fd9149',
     'is_org': False}

# 还可以用
>>> zhihu.user(user_slug="xiaoxiaodouzi")

私信发送

>>> zhihu.send_message("你好,问候3", user_id="1da75b85900e00adb072e91c56fd9149")

# 还支持 user_slug
>>> zhihu.send_message("你好,问候2", user_slug="xiaoxiaodouzi")

# 还支持 profile_url
>>> zhihu.zhihu.send_message("你好,问候1", profile_url="https://www.zhihu.com/people/xiaoxiaodouzi")

关注用户

>>> zhihu.follow(profile_url="https://www.zhihu.com/people/gao-yu-dong-41")
{"follower_count": 6}

>>> zhihu.follow(user_slug="xiaoxiaodouzi")
{"follower_count": 6}

TODO

  • 文章点赞
  • ...

贡献者

欢迎 PR, 所有贡献者都将出现在这里

交流

群已经加不进,可以先加微信:lzjun567 拉你入群

群

zhihu-api's People

Contributors

lzjun567 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.