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

用 python 写爬虫,如何获取网站的 logo 或者缩略图了

  •  
  •   larkifly · 2014-08-12 10:48:43 +08:00 · 3874 次点击
    这是一个创建于 3559 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题,大家有什么好办法了。
    6 条回复    2014-08-19 18:49:40 +08:00
    Zuckonit
        1
    Zuckonit  
       2014-08-12 10:56:41 +08:00
    缩略图,
    <link rel="shortcut icon" href="/static/img/icon_rayps_64.png" type="image/png" />
    <link rel="apple-touch-icon" href="/static/apple-touch-icon.png" />
    类似
    Zuckonit
        2
    Zuckonit  
       2014-08-12 10:57:39 +08:00
    Zuckonit
        3
    Zuckonit  
       2014-08-12 10:58:51 +08:00
    ChiChou
        4
    ChiChou  
       2014-08-12 11:36:04 +08:00
    缩略图需要开 phantomjs 之类的软件渲染,成本(流量,系统硬件资源等)比较高。
    beordle
        5
    beordle  
       2014-08-12 22:29:33 +08:00
    Google Favicon API
    http://www.google.com/s2/favicons?domain=twitter.com
    而缩略图非常不好办了
    只能用Phantomjs这种 Headless 的浏览器截图.我见过的 API 都不完美.首先PNG不全.另外比如说国外的API抓不了国内.国内的抓不了国外.最好的办法就是自己抓 异步入库.
    hayao650
        6
    hayao650  
       2014-08-19 18:49:40 +08:00
    urllib.urlretrieve()应该可以
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1016 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 56ms · UTC 20:01 · PVG 04:01 · LAX 13:01 · JFK 16:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.