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

爬虫这种东西受制于网速么,明明我睡很久了。。。

  •  
  •   RadAsm · Nov 21, 2015 · 5813 views
    This topic created in 3965 days ago, the information mentioned may be changed or developed.

    因为朋友是做民航的,希望能够看到未来几天内某个航段的价格情况。
    就写了个爬虫,打算从协程爬取数据,因为本来我是刚接触爬虫这个东西,所以基本算是不懂了。
    楼主使用的是 selenium 进行数据的爬取,代码在这里

    协程的每个页面的数据需要进行下拉才能将数据显示完全。

    我在办公室(网速有点慢吧,但是页面能够流畅的打开,并且我增加了 js 交互后的 sleep 时间)运行这段代码,基本上崩溃。。。看错误信息,基本上就是 WebElement 找不到(难道睡 10 秒都不够吗?)

    但是,在家里,都能爬取成功。

    不明所以,希望和 v 友讨论讨论。。

    还有,向请教:正确的爬虫姿势是怎样的?

    6 replies  •  2015-11-22 23:41:51 +08:00
    jugelizi
        1
    jugelizi  
       Nov 21, 2015
    为什么不直接抓 js 请求的数据
    knightdf
        2
    knightdf  
       Nov 21, 2015
    selenium 慢的一比。。。你还不如抓下他 ajax 的接口
    RadAsm
        3
    RadAsm  
    OP
       Nov 21, 2015
    @knightdf 确实慢 =。=
    XianZaiZhuCe
        4
    XianZaiZhuCe  
       Nov 21, 2015 via Android
    携程的数据不行,抓航旅的
    lostsnow
        5
    lostsnow  
       Nov 21, 2015
    scrapy
    coolzilj
        6
    coolzilj  
       Nov 22, 2015
    https://www.apifier.com/
    爬虫新姿势
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5197 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 315ms · UTC 02:14 · PVG 10:14 · LAX 19:14 · JFK 22:14
    ♥ Do have faith in what you're doing.