[关闭]
@rickyChen 2016-08-03T10:42:06.000000Z 字数 508 阅读 2916

Linux下使用命令行获取网页截图

Linux Python


环境准备

安装Python-webkit2png[Git地址]

  1. git clone https://github.com/adamn/python-webkit2png.git
  2. cd python-webkit2png
  3. python setup.py install

安装PyQt4相关依赖(4.10.1-13.el7)

  1. yum install PyQt4.x86_64
  2. yum install PyQt4-devel.x86_64
  3. yum install PyQt4-webkit.x86_64
  4. yum install PyQt4-webkit-devel.noarch

安装Xvfb(虚拟X server)

  1. yum install xorg-x11-server-Xvfb.x86_64

运行命令行

  1. webkit2png http://sina.com.cn -x 1280 1200 --output=home.png

缺点

webkitpng只能获取静态页面的截图,不能获取动态页面或者需要通过js计算之后的页面。

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注