Giter Site home page Giter Site logo

yunspider's Introduction

百度云爬虫

安装使用

  1. 安装go与设置gopath
  2. clone项目到gopath目录
  3. 安装依赖
  • go get github.com/go-sql-driver/mysql
  • go get github.com/siddontang/go/log
  • go get github.com/garyburd/redigo/redis
  • go get github.com/Unknwon/goconfig
  1. 修改config.ini配置文件中你自己的MySQL和Redis配置(可以不配Redis),Redis不配或者错误会默认将已经爬取的uk保存到hasIndexKeys.txt文件中,这样做防止重复爬同一位用户多次
  2. 创建database名为baidu,然后执行baidu.sql
  3. go run spider.go (当然也可以编译后运行,此时config.ini记得也复制到编译后的文件目录下,然后运行)

直接下载编译好的使用

  1. 下载适合自己系统的版本
  2. 修改config.ini配置文件,并且放到程序运行的目录下
  3. linux: chmod +x spider,然后直接./spider运行或者nohup ./spider 1>log.out 2>err.out &以后台方式运行;win:直接点击spider.exe运行

爬到数据使用

上面3个连接请求必须带上Referer("Referer", "https://yun.baidu.com/share/home?uk=23432432#category/type=0"),否则请求不到json数据, 获取用户订阅和获取用户粉丝每次请求一次休眠2s的话可以无限制请求,对ip没要求,获取用户分享超坑,一个ip只能请求10次,并且休眠也没用. 因为没有那么多ip,我就去研究手机版的用户分享,手机版获取用户分享可以一次性连续请求60次,60次后必须休眠35s左右在继续请求就可以,不会像pc版那样必须换ip, 但是手机版只能请求网页源码,然后用正则进行匹配.

License

yunSpide source code is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).

yunspider's People

Contributors

gudegg 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.