净化
人工智能代理的网页抓取API。 一个二进制。零依赖。内置MCP服务器。
Go是Firecrawl/Craw4AI的替代品——没有Python,没有Node.js,没有Redis。就 docker compose up 然后走。
获取免费的API密钥 · API文件 · MCP服务器 · 服务托管
______________________________________________________________________
看到它工作
# Start Purify
docker compose up -d
# Scrape a page
curl -s -X POST http://localhost:8080/api/v1/scrape \
-H "Content-Type: application/json" \
-d '{"url": "https://news.ycombinator.com"}' | jq .{
"success": true,
"content": "# Hacker News\n\n1. Show HN: ...",
"tokens": {
"original_estimate": 11708,
"cleaned_estimate": 5572,
"savings_percent": 52.4
},
"timing": {
"total_ms": 400
}
}两个命令。在不到一秒钟的时间内清除Markdown。
______________________________________________________________________
如何比较
| Purify | Firecrawl | Crawl4AI | Jina Reader | |
|---|---|---|---|---|
| 语言 | 去 | TypeScript | Python | N/A(云) |
| 自助主机 | 单个二进制 | 5+容器(Redis、PG、Playwright…) | pip+Playwright | 没有自主机文档 |
| MCP服务器 | 内置(5个工具) | 社区维护 | 否 | 否 |
| 代币节省 | 52–99% | ~70–80% | ~75–85% | ~60–70% |
| 递归爬行 | 是 | 是 | 否 | |
| 批量刮擦 | 是 | 是 | 否 | 否 |
| 许可证 | Apache 2.0 | AGPL-3.0 | Apache 2.0 | 部分开源 |
| 价格(每月需要50k) | 29美元/月 | 49美元/月 | 免费(本地) | 49美元/日 |
快速开始
选项A:Docker
docker compose up -d选项B:从源代码构建
git clone https://github.com/Easonliuliang/purify.git
cd purify && make build
PURIFY_AUTH_ENABLED=false ./bin/purify选项C:托管API(无设置)
curl -s -X POST https://purify.verifly.pro/api/v1/scrape \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://news.ycombinator.com"}' | jq .content在获取免费API密钥 purify.verifly.pro --每月1000次请求,无信用卡。
代币节省——实际数字
用以下方式测量 令牌。 (GPT-4标记器)。Purify剥离了导航、广告、脚本和样式——你的LLM只看到内容。
| 网站 | 原始HTML | 净化后 | 节省 | 延迟 |
|---|---|---|---|---|
| GitHub仓库页面 | 99181 | 1370 | 98.6% | 1.1秒 |
| 《纽约时报》 | 103744 | 2130 | 98.0% | 1.1秒 |
| API无烟煤文件 | 129066 | 4837 | 96.3% | 1.8秒 |
| Next.js博客(React SPA) | 87231 | 4271 | 95.1% | 5.0秒 |
| 英国广播公司新闻主页 | 97540 | 6969 | 92.9% | 2.5秒 |
| arXiv论文(DeepSeek-R1) | 26684 | 3129 | 88.3% | 0.5秒 |
| 维基百科(法学硕士) | 245276 | 76325 | 68.9% | 1.5秒 |
| 黑客新闻 | 11708 | 5572 | 52.4% | 0.4秒 |
| sspai.com | 32,895 | 187 | 99.4% | 1.2秒 |
| 小红书(红注) | 158742 | 353 | 99.8% | 1.0秒 |
低成本网站(Hacker News,paulgraham.com)已经很少了——几乎是纯文本,没有可删除的垃圾。这是一个特性,不是bug。
用例
- AI代理 -通过MCP或REST API为您的代理提供网络访问权限
- RAG管道 --抓取文档,获得干净的Markdown,嵌入到你的矢量数据库中
- 交易机器人 --以低于500毫秒的延迟抓取预测市场和新闻
- 研究助理 --阅读并总结任何网页
MCP服务器
Purify包括一个内置的MCP服务器 5工具:
| 工具 | 说明 |
|---|---|
scrape_url | 删除一页,返回干净的内容 |
batch_scrape | 并行删除多个URL |
crawl_site | 递归抓取网站(BFS) |
map_site | 发现网站上的所有URL |
extract_data | 使用LLM提取结构化数据(BYOK) |
设置
添加到您的Claude桌面配置(claude_desktop_config.json):
{
"mcpServers": {
"purify": {
"command": "purify-mcp",
"env": {
"PURIFY_API_URL": "https://purify.verifly.pro",
"PURIFY_API_KEY": "your-api-key"
}
}
}
}对于自托管实例,设置 PURIFY_API_URL 到 http://localhost:8080.
然后问克劳德:
- *“刮擦https://paulgraham.com/greatwork.html并对其进行总结”*
- *“抓取Next.js文档网站,最多20页。”*
- *“从本页提取产品名称和价格:…”*
API
POST/api/v1/scrape
删除一页并返回已清理的内容。支持JSON响应或SSE流。
{
"url": "https://example.com/article",
"output_format": "markdown",
"extract_mode": "readability"
}| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
url | 字符串 | *必需的* | 目标URL |
output_format | 字符串 | markdown | markdown, html, text,或 markdown_citations |
extract_mode | 字符串 | readability | readability, raw, pruning,或 auto |
timeout | int | 30 | 超时时间(秒)(1–120) |
stealth bool的。 false | 反检测模式 | ||
headers | object | -- | 自定义HTTP标头 |
cookies | array | -- | 导航前要设置的Cookie |
actions | array | -- | 浏览器交互(单击、滚动、等待等) |
include_tags | 数组 | -- | 要保留的CSS选择器 |
exclude_tags | 数组 | -- | 要删除的CSS选择器 |
css_selector | string | -- | 仅提取匹配的元素 |
max_age | int | 0 | 缓存最大年龄(毫秒)(0=无缓存) |
答复:
{
"success": true,
"status_code": 200,
"final_url": "https://example.com/article",
"content": "# Article Title\n\nClean markdown content...",
"metadata": {
"title": "Article Title",
"author": "Author Name",
"language": "en",
"source_url": "https://example.com/article",
"fetch_method": "http"
},
"links": {
"internal": [{"href": "/about", "text": "About"}],
"external": [{"href": "https://github.com/...", "text": "GitHub"}]
},
"images": [{"src": "https://example.com/hero.jpg", "alt": "Hero"}],
"tokens": {
"original_estimate": 32895,
"cleaned_estimate": 187,
"savings_percent": 99.43
},
"timing": {
"total_ms": 1172,
"navigation_ms": 1162,
"cleaning_ms": 9
},
"engine_used": "http"
}SSE流媒体
添加 Accept: text/event-stream 用于接收服务器发送事件而不是JSON的标头:
curl -X POST https://purify.verifly.pro/api/v1/scrape \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"url": "https://example.com"}'活动: scrape.started → scrape.navigated → scrape.completed (或 scrape.error).
引文格式
使用 "output_format": "markdown_citations" 将内联链接转换为学术风格参考:
See [Google][1] and [GitHub][2]
---
[1]: https://google.com
[2]: https://github.comPOST/api/v1/批处理/刮擦
并行删除多个URL。返回异步轮询的作业ID。
{
"urls": ["https://a.com", "https://b.com", "https://c.com"],
"options": {"output_format": "markdown"},
"webhook_url": "https://your-server.com/callback",
"webhook_secret": "your-hmac-secret"
}投票状态: GET /api/v1/batch/:id
POST/api/v1/抓取
从URL开始递归抓取网站。
{
"url": "https://docs.example.com",
"max_depth": 3,
"max_pages": 100,
"scope": "subdomain",
"webhook_url": "https://your-server.com/callback",
"webhook_secret": "your-hmac-secret"
}投票状态: GET /api/v1/crawl/:id
POST/api/v1/map
在不抓取内容的情况下发现网站上的所有网址。
{"url": "https://example.com"}POST/api/v1/提取
使用您自己的LLM密钥进行结构化数据提取(BYOK)。
curl -X POST https://purify.verifly.pro/api/v1/extract \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/product",
"schema": {
"name": "string",
"price": "number",
"features": ["string"]
},
"llm_api_key": "your-openai-key"
}'Webhook回调
批处理和爬网端点支持webhook通知。当作业完成时,Purify会向您的 webhook_url 使用HMAC-SHA256签名 X-Purify-Signature 头球
活动: batch.completed, crawl.page, crawl.completed, crawl.failed
验证签名:
HMAC-SHA256(webhook_secret, request_body) == X-Purify-Signature (sha256=)GET/api/v1/health
返回服务器状态和正常运行时间。
配置
所有通过环境变量进行的配置:
| 变量 | 默认值 | 描述 |
|---|---|---|
PURIFY_HOST | 0.0.0.0 | 收听地址 |
PURIFY_PORT | 8080 | 监听端口 |
PURIFY_AUTH_ENABLED | true | 启用API密钥身份验证 |
PURIFY_API_KEYS | - | 逗号分隔的有效API密钥 |
PURIFY_MAX_PAGES | 10 | 最大并发浏览器选项卡数 |
PURIFY_DEFAULT_TIMEOUT | 30s | 默认抓取超时 |
PURIFY_RATE_RPS | 5 | 速率限制(请求/秒/键) |
PURIFY_RATE_BURST | 10 | 速率限制突发 |
PURIFY_LOG_LEVEL | info | debug, info, warn, error |
自足执行
Purify是一个单一的Go二进制文件。无需Docker,无需Redis,无需数据库。
# Local development (no auth)
PURIFY_AUTH_ENABLED=false ./bin/purify
# Production (with API key)
PURIFY_API_KEYS=your-secret-key ./bin/purify在任何每月5美元的VPS上运行。自托管时没有使用限制。
系统要求
- 任何Linux、macOS或Windows计算机
- 约15 MB磁盘空间
- 约30 MB RAM空闲
定价
| 免费 | 专业版 | |
|---|---|---|
| 价格 | 0美元/月 | 29美元/月 |
| 请求数 | 1000/月 | 50000/月 |
| 并发 | 2 | 10 |
| MCP服务器 | ✓ | ✓ |
| 结构化提取 | ✓ | ✓ |
贡献
欢迎捐款。请先打开一个问题,讨论您想更改的内容。
许可证
Apache 2.0 --无论是商业上还是其他方面,都可以随心所欲地使用它。无AGPL限制。
