英雄码头
自动处理指纹绕过、无头检测、TLS指纹、WebRTC泄漏、Cloudflare、DataDome等。
快速开始
# Build and start (keeps running in background)
docker compose up -d --build
# Check health
curl http://localhost:4003/health
# Fetch a page
node browse.js https://example.com
# Fetch with a CSS selector
node browse.js https://example.com "main article"
# Include raw HTML
node browse.js https://example.com --html运作原理
Chrome+英雄核心运行 Docker容器内部。主机端脚本通过以下方式委派 docker exec,因此主机上没有本机模块编译问题。
[host: browse.js] → docker exec hero-browser → [container: browse-internal.js + HeroCore + Chrome]MCP服务器
暴露英雄为 MCP工具 通过stdio,AI代理(Claude、OpenClaw等)可以直接使用它。
node mcp-server.js工具
| 工具 | 说明 |
|---|---|
hero_browse | 获取URL--返回 title, text,可选 html.支持CSS selector. |
hero_status | 检查Docker容器的健康状况和正常运行时间。 |
MCP呼叫示例
{
"method": "tools/call",
"params": {
"name": "hero_browse",
"arguments": { "url": "https://example.com" }
}
}HeroClient(高级)
对于需要更多控制的自定义脚本:
const HeroClient = require('./HeroClient')
const client = new HeroClient({ profileId: 'my-session' })
await client.init()
await client.goto('https://example.com')
const title = await client.getTitle()
const text = await client.getText()
console.log(title, text)
await client.close()注:HeroClient必须从脚本运行中使用 *里面* 集装箱(docker exec hero-browser node your-script.js),或使用browse.js来自自动处理此问题的主机。
会话配置文件
跨运行保存和恢复浏览器状态(Cookie、localStorage)——这对经过身份验证的抓取很有用。配置文件具有7天的TTL。
const client = new HeroClient({ profileId: 'logged-in' })
// First run — log in and save
await client.init()
await client.goto('https://example.com/login')
// ... perform login steps ...
await client.saveProfile()
await client.close()
// Later runs — restore session
const profile = client.loadProfile()
await client.init({ userProfile: profile })
await client.goto('https://example.com/dashboard') // already logged in
await client.close()港口
| 端口 | 用途 |
|---|---|
1818 | 英雄核心WebSocket(内部) |
4003 | HTTP健康检查(/health, /status) |
环境变量
| 变量 | 默认值 | 描述 |
|---|---|---|
HERO_PORT | 1818 | Hero Core集装箱内端口 |
PORT | 4003 | 健康服务器端口 |
TZ | Australia/Brisbane | 浏览器指纹的时区 |
需求
- Docker+Docker组合
- Node.js(主机,用于
browse.js/mcp-server.js) - 主机上不需要Python或构建工具
