Expand description
CDP (Chrome DevTools Protocol) 客户端
通过 chromiumoxide 连接到已运行的 CDP 服务器(Lightpanda / Obscura / Chrome 等), 导航页面并提取 HTML。适用于需要 JavaScript 渲染的 SPA 站点。
§支持的 CDP 服务
| 服务 | 启动方式 |
|---|---|
| Lightpanda | lightpanda serve --port 9222 |
| Obscura | obscura serve --port 9222 |
| Chrome/Chromium | chrome --remote-debugging-port=9222 |
§示例
use crawlkit_extensions::cdp::{CdpClient, CdpPool, CdpStrategy};
// 单个客户端
let client = CdpClient::builder()
.with_endpoint("http://127.0.0.1:9222")
.build()
.await?;
// 多端点池(轮询策略)
let pool = CdpPool::builder()
.with_endpoint("http://127.0.0.1:9222")
.with_endpoint("http://127.0.0.1:9223")
.with_strategy(CdpStrategy::RoundRobin)
.build()
.await?;Structs§
- CdpClient
- CDP 客户端(单端点)
- CdpClient
Builder - CDP 客户端构建器
- CdpPool
- CDP 连接池
- CdpPool
Builder - CDP 连接池构建器
Enums§
- CdpStrategy
- 端点选择策略