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
creaer
V2EX  ›  Python

Python 反爬虫

  •  
  •   creaer · 2016-08-29 15:08:15 +08:00 · 4679 次点击
    这是一个创建于 2797 天前的主题,其中的信息可能已经有所发展或是发生改变。

    今天爬知乎被封了,请问如何绕过反爬虫

    21 条回复    2016-08-31 10:21:21 +08:00
    UnisandK
        1
    UnisandK  
       2016-08-29 15:09:34 +08:00
    换 IP
    creaer
        2
    creaer  
    OP
       2016-08-29 15:14:15 +08:00
    VicYu
        3
    VicYu  
       2016-08-29 15:39:43 +08:00
    proxy list
    creaer
        4
    creaer  
    OP
       2016-08-29 16:22:56 +08:00
    @VicYu 谢谢,感觉设置一个 sleep 好像也可以,暂时就这样吧
    dsg001
        5
    dsg001  
       2016-08-29 16:34:58 +08:00
    单机几百线程爬知乎,爬 20+小时没问题,过了几天才被封
    airqj
        6
    airqj  
       2016-08-29 16:39:28 +08:00
    @dsg001 我的也是
    感觉知乎的爬虫太迟钝了吧 :)
    582033
        7
    582033  
       2016-08-29 16:43:35 +08:00
    https://gist.github.com/582033/19a35dac89d86b98e413567cc5fb2505

    自动多线程从指定网站获取代理列表
    creaer
        8
    creaer  
    OP
       2016-08-29 16:56:00 +08:00 via Android
    @dsg001 我也是昨天开始爬,今天被封的
    masterzh01
        9
    masterzh01  
       2016-08-29 17:23:31 +08:00
    hippoboy
        10
    hippoboy  
       2016-08-29 17:42:56 +08:00
    好几台服务器装 Squid,自己做代理....
    creaer
        11
    creaer  
    OP
       2016-08-29 18:12:26 +08:00
    creaer
        12
    creaer  
    OP
       2016-08-29 18:12:48 +08:00
    @hippoboy 这个成本不低 我就自己玩玩
    Allianzcortex
        13
    Allianzcortex  
       2016-08-29 21:56:57 +08:00   ❤️ 1
    换 UA ,换 IP ,多线程,设置等待时间。

    我曾经有段时间买了个国外服务器安装 SS,然后连接上后走 Socks5 代理。被封的次数就很少。
    creaer
        14
    creaer  
    OP
       2016-08-29 22:29:07 +08:00 via Android
    @Allianzcortex 设置等待时间好像没啥用,而且速度反而降低了
    Allianzcortex
        15
    Allianzcortex  
       2016-08-29 22:45:00 +08:00
    @creaer 服务器要区分人和机器行为的重要依据就是访问频率啊,增加等待时间会更容易混淆服务器。设置等待时间也比较友好:-D
    7sDream
        16
    7sDream  
       2016-08-29 22:49:00 +08:00
    可以尝试用知乎的 RESTful OAuth API ,比起访问网页版好像比较不容易被封。

    具体资料我就不贴了。
    dsg001
        17
    dsg001  
       2016-08-30 10:49:48 +08:00   ❤️ 1
    @creaer
    @airqj
    所以尽量提高单位时间的爬取速度,被封后换 IP 继续
    airqj
        18
    airqj  
       2016-08-30 12:10:32 +08:00 via Android
    @dsg001 目前已经爬得差不多了
    而且免费的代理不靠谱 就不折腾了
    creaer
        19
    creaer  
    OP
       2016-08-30 12:30:35 +08:00 via Android
    @Allianzcortex 难道是因为我设置的等待时间太短了
    Allianzcortex
        20
    Allianzcortex  
       2016-08-30 15:55:07 +08:00
    @creaer https://segmentfault.com/a/1190000005840672 你可以看看这篇文章,看看携程反爬虫的思路。反爬虫最重要的是不能影响业务,不能使正常用户的访问受影响~
    ijustdo
        21
    ijustdo  
       2016-08-31 10:21:21 +08:00
    user agent 不停的换 最好比喻 ios android 。。。。。。
    还有个大招 挂代理 控制爬去速度。。。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2887 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:30 · PVG 22:30 · LAX 07:30 · JFK 10:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.