自动化camoufox vs camoufox-browser区别

适用场景:

方案 适合
Camoufox Python自动化、Playwright替代
camofox-browser Agent、远程Browser API、分布式浏览器池

1.Camoufox 使用

1.1 安装

官方推荐 Python形式安装

1
2
pip install camoufox[geoip]
playwright install firefox

或者:

1
pip install camoufox

1.2 最小示例

官方兼容 Playwright


2.高级反检测参数

Camoufox 核心价值在于:

  • 指纹伪装
  • navigator spoof
  • WebGL spoof
  • timezone/geolocation
  • Playwright 隐藏
  • Juggler 协议隔离

它不是简单 JS patch,而是浏览器底层修改。


2.1 推荐配置

这是生产环境常用配置:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from camoufox.sync_api import Camoufox
from browserforge.fingerprints import Screen

screen = Screen(
max_width=1920,
max_height=1080
)

config = {
"headless": "virtual", # linux下生效
"geoip": True,
"humanize": True,
"enable_cache": True,
"locale": "en-US",
"screen": screen,
"os": ["windows"],
}

with Camoufox(**config) as browser:
page = browser.new_page()
page.goto("https://bot.sannysoft.com")
page.screenshot(path="stealth.png")

3.代理 IP 集成

生产环境最关键:

Camoufox 只能降低浏览器指纹暴露,不会解决 IP reputation。

很多人误以为:“用了 Camoufox = 永不被封”。这是错误的。

DataDome / Cloudflare / PerimeterX:

  • TLS 指纹
  • ASN
  • Residential IP
  • 行为轨迹
  • Cookie continuity
  • 鼠标轨迹
  • 浏览器一致性

4.camofox-browser 使用

Browser-as-a-Service

  • AI Agent
  • LangChain
  • OpenManus
  • OpenClaw
  • Browser MCP
  • 分布式浏览器集群

4.1 启动

1
2
3
4
5
git clone https://github.com/jo-inc/camofox-browser

cd camofox-browser
npm install
npm start

首次启动会下载 Camoufox Browser。

默认:

1
http://localhost:9377

4.2Docker启动

1
docker run -p 9377:9377 ghcr.io/jo-inc/camofox-browser

5.架构理解

5.1 Camoufox 架构

graph TD

A[Playwright API]
--> B[Camoufox]

B --> C[Patched Firefox]

C --> D[Juggler Isolation]

D --> E[Anti Fingerprint]

5.2 camofox-browser 架构

graph TD

A[LLM Agent]
--> B[REST API]

B --> C[camofox-browser]

C --> D[Camoufox]

D --> E[Firefox Engine]

6.一句话总结

项目 定位
Camoufox Playwright stealth Firefox
camofox-browser Browser API Server
最大价值 C++ 层指纹伪装
最大限制 无法解决 IP reputation
最适合 AI Agent + 高对抗爬虫