最小化浏览器程序 KPBroswer

码农软件 · 软件分类 · 网络工具包 · 2019-02-27 20:59:38

软件介绍

KPBroswer是一个基于QtWebKit的最小化浏览器程序,通过被第三方程序调用,
能实现对复杂页面加载后数据(例如,复杂Ajax、数据加密)的抓取,支持屏幕截图。
KP是“鲲鹏”二字的拼音首字母。

适用场景:

 页面数据动态加载(例如,Ajax过程过于复杂,分析成本太高);
 数据加密(客户端JS解密,解密算法难以获取或难以用其它语言实现);
 屏幕截图;
 跨平台的抓取方案;


依赖库:

PyQt4
Ubuntu下安装方法:sudo apt-get install python-qt4
Windows下安装方法:在这里下载二进制安装包直接安装http://www.riverbankcomputing.co.uk/software/pyqt/download/

调用方法:

若在Linux终端下运行,需要安装Xvfb。Ubuntu下安装方法:apt-get install xvfb xfonts-base xfonts-75dpi xfonts-100dpi xfonts-wqy
调用举例(Linux):xvfb-run python KPBroswer.py http://www.site-digger.com --flags=redice --output="page.html" --screenshot="sitedigger.jpg"
调用举例(Windows):python KPBroswer.py http://www.site-digger.com --flags=redice --output="page.html" --screenshot="sitedigger.jpg"

Usage: KPBroswer.py  [options]

Options:
  -h, --help            show this help message and exit
  -p PROXY, --proxy=PROXY
                        Proxy to use.
  -t TIMEOUT, --timeout=TIMEOUT
                        The timeout time of loading page.
  -f FLAGS, --flags=FLAGS
                        Flags need to wait for. Semicolon can be used as a
                        eperator.
  -w WAIT_TIMEOUT, --wait_timeout=WAIT_TIMEOUT
                        The timeout time of waitting for flags.
  -g, --gui             Whether to show the broswer GUI.
  -o OUTPUT, --output=OUTPUT
                        The output filename.
  -s SCREENSHOT, --screenshot=SCREENSHOT
                        If the value is not empty, take a screenshot and save
                        it here.

注意:
Linux下不要忘记安装相关字体库,否则截图中的汉字将会是乱码,如下图site-digger-font-problem.jpg所示。

安装后,就正常了,如图site-digger.jpg所示。

示例:
sample.py文件为一个Python以外部程序方式调用KPBroswer.py的示例,其它语言的调用可以参考其实现。

本文地址:https://codercto.com/soft/d/276.html

Impractical Python Projects

Impractical Python Projects

Lee Vaughan / No Starch Press / 2018-11 / USD 29.95

Impractical Python Projects picks up where the complete beginner books leave off, expanding on existing concepts and introducing new tools that you’ll use every day. And to keep things interesting, ea......一起来看看 《Impractical Python Projects》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具