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

关于爬虫网站的更新的问题,请帮忙一下,谢谢

  •  
  •   nightSlient · Jul 4, 2016 · 3924 views
    This topic created in 3623 days ago, the information mentioned may be changed or developed.

    有两个问题想问一下,第一:怎样识别被爬去网站的更新,有什么角度,维度来进行识别? 第二:如何启动定时爬虫?

    5 replies    2016-07-06 09:53:27 +08:00
    b821025551b
        1
    b821025551b  
       Jul 4, 2016
    1 :更新条目:第一次爬到的条目存下来,第二次爬到第一次的最后一条,判断是否最后一条的标志最好是 id ,如没有 id 则用名字,但要注意名字更新问题;
    更新内容:相当于全部重新爬一遍了。
    2 : crontab
    nightSlient
        2
    nightSlient  
    OP
       Jul 5, 2016
    @b821025551b 谢谢收到了启发,第一个问题,确实维度不好整。谢谢
    jnduan
        3
    jnduan  
       Jul 5, 2016
    1.
    更新条目:爬过的 url 你不存么?一段时期内爬过的就不用再爬了啊
    更新内容,有 etag header 可以用 etag 判断,没有的话,通过你从网页抽取的 md5 一类的判断,或者页面关键页面元素内容判断
    2.
    这其实是抓取任务调度的问题。建议你做一个抓取队列,爬虫从队列取任务,爬完汇报。至于怎么维护队列(优先级、频率、周期)取决与你的需求
    nightSlient
        4
    nightSlient  
    OP
       Jul 6, 2016
    原来使用 APScheduler 也可以做定时任务,谢谢啊
    nightSlient
        5
    nightSlient  
    OP
       Jul 6, 2016
    @jnduan 很瘦启发,非常感谢!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2688 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 10:15 · PVG 18:15 · LAX 03:15 · JFK 06:15
    ♥ Do have faith in what you're doing.