使用python捕获网页截图的简单方法

2024-04-27 09:13:04 发布

您现在位置:Python中文网/ 问答频道 /正文

Possible Duplicate:
How to get a website screenshot in python

“使用python捕获网页截图的简单方法!”在

我用谷歌搜索了一下这个主题,但找不到任何有用的东西。。。在

我需要一种方法来捕捉网站截图与Python脚本从Debian“服务器”Linux(nox)。。怎么可能?有简单的方法吗?在


Tags: to方法in服务器脚本网页主题get
1条回答
网友
1楼 · 发布于 2024-04-27 09:13:04

试试这个http://www.blogs.uni-osnabrueck.de/rotapken/2008/12/03/create-screenshots-of-a-web-page-using-python-and-qtwebkit/

Oh, wait! QWebPage depends an QtGui, and QtGui depends on a running X server (at least on Unix systems). So how can we make use of this on a headless server machine? The answer is Xvfb, a framebuffer based X server, originally designed for testing purposes. Of course, it requires some X-libs and fonts, too (how should a page be rendered without any fonts?), but it does not have so much overhead like the real XOrg-server and don’t need to be running all the time. Just call the script this way:

相关问题 更多 >