网页抓取API
一个端点,覆盖所有页面。该抓取 API 负责代理轮换、无头 Chrome、JavaScript 执行、CAPTCHA 破解和自动重试。
Endpoint
Section titled “Endpoint” GET https://scrape.shifter.io/v1
同时支持 POST 和 PUT 两种方式,参见 POST requests 和 PUT requests。
Authentication
Section titled “Authentication”在每个请求中将您的 API 密钥作为 api_key 查询参数传递。密钥可在面板的 Web Scraping API → API Keys 中管理。
curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https://example.com"Core parameters
Section titled “Core parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | 您的 API 密钥 |
url | string | yes | 要抓取的 URL |
render_js | 0 | 1 | no | 启用无头 Chrome 渲染 |
premium_proxy | 0 | 1 | no | 通过住宅 IP 路由(Growth 及以上套餐) |
mobile_proxy | 0 | 1 | no | 通过移动 IP 路由(Growth 及以上套餐) |
country | ISO code | no | 用于代理地理定位的国家 |
device | desktop | mobile | tablet | no | 模拟的设备类型 |
session_id | string | no | 跨请求复用 cookie 和代理 |
timeout | ms | no | 浏览器最长可用时间,最高 60000 |
wait_for | ms | no | 导航后的空闲等待时间(建议 5000-10000) |
wait_for_css | selector | no | 阻塞直至出现指定的 CSS 选择器 |
wait_until | string | no | 导航等待条件(高级用法) |
keep_headers | 0 | 1 | no | 将自定义请求头转发给目标站点 |
custom_headers | JSON | no | 自定义请求头(需 URL 编码) |
custom_cookies | string | no | Cookie 请求头的值 |
extract_rules | JSON | no | 用于解析为结构化 JSON 的 CSS 选择器 |
auto_parser | 0 | 1 | no | 自动解析 JSON 响应 |
screenshot | 0 | 1 | no | 返回 PNG 而非 HTML |
screenshot_options | JSON | no | 截图尺寸与选择器 |
binary_response | 0 | 1 | no | 以流式方式返回二进制内容(PDF、图片) |
js_instructions | JSON | no | 在抓取前执行滚动/点击/等待操作 |
disable_stealth | 0 | 1 | no | 禁用隐身插件 |
webhook | URL | no | 响应就绪后将其 POST 到该 URL |
forward_proxy | URL | no | 通过您的上游代理进行链式转发 |
任何期望接收 JSON 的参数都必须进行 URL 编码。
Quick example
Section titled “Quick example”curl "https://scrape.shifter.io/v1?api_key=YOUR_API_KEY&url=https://example.com&render_js=1&wait_for_css=h1"Endpoint pages
Section titled “Endpoint pages” 基础请求 Minimal GET with api_key and url.
完整参数 Every parameter documented in detail.
POST 请求 Scrape URLs that require POST bodies.
PUT 请求 Scrape PUT endpoints.
渲染 JavaScript render_js flag and limits.
JavaScript 指令 Scroll, click, wait before capture.
等待 CSS wait_for_css selector syntax.
强制超时 Cap browser time with timeout.
截图 Capture full-page or element PNG.
会话 Hold cookies and IP across requests.
二进制文件 Download PDFs, images, other binaries.
自定义请求头 Forward headers to the target.
自定义 cookie Inject cookies into the request.
代理 Datacenter vs residential vs mobile.
地理定位 country parameter and supported locations.
提取规则 Return parsed JSON.
JSON 自动解析 auto_parser for JSON endpoints.
API 错误 Status codes and retry semantics.