最小化浏览器程序 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://www.codercto.com/soft/d/276.html

The Haskell School of Music

The Haskell School of Music

Paul Hudak、Donya Quick / Cambridge University Press / 2018-10-4 / GBP 42.99

This book teaches functional programming through creative applications in music and sound synthesis. Readers will learn the Haskell programming language and explore numerous ways to create music and d......一起来看看 《The Haskell School of Music》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具