基于 Cloudflare Browser Rendering 的一站式文档处理平台
高质量网页截图,支持多种自定义选项:
GET /screenshot?url=https://example.com&format=png
或者:
POST /screenshot
Content-Type: application/json
X-API-Key: your_api_key
{
"url": "https://example.com",
"format": "png",
"fullPage": true
}
POST /screenshot
Content-Type: application/json
{
"url": "https://example.com",
"format": "jpeg",
"quality": 90,
"viewport": {"width": 1920, "height": 1080},
"fullPage": false,
"omitBackground": true,
"clip": {"x": 0, "y": 0, "width": 800, "height": 600}
}
POST /screenshot
Content-Type: application/json
{
"url": "https://example.com",
"addStyleTag": [
{"content": "body { background: #f0f0f0; }"}
],
"addScriptTag": [
{"content": "document.querySelector('h1').style.color = 'red';"}
]
}
抓取网页内容并转换为不同格式:
GET /crawl?url=https://example.com&format=json
或者:
POST /crawl
Content-Type: application/json
X-API-Key: your_api_key
{
"url": "https://example.com",
"format": "json"
}
GET /crawl?url=https://example.com&format=markdown
或者:
POST /crawl
Content-Type: application/json
{
"url": "https://example.com",
"format": "markdown",
"options": {
"timeout": 30000,
"waitTime": 2000
}
}
GET /crawl?url=https://example.com&format=pdf
或者:
POST /crawl
Content-Type: application/json
{
"url": "https://example.com",
"format": "pdf"
}
如果服务配置了 API 密钥,需要在请求中包含认证信息:
# 方式 1: 请求头
X-API-Key: your_api_key
# 方式 2: Bearer Token
Authorization: Bearer your_api_key
# 方式 3: 查询参数
?api_key=your_api_key
GET /pdf?markdown=# Hello World%0A%0AThis is a **test** document.&title=My Document&api_key=your_key
或者:
GET /?markdown=# Hello World&title=My Document
POST /pdf
Content-Type: application/json
X-API-Key: your_api_key
{
"markdown": "# Hello World\n\nThis is a **test**.",
"title": "My Document"
}
POST /pdf
Content-Type: text/plain
Authorization: Bearer your_api_key
# Hello World
This is a **test** document.