Git Product home page Git Product logo

zhihu_crawler's Introduction

zhihu_crawler

gavin66/zhihu_crawler 使用知乎移动端 APP 的 API 爬取数据。 目前项目已实现知乎的自动登录,并可爬取用户资料数据(还未有学历等详细资料,之后会添加),需要数据进行分析的或者感兴趣的可以给个 star⭐,谢谢。

使用方法

你必须安装有 mongoDB

安装依赖

pip install -r requirements.tx

爬取用户信息保存进 mongodb 中

python zhihu_crawler/spider/profile.py

配置

文件 config.py 进行项目运行配置

# mongodb 连接配置
MONGO_URI = 'mongodb://%s:%s@%s:%s/admin' % ('username', 'password', 'ip', 'port')

# 以下两个文件路径可随意换成你指定的
# token 默认保存地址
TOKEN_PATH = os.environ['HOME'] + '/zhihu_crawler/zhihu.token'
# 日志文件
LOG_PATH = os.environ['HOME'] + '/zhihu_crawler/zhihu.log'

API 说明

from zhihu.client import Client

# 所有程序的入口
client = Client()
# 直接使用用户名和密码登录
client.login(username='+8615555555555', password='password')
# 不使用参数,根据命令行输入
# client.login()

# 自己 model
myself = client.myself()
# 自己的信息
myself.info()

# 他人 model
people = client.people()
# 某人关注列表
people.followees()
# 某人被关注列表
people.followers()

运行截图

爬取数据的格式

参考

zhihu_crawler's People

Contributors

gavin66 avatar

Watchers

 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.