推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
Fizzyi
V2EX  ›  Python

scrapy 代理 ip 失效后更换 IP

  •  
  •   Fizzyi · May 27, 2019 · 3852 views
    This topic created in 2723 days ago, the information mentioned may be changed or developed.
    求助各位 v 友,我使用 scrapy 框架爬取数据使用了代理 ip,想问下如何在当前 ip 失效或者被封了之后自动更换 ip 呢
    3 replies  •  2019-06-05 15:58:33 +08:00
    tikazyq
    tikazyq
    May 27, 2019
    1
    需要记录代理 ip 的有效性,如果是使用了 API,先缓存到数据库中。

    顺便打个广告,Crawlab 是一个专注于爬虫的集成了爬虫管理、任务调度、任务监控、数据分析等模块的分布式爬虫管理平台,非常适合对爬虫管理、爬虫工程化有要求的开发者及企业

    https: //github.com/tikazyq/crawlab
    lucays
    lucays
    May 28, 2019 via Android
    2
    有中间件的,在 middleware 里写,至少按照 response.status 判断是不是 200
    popbayun
    popbayun
    Jun 5, 2019
    3
    建个代理 IP 池,失效或被 ban 就从池子里剔除掉
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2970 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 00:50 · PVG 08:50 · LAX 16:50 · JFK 19:50
    ♥ Do have faith in what you're doing.