Files
web-capture-api/manual_capture_guide.md

69 lines
1.7 KiB
Markdown
Raw Permalink Normal View History

2026-07-07 13:20:52 +08:00
# 手动 Chrome 捕获指南
## 方案三完整流程
### 1⃣ 启动真实 Chrome带调试端口
在您的本地机器或服务器上运行:
```bash
# Linux
google-chrome --remote-debugging-port=9222 https://www.techpowerup.com/gpu-specs/rtx-pro-6000-blackwell.c4272
# 或者使用已有的 Chrome 进程(需要先关闭所有 Chrome
google-chrome-stable --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug
```
### 2⃣ 手动验证(如 Cloudflare
- 在浏览器中手动完成验证过程
- 等待页面完全加载
- 确认可以看到正常内容
### 3⃣ 连接到 Chrome 并截图
验证完成后,运行脚本:
```bash
# 连接到 Chrome 并截图
python3.12 /tmp/connect_chrome.py techpowerup
# 或者捕获当前所有页面
python3.12 /tmp/connect_chrome.py
```
### 4⃣ 查看结果
```bash
# 查看截图
ls -lh /tmp/chrome_capture_*.png
# 查看HTML
head -100 /tmp/chrome_html_0.html
```
## API 集成方案
如果需要通过 API 获取内容,可以:
1. 在服务代码中添加 CDP 连接选项
2. 用户先手动验证
3. API 连接到已验证的浏览器实例
## 注意事项
⚠️ **重要**
- Chrome 必须带 `--remote-debugging-port=9222` 启动
- 所有 Chrome 进程必须先关闭(或使用新的 user-data-dir
- 验证完成后才能运行脚本
- 截图后浏览器保持打开,可以继续使用
## 一键脚本
```bash
# 启动 Chrome 并等待用户验证
google-chrome --remote-debugging-port=9222 "https://www.techpowerup.com/gpu-specs/rtx-pro-6000-blackwell.c4272" &
echo "请在浏览器中完成验证,然后按 Enter 继续截图..."
read
python3.12 /tmp/connect_chrome.py techpowerup
```