推荐学习书目
› 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
akmonde
V2EX  ›  Python

scrapy 如何设置每个网站最大爬行时间,以及实现条件触发放弃某个目录

  •  
  •   akmonde · Jun 5, 2018 · 2703 views
    This topic created in 3039 days ago, the information mentioned may be changed or developed.

    RT,现在鄙人有两个需求:

    1.设置 scrapy 的每个站的最大爬行时间。

    由于最近需要批量采集一些网站,然后部分网站可能是论坛和博客之类的.
    我这边如果没法预判网站类型的话,希望在 1-2 小时候把超时的网站直接 ban 掉。
    但谷歌了下并没有看见 setting.py 里有解决方案。
    

    2.条件触发放弃爬行某个目录

    在爬行的时候,可能会遇到多重目录,比如日期+随机码,案例如下:
    http://test.com/mua/213213/123213.shtml
    
    针对这类我已经设置了去重算法,但是无奈一旦爬到那个目录,他会一直爬下去。
    就算立即抛弃已经爬到的目录也会耽误很久。
    所以想问问各位大佬,比如有没有到了某个频率触发条件,可以直接放弃 mua 目录下的爬行任务的法子?
    同样没有谷歌到解决方案。
    
    1 replies  •  2018-06-05 21:48:06 +08:00
    akmonde
        1
    akmonde  
    OP
       Jun 5, 2018
    没人么...v 站的大佬们可以给点建议么?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2753 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 10:38 · PVG 18:38 · LAX 03:38 · JFK 06:38
    ♥ Do have faith in what you're doing.