爬取任务
On-Page 采用异步爬取模式:先提交任务,爬取完成后通过其他端点获取结果。
提交爬取任务
POST
/v3/on_page/task_post参考价:约 ¥0.0040 / 次(实际以请求返回为准)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| target | string | 是 | 目标域名,如 example.com |
| max_crawl_pages | integer | 否 | 最大爬取页数,默认 100 |
| max_crawl_depth | integer | 否 | 最大爬取深度 |
| load_resources | boolean | 否 | 是否加载 JS/CSS 资源 |
| enable_javascript | boolean | 否 | 是否执行 JavaScript |
curl
curl -X POST "https://api.seermartech.cn/v3/on_page/task_post" \
-H "Authorization: Bearer smt_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '[{"target": "example.com", "max_crawl_pages": 100, "max_crawl_depth": 3}]'Python
import requests
resp = requests.post(
"https://api.seermartech.cn/v3/on_page/task_post",
headers={"Authorization": "Bearer smt_live_YOUR_KEY"},
json=[{"target": "example.com", "max_crawl_pages": 100, "max_crawl_depth": 3}],
timeout=60,
)
task_id = resp.json()["tasks"][0]["id"]
print("task_id:", task_id)TypeScript
const resp = await fetch("https://api.seermartech.cn/v3/on_page/task_post", {
method: "POST",
headers: { Authorization: "Bearer smt_live_YOUR_KEY", "Content-Type": "application/json" },
body: JSON.stringify([{ target: "example.com", max_crawl_pages: 100, max_crawl_depth: 3 }]),
});
console.log("task_id:", (await resp.json()).tasks[0].id);即时单页分析
POST
/v3/on_page/instant_pages无需完整爬取,即时分析单个 URL 的 on-page SEO 指标。
curl -X POST "https://api.seermartech.cn/v3/on_page/instant_pages" \
-H "Authorization: Bearer smt_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '[{"url": "https://example.com/page", "enable_javascript": true}]'获取结果
任务完成后,使用 页面分析、资源分析、Lighthouse 端点,传入 id(task_id)拉取数据。
成本提示
100 页爬取 ≈ ¥0.40 起(按实际 cost),建议先用 max_crawl_pages: 20 试跑。