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

深夜,我用 Python 爬取了整个斗图网站,不服来斗

  •  
  •   yuiop · 2018-09-16 16:27:48 +08:00 · 4885 次点击
    这是一个创建于 2041 天前的主题,其中的信息可能已经有所发展或是发生改变。
    QQ、微信斗图总是斗不过,索性直接来爬斗图网,我有整个网站的图,不服来斗。

    废话不多说,选取的网站为斗图啦: http://www.doutula.com/

    详细全文:
    https://mp.weixin.qq.com/s?__biz=MzI2OTQxMTM4OQ==&mid=2247487106&idx=1&sn=2ecaa7cbfdaacdacbabe2aa50f614ab0&chksm=eae1fbd0dd9672c6aa9d864ca1066a304aef945ff836eeba8bd6404f7068b90222d611a8d1d8&token=1550086199&lang=zh_CN#rd
    15 条回复    2018-09-29 14:58:59 +08:00
    Alpha
        1
    Alpha  
       2018-09-16 21:02:38 +08:00
    这样可以保存图片?
    Alpha
        2
    Alpha  
       2018-09-16 22:13:05 +08:00
    for one in totals:
    img = one.find('img')
    try:
    sub_url = img.get('src')
    except:
    pass
    finally:
    urls = 'http:' + sub_url
    try:
    self.get_img(urls)
    except:
    pass


    这一段错了,你这样的话就变成所有的 url 无论有没有没有 http: 你都加上 http:
    liuguang
        3
    liuguang  
       2018-09-16 22:52:51 +08:00
    这个站好像是 laravel 做的。。。。
    SimbaPeng
        4
    SimbaPeng  
       2018-09-17 00:49:41 +08:00
    这你也想搞个大新闻。。。

    另外你这代码质量有待提高
    Les1ie
        5
    Les1ie  
       2018-09-17 02:42:54 +08:00
    想起来去年我也爬过这个网站的图片 hmmmmm 上面的图讲真有趣
    Les1ie
        6
    Les1ie  
       2018-09-17 02:46:18 +08:00
    Eds1995
        7
    Eds1995  
       2018-09-17 09:14:44 +08:00
    其实可以用深度学习生成表情包的。。。。。
    brave256
        8
    brave256  
       2018-09-17 09:17:50 +08:00 via iPhone
    30 页也能说整站啊。。我记得这网站有好几百页图,这网站有反爬,我试过用多线程爬到 800 多张就会禁止访问。
    tzhhahaha
        9
    tzhhahaha  
       2018-09-17 10:26:59 +08:00
    哈哈哈哈,我刚入门了 4 个月 python,爬了煎蛋跟表情包网站,蛮有意思的。
    另外其实煎蛋妹子图质量很高!(新手的第一个 star 求点击)
    https://github.com/TangZhongham/Python-Crawler
    vazo
        10
    vazo  
       2018-09-17 10:56:33 +08:00   ❤️ 1
    aino
        11
    aino  
       2018-09-17 13:39:06 +08:00
    去年用 java 写过一遍,现在还能用
    alwayshere
        12
    alwayshere  
       2018-09-17 13:46:29 +08:00
    V2 的水平真的令人堪忧,爬个这么简单的图片站居然也都能炫耀一下。。。。。。
    gymmcome
        13
    gymmcome  
       2018-09-17 20:46:04 +08:00
    @tzhhahaha 可以尝试用抓包工具获取煎蛋 APP 的接口,都是 json 数据,更加方便。
    tzhhahaha
        14
    tzhhahaha  
       2018-09-18 18:00:05 +08:00
    @gymmcome 哈哈谢谢~我试一下,又能学到东西了
    CLANNADHH
        15
    CLANNADHH  
       2018-09-29 14:58:59 +08:00
    1000+页已经爬完了。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5522 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 03:18 · PVG 11:18 · LAX 20:18 · JFK 23:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.