Skip to main content

browserless

# https://docs.browserless.io/docker/docker-quickstart/
TOKEN=$(openssl rand -hex 16)
echo TOKEN=$TOKEN
docker run -p 3000:3000 \
-e "CONCURRENT=10" \
-e DATA_DIR=/data/browser \
-e DOWNLOAD_DIR=/data/download \
-e "TOKEN=$TOKEN" \
--name browserless ghcr.io/browserless/chromium
envdefaultnote
TIMEOUT30000默认 30s
CONCURRENT10并发数
QUEUED5超过则返回 429
HOST
DEBUG关闭所有-*
CORSfalse
CORS_ALLOW_METHODSGET,POST,OPTIONS
CORS_ALLOW_ORIGIN*
CORS_MAX_AGES2592000
METRICS_JSON_PATH/metrics
DATA_DIR
DOWNLOAD_DIR/data/browserless-download-dirs
ALLOW_GETfalse
PROXY_HOST
PROXY_PORT
PROXY_SSL
ALLOW_FILE_PROTOCOL
HEALTH如果资源紧张,会返回 503
MAX_MEMORY_PERCENT99健康内存阀值
MAX_CPU_PERCENT99健康CPU阀值
QUEUE_ALERT_URL
REJECT_ALERT_URL
TIMEOUT_ALERT_URL
FAILED_HEALTH_URL
import puppeteer from 'puppeteer-core';

const browser = await puppeteer.connect({
browserWSEndpoint: 'ws://localhost:3000?token=6R0W53R135510',
});
const page = await browser.newPage();

await page.goto('https://wener.me');
const data = await page.screenshot();
browser.close();
paramfor
token
proxy
proxyCountry
blockAds
launch自定义启动参数,JSON, 可以设置 user-data-dir

API