V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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
wenyu1001
V2EX  ›  Python

如何优化一个爬虫,提升两个档次?

  •  
  •   wenyu1001 ·
    wenyuace · 2016-03-07 22:47:12 +08:00 · 5076 次点击
    这是一个创建于 2974 天前的主题,其中的信息可能已经有所发展或是发生改变。

    入职笔试时基于 python 撸了个爬虫,闲来无事准备去改改。

    那么问题来了,如何优化去提升两个档次?

    • framework
    • performance
    • code style
    • ...

    https://github.com/wenyu1001/spider.git

    12 条回复    2016-03-09 13:26:30 +08:00
    sunchen
        1
    sunchen  
       2016-03-07 23:48:10 +08:00
    入职笔试写爬虫,一猜就是创宇。
    wenyu1001
        2
    wenyu1001  
    OP
       2016-03-08 09:57:26 +08:00
    @sunchen 不用猜 :)

    是否先从稳定性,准确性入手优化?
    helloworldwt
        3
    helloworldwt  
       2016-03-08 10:55:37 +08:00
    爬虫需要使用代理,这样你 ip 被封时,减少对程序的影响
    flamhaze5946
        4
    flamhaze5946  
       2016-03-08 12:26:37 +08:00 via Android
    好吧。。是爬美女网站吗。。。当初被拒了(ฅ>ω<*ฅ)
    wenyu1001
        5
    wenyu1001  
    OP
       2016-03-08 13:01:50 +08:00
    @helloworldwt
    是,可以加入 httpproxy, socks 代理

    @flamhaze5946
    想法真丰富
    CrazySpiderMan
        6
    CrazySpiderMan  
       2016-03-08 13:16:08 +08:00
    是我的话, 我直接换 Node.js 了. Python 搞爬虫, 麻烦的很.
    CrazySpiderMan
        7
    CrazySpiderMan  
       2016-03-08 13:16:37 +08:00
    @CrazySpiderMan 这里有个我用 Node.js 写个 P2P 网络的爬虫. https://github.com/Fuck-You-GFW/p2pspider
    l6751902
        8
    l6751902  
       2016-03-08 13:43:45 +08:00
    黑 V2EX 后台,上传爬虫远程管理工具,然后把爬虫实际执行的逻辑嵌入前端.........
    sampeng
        9
    sampeng  
       2016-03-08 14:00:02 +08:00
    加 2 倍机器。。绝对提升两个档次
    wenyu1001
        10
    wenyu1001  
    OP
       2016-03-08 17:44:11 +08:00
    @sampeng nice!
    penjianfeng
        11
    penjianfeng  
       2016-03-08 21:01:00 +08:00
    这还不简单,先把性能降 2 倍,然后在切换回来,绝对提升两个档次,哈哈哈
    wenyu1001
        12
    wenyu1001  
    OP
       2016-03-09 13:26:30 +08:00
    @penjianfeng
    这要是被领导知道,还不等着去财务处领工资?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5536 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 06:05 · PVG 14:05 · LAX 23:05 · JFK 02:05
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.