GithubHelp home page GithubHelp logo

crawl_xiciproxy's Introduction

前言

在爬取网站数据的时候,一些网站会对用户的访问频率进行限制,如果爬取过快会被封ip,而使用代理可防止被封禁。本项目使用scrapy框架对西刺网站进行爬取,并验证爬取代理的有效性,最终将有效的代理存储到json文件中。

依赖

  1. python3.6
  2. Scrapy 1.5.0

使用方法

只需在命令行中执行以下命令即可:

$ scrapy crawl xici -o out.json -a num_pages=10 -a typ=nn

其中out.json是最终输出有效代理的json文件,num_pages是爬取页数,typ表示要爬取的代理类型,nn是高匿代理,nt是普通代理。

爬取网页信息时大多用高匿代理,高匿代理不改变客户机的请求,这样在服务器看来就像有个真正的客户浏览器在访问它,这时客户的真实IP是隐藏的,不会认为我们使用了代理。

提示 :程序在验证代理有效性的过程中,对于无效的代理会抛出超时异常,不要管这些异常,让程序继续执行直到结束。


详细教程:个人博客

crawl_xiciproxy's People

Contributors

runninggump avatar

Stargazers

 avatar  avatar lin avatar  avatar master939 avatar WZ.L 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.