browserless
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBrowserless
Browserless
Headless Chrome browser as a service. Take screenshots, generate PDFs, scrape JS-rendered pages, and run Puppeteer/Playwright scripts without managing browser infrastructure.
Official docs: https://docs.browserless.io/
基于Headless Chrome的浏览器即服务。无需管理浏览器基础设施,即可进行截图、生成PDF、爬取JS渲染页面,以及运行Puppeteer/Playwright脚本。
When to Use
适用场景
Use this skill when you need to:
- Scrape JavaScript-heavy pages (React, Vue, Angular)
- Take full-page or element screenshots
- Generate PDFs from web pages
- Execute custom JavaScript in a browser context
- Bypass bot detection with stealth mode
- Run Puppeteer/Playwright scripts in the cloud
在以下场景中可使用该服务:
- 爬取重度依赖JavaScript的页面(React、Vue、Angular)
- 截取整页或指定元素的截图
- 从网页生成PDF
- 在浏览器环境中执行自定义JavaScript
- 通过隐身模式绕过机器人检测
- 在云端运行Puppeteer/Playwright脚本
Prerequisites
前置条件
- Create an account at https://www.browserless.io/
- Get your API token from https://account.browserless.io/
Set environment variable:
bash
export BROWSERLESS_API_TOKEN="your-api-token-here"Important: When usingin a command that pipes to another command, wrap the command containing$VARin$VAR. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq '.data[0]'
- 在https://www.browserless.io/ 创建账户
- 从https://account.browserless.io/ 获取API令牌
设置环境变量:
bash
export BROWSERLESS_API_TOKEN="your-api-token-here"重要提示: 当在包含管道的命令中使用时,请将包含$VAR的命令用$VAR包裹。由于Claude Code的bug,直接使用管道时环境变量会被静默清除。bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"' | jq '.data[0]'
How to Use
使用方法
1. Scrape Data (CSS Selectors)
1. 数据爬取(CSS选择器)
Extract structured JSON using CSS selectors:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"elements": [
{"selector": "h1"},
{"selector": "p"}
]
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/scrape?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json'With wait options:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://news.ycombinator.com",
"elements": [{"selector": ".titleline > a"}],
"gotoOptions": {
"waitUntil": "networkidle2",
"timeout": 30000
}
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/scrape?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data[0].results[:3]'使用CSS选择器提取结构化JSON数据:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"elements": [
{"selector": "h1"},
{"selector": "p"}
]
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/scrape?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json'带等待选项:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://news.ycombinator.com",
"elements": [{"selector": ".titleline > a"}],
"gotoOptions": {
"waitUntil": "networkidle2",
"timeout": 30000
}
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/scrape?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data[0].results[:3]'2. Take Screenshots
2. 截图
Full page screenshot:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"options": {
"fullPage": true,
"type": "png"
}
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/screenshot?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output screenshot.pngElement screenshot:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"options": {
"type": "png"
},
"selector": "h1"
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/screenshot?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output element.pngWith viewport size:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"viewport": {
"width": 1920,
"height": 1080
},
"options": {
"type": "jpeg",
"quality": 80
}
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/screenshot?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output screenshot.jpg整页截图:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"options": {
"fullPage": true,
"type": "png"
}
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/screenshot?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output screenshot.png指定元素截图:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"options": {
"type": "png"
},
"selector": "h1"
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/screenshot?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output element.png指定视口大小:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"viewport": {
"width": 1920,
"height": 1080
},
"options": {
"type": "jpeg",
"quality": 80
}
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/screenshot?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output screenshot.jpg3. Generate PDF
3. 生成PDF
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"options": {
"format": "A4",
"printBackground": true,
"margin": {
"top": "1cm",
"bottom": "1cm"
}
}
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/pdf?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output page.pdf写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"options": {
"format": "A4",
"printBackground": true,
"margin": {
"top": "1cm",
"bottom": "1cm"
}
}
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/pdf?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output page.pdf4. Get Rendered HTML
4. 获取渲染后的HTML
Get fully rendered HTML after JavaScript execution:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"gotoOptions": {
"waitUntil": "networkidle0"
}
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/content?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json获取JavaScript执行后的完整渲染HTML:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"gotoOptions": {
"waitUntil": "networkidle0"
}
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/content?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json5. Execute Custom JavaScript (Click, Type, etc.)
5. 执行自定义JavaScript(点击、输入等)
Run Puppeteer code with full interaction support:
Click element:
Write to :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://example.com");
await page.click("a");
return { data: { url: page.url() }, type: "application/json" };
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'Type into input:
Write to :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://duckduckgo.com");
await page.waitForSelector("input[name=q]");
await page.type("input[name=q]", "hello world");
const val = await page.$eval("input[name=q]", e => e.value);
return { data: { typed: val }, type: "application/json" };
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'Form submission:
Write to :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://duckduckgo.com");
await page.type("input[name=q]", "test query");
await page.keyboard.press("Enter");
await page.waitForNavigation();
return { data: { title: await page.title() }, type: "application/json" };
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'Extract data with custom script:
Write to :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://news.ycombinator.com");
const links = await page.$$eval(".titleline > a", els => els.slice(0,5).map(a => ({title: a.innerText, url: a.href})));
return { data: links, type: "application/json" };
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'运行Puppeteer代码以支持完整交互:
点击元素:
写入文件 :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://example.com");
await page.click("a");
return { data: { url: page.url() }, type: "application/json" };
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'在输入框中输入内容:
写入文件 :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://duckduckgo.com");
await page.waitForSelector("input[name=q]");
await page.type("input[name=q]", "hello world");
const val = await page.$eval("input[name=q]", e => e.value);
return { data: { typed: val }, type: "application/json" };
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'提交表单:
写入文件 :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://duckduckgo.com");
await page.type("input[name=q]", "test query");
await page.keyboard.press("Enter");
await page.waitForNavigation();
return { data: { title: await page.title() }, type: "application/json" };
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'使用自定义脚本提取数据:
写入文件 :
/tmp/browserless_function.jsjavascript
export default async ({ page }) => {
await page.goto("https://news.ycombinator.com");
const links = await page.$$eval(".titleline > a", els => els.slice(0,5).map(a => ({title: a.innerText, url: a.href})));
return { data: links, type: "application/json" };
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/function?token=${BROWSERLESS_API_TOKEN}" -H "Content-Type: application/javascript" -d @/tmp/browserless_function.js'6. Unblock Protected Sites
6. 解锁受保护网站
Bypass bot detection:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"browserWSEndpoint": false,
"cookies": false,
"content": true,
"screenshot": false
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/unblock?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json'绕过机器人检测:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"browserWSEndpoint": false,
"cookies": false,
"content": true,
"screenshot": false
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/unblock?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json'7. Stealth Mode
7. 隐身模式
Enable stealth mode to avoid detection:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"elements": [{"selector": "body"}]
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/scrape?token=${BROWSERLESS_API_TOKEN}&stealth=true" --header "Content-Type: application/json" -d @/tmp/browserless_request.json'启用隐身模式以避免被检测:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"elements": [{"selector": "body"}]
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/scrape?token=${BROWSERLESS_API_TOKEN}&stealth=true" --header "Content-Type: application/json" -d @/tmp/browserless_request.json'8. Export Page with Resources
8. 导出页面及资源
Fetch a URL and get content in native format. Can bundle all resources (CSS, JS, images) as zip:
Basic export:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com"
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/export?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output page.htmlExport with all resources as ZIP:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"includeResources": true
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/export?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output webpage.zip获取URL对应的内容并保留原生格式。可将所有资源(CSS、JS、图片)打包为ZIP:
基础导出:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com"
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/export?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output page.html导出所有资源为ZIP:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"includeResources": true
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/export?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json --output webpage.zip9. Performance Audit (Lighthouse)
9. 性能审计(Lighthouse)
Run Lighthouse audits for accessibility, performance, SEO, best practices:
Full audit:
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com"
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/performance?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data.categories | to_entries[] | {category: .key, score: .value.score}'Specific category (accessibility, performance, seo, best-practices, pwa):
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"config": {
"extends": "lighthouse:default",
"settings": {
"onlyCategories": ["performance"]
}
}
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/performance?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data.audits | to_entries[:5][] | {audit: .key, score: .value.score, display: .value.displayValue}'Specific audit (e.g., unminified-css, first-contentful-paint):
Write to :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"config": {
"extends": "lighthouse:default",
"settings": {
"onlyAudits": ["first-contentful-paint", "largest-contentful-paint"]
}
}
}Then run:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/performance?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data.audits'运行Lighthouse审计以检查无障碍性、性能、SEO和最佳实践:
完整审计:
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com"
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/performance?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data.categories | to_entries[] | {category: .key, score: .value.score}'指定分类(accessibility、performance、seo、best-practices、pwa):
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"config": {
"extends": "lighthouse:default",
"settings": {
"onlyCategories": ["performance"]
}
}
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/performance?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data.audits | to_entries[:5][] | {audit: .key, score: .value.score, display: .value.displayValue}'指定审计项(例如unminified-css、first-contentful-paint):
写入文件 :
/tmp/browserless_request.jsonjson
{
"url": "https://example.com",
"config": {
"extends": "lighthouse:default",
"settings": {
"onlyAudits": ["first-contentful-paint", "largest-contentful-paint"]
}
}
}然后执行:
bash
bash -c 'curl -s -X POST "https://production-sfo.browserless.io/performance?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json' | jq '.data.audits'10. Create Persistent Session
10. 创建持久化会话
Create a persistent browser session that can be connected to via WebSocket:
Write to :
/tmp/browserless_request.jsonjson
{
"ttl": 300000,
"stealth": false,
"headless": true
}Then run:
bash
curl -s -X POST "https://production-sfo.browserless.io/session?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.jsonResponse includes:
- - Session ID for subsequent operations
id - - WebSocket URL for Puppeteer/Playwright connection
connect - - Full URL to stop/delete the session (use this exact URL)
stop - - BrowserQL query endpoint
browserQL - - Time-to-live in milliseconds (default: 300000 = 5 minutes)
ttl
Use the session with Puppeteer:
javascript
const puppeteer = require('puppeteer-core');
const browser = await puppeteer.connect({
browserWSEndpoint: '<connect-url-from-response>' // Use the 'connect' URL from response
});创建可通过WebSocket连接的持久化浏览器会话:
写入文件 :
/tmp/browserless_request.jsonjson
{
"ttl": 300000,
"stealth": false,
"headless": true
}然后执行:
bash
curl -s -X POST "https://production-sfo.browserless.io/session?token=${BROWSERLESS_API_TOKEN}" --header "Content-Type: application/json" -d @/tmp/browserless_request.json响应包含:
- - 后续操作使用的会话ID
id - - 用于Puppeteer/Playwright连接的WebSocket URL
connect - - 用于停止/删除会话的完整URL(请使用该精确URL)
stop - - BrowserQL查询端点
browserQL - - 存活时间(毫秒,默认:300000 = 5分钟)
ttl
使用Puppeteer连接会话:
javascript
const puppeteer = require('puppeteer-core');
const browser = await puppeteer.connect({
browserWSEndpoint: '<connect-url-from-response>' // 使用响应中的'connect' URL
});11. Stop Persistent Session
11. 停止持久化会话
Stop a running session before its timeout expires using the URL from the creation response:
stopbash
curl -s -X DELETE "<stop-url-from-response>"Example (replace with the actual URL from session creation):
<stop-url-from-response>stopbash
curl -s -X DELETE "https://production-sfo.browserless.io/e/<encoded-path>/session/<session-id>?token=<your-token>"Response:
json
{
"success": true,
"message": "Session <session-id> was successfully removed",
"sessionId": "<session-id>",
"timestamp": "2026-01-01T07:41:36.933Z"
}在会话超时前使用创建会话时响应中的 URL停止运行中的会话:
stopbash
curl -s -X DELETE "<stop-url-from-response>"示例(将替换为会话创建时响应中的实际 URL):
<stop-url-from-response>stopbash
curl -s -X DELETE "https://production-sfo.browserless.io/e/<encoded-path>/session/<session-id>?token=<your-token>"响应:
json
{
"success": true,
"message": "Session <session-id> was successfully removed",
"sessionId": "<session-id>",
"timestamp": "2026-01-01T07:41:36.933Z"
}API Endpoints
API端点
| Endpoint | Method | Description |
|---|---|---|
| POST | Extract data with CSS selectors |
| POST | Capture screenshots (PNG/JPEG) |
| POST | Generate PDF documents |
| POST | Get rendered HTML |
| POST | Execute custom Puppeteer code |
| POST | Bypass bot protection |
| POST | Export page with resources as ZIP |
| POST | Lighthouse audits (a11y, perf, SEO) |
| POST | Create persistent browser session |
| DELETE | Stop persistent session |
| 端点 | 请求方法 | 描述 |
|---|---|---|
| POST | 使用CSS选择器提取数据 |
| POST | 捕获截图(PNG/JPEG) |
| POST | 生成PDF文档 |
| POST | 获取渲染后的HTML |
| POST | 执行自定义Puppeteer代码 |
| POST | 绕过机器人防护 |
| POST | 将页面及资源导出为ZIP |
| POST | Lighthouse审计(无障碍、性能、SEO) |
| POST | 创建持久化浏览器会话 |
| DELETE | 停止持久化会话 |
Common Options
通用选项
gotoOptions
gotoOptions
Control page navigation:
json
{
"gotoOptions": {
"waitUntil": "networkidle2",
"timeout": 30000
}
}waitUntil values:
- - Wait for load event
load - - Wait for DOMContentLoaded
domcontentloaded - - No network connections for 500ms
networkidle0 - - Max 2 network connections for 500ms
networkidle2
控制页面导航:
json
{
"gotoOptions": {
"waitUntil": "networkidle2",
"timeout": 30000
}
}waitUntil可选值:
- - 等待load事件触发
load - - 等待DOMContentLoaded事件触发
domcontentloaded - - 500ms内无网络连接
networkidle0 - - 500ms内最多2个网络连接
networkidle2
waitFor Options
waitFor选项
json
{
"waitForTimeout": 1000,
"waitForSelector": {"selector": ".loaded", "timeout": 5000},
"waitForFunction": {"fn": "() => document.ready", "timeout": 5000}
}json
{
"waitForTimeout": 1000,
"waitForSelector": {"selector": ".loaded", "timeout": 5000},
"waitForFunction": {"fn": "() => document.ready", "timeout": 5000}
}Viewport
视口
json
{
"viewport": {
"width": 1920,
"height": 1080,
"deviceScaleFactor": 2
}
}json
{
"viewport": {
"width": 1920,
"height": 1080,
"deviceScaleFactor": 2
}
}Query Parameters
查询参数
| Parameter | Description |
|---|---|
| API token (required) |
| Enable stealth mode ( |
| Block advertisements |
| Use proxy server |
| 参数 | 描述 |
|---|---|
| API令牌(必填) |
| 启用隐身模式( |
| 屏蔽广告 |
| 使用代理服务器 |
Response Format
响应格式
Scrape response:
json
{
"data": [
{
"selector": "h1",
"results": [
{
"text": "Example Domain",
"html": "Example Domain",
"attributes": [{"name": "class", "value": "title"}],
"width": 400,
"height": 50,
"top": 100,
"left": 50
}
]
}
]
}爬取响应:
json
{
"data": [
{
"selector": "h1",
"results": [
{
"text": "Example Domain",
"html": "Example Domain",
"attributes": [{"name": "class", "value": "title"}],
"width": 400,
"height": 50,
"top": 100,
"left": 50
}
]
}
]
}Guidelines
使用指南
- waitUntil: Use for most pages,
networkidle2for SPAsnetworkidle0 - Timeouts: Default is 30s; increase for slow pages
- Stealth Mode: Enable for sites with bot detection
- Screenshots: Use with quality 80 for smaller files
jpeg - Rate Limits: Check your plan limits at https://account.browserless.io/
- Regions: Use region-specific endpoints for better latency:
- (US West)
production-sfo.browserless.io - (Europe)
production-lon.browserless.io
- waitUntil:大多数页面使用,单页应用(SPA)使用
networkidle2networkidle0 - 超时设置:默认超时为30秒;针对加载缓慢的页面可延长超时时间
- 隐身模式:针对带有机器人检测的网站启用该模式
- 截图:使用质量为80的jpeg格式以减小文件大小
- 速率限制:请在https://account.browserless.io/ 查看您的套餐限制
- 区域节点:使用区域专属端点以获得更低延迟:
- (美国西部)
production-sfo.browserless.io - (欧洲)
production-lon.browserless.io