使用 Webkit 包构建网络爬虫

发布于 2024-07-07 07:18:44 字数 948 浏览 7 评论 0原文

我正在尝试构建一个网络爬虫。
我需要两件事:

  • 将 HTML 转换为 DOM 对象。
  • 按需执行现有的 JavaScript。
The result I expect is a DOM Object, where the JavaScript that executes on-load is already executed.
Also, I need an option to execute on demand additional JavaScripts (on events like: onMouseOver, onMouseClick etc.) First of all, I couldn't find a good documentation source.
I searched through Webkit Main Page but couldn't find much information for users of the package, and no usefull code examples. Also, in some forums I've seen instructions not to use the Webkit interface for crawlers, but directly the DOM and Javascript inner packages.

I'm searching for Documentation and Code Examples.
Also, any recommendations on proper usage.

Work environment:
  • 操作系统:Windows
  • 语言:C++

I'm trying to build a web crawler.
I need 2 things:

  • Convert the HTML into a DOM object.
  • Execute existing JavaScripts on demand.

The result I expect is a DOM Object, where the JavaScript that executes on-load is already executed.
Also, I need an option to execute on demand additional JavaScripts (on events like: onMouseOver, onMouseClick etc.)

First of all, I couldn't find a good documentation source.
I searched through Webkit Main Page but couldn't find much information for users of the package, and no usefull code examples.
Also, in some forums I've seen instructions not to use the Webkit interface for crawlers, but directly the DOM and Javascript inner packages.

I'm searching for Documentation and Code Examples.
Also, any recommendations on proper usage.

Work environment:

  • OS: Windows
  • Lang: C++

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

微暖i 2024-07-14 07:18:44

查看与 WebKit 主干一起打包的一些测试工具。 大多数端口(据我所知)都包含 DumpRenderTree,它实例化 WebKitView,然后在处理指定文件后吐出渲染树。 从理论上讲,它是最简单的 WebKit 示例之一。

Check out some of the testing tools packaged alongside the WebKit trunk. Most ports (as far as I know) include DumpRenderTree which instantiates an WebKitView and then spits out a render tree after processing a specified file. It's theoretically one of the simplest examples of WebKit possible.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文