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

求推荐几个爬取 js 生成的动态网页的教程?PhantomJS?其他?

  •  
  •   hippoboy · 2016-06-14 09:51:26 +08:00 · 2868 次点击
    这是一个创建于 2875 天前的主题,其中的信息可能已经有所发展或是发生改变。
    最近在看动态网页爬虫,
    网上搜来搜去都没有很系统的教程,
    求老司机给我指条明路,
    谢谢
    7 条回复    2016-06-15 10:04:40 +08:00
    mingyuejingque
        1
    mingyuejingque  
       2016-06-14 10:16:58 +08:00   ❤️ 1
    仔细看 phantomjs 官网自带的 example 基本可以完成小需求了。
    gimp
        2
    gimp  
       2016-06-14 10:30:51 +08:00   ❤️ 1
    https://blog.ishell.me/a/python-selenium-phantomjs.html
    之前用 phantomjs 抓取时写的笔记

    https://blog.ishell.me/a/selenium-with-xvfb.html
    后来发现 Linux 下也可以用 Firefox/Chrome 等浏览器

    http://www.seleniumhq.org/docs/03_webdriver.jsp
    当然,看官网教程肯定是最好的

    动态网页可以先尝试找数据接口,如果找到接口模拟请求数据效率会高很多。找不到,或者模拟不了,那就用 selenium+浏览器 的方式处理吧,简单粗暴,只是效率低点
    brucedone
        3
    brucedone  
       2016-06-14 11:40:10 +08:00
    http://brucedone.com/archives/560

    你只是需要借助渲染的环境,你可以尝试 splash
    Yc1992
        4
    Yc1992  
       2016-06-14 13:31:11 +08:00
    splash 是一个轻量级的渲染服务,可以执行简单 js
    practicer
        5
    practicer  
       2016-06-14 17:41:21 +08:00   ❤️ 1
    强烈推荐 《 Python 网络数据采集》,从第十章和十一章专门讲解如何爬取 JS 动态内容和图像识别,本书用一个爬取 flash 电子书的例子来说明,强烈推荐给题主。
    coolloves
        6
    coolloves  
       2016-06-14 21:46:26 +08:00
    马克
    suduo1987
        7
    suduo1987  
       2016-06-15 10:04:40 +08:00
    一般都用 GAS 爬
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1933 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 16:15 · PVG 00:15 · LAX 09:15 · JFK 12:15
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.