Lighthouse 审计
POST
/v3/on_page/lighthouse/live/json对指定 URL 运行 Lighthouse 审计,返回性能、可访问性、最佳实践、SEO 四项评分及详细指标。
参考价:约 ¥0.0640 / 次(实际以请求返回为准)
请求体
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| url | string | 是 | 目标 URL |
| for_mobile | boolean | 否 | 移动端模拟,默认 true |
请求示例
curl
curl -X POST "https://api.seermartech.cn/v3/on_page/lighthouse/live/json" \
-H "Authorization: Bearer smt_live_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '[{"url": "https://example.com", "for_mobile": true}]'Python
import requests
resp = requests.post(
"https://api.seermartech.cn/v3/on_page/lighthouse/live/json",
headers={"Authorization": "Bearer smt_live_YOUR_KEY"},
json=[{"url": "https://example.com", "for_mobile": True}],
timeout=120,
)
result = resp.json()["tasks"][0]["result"][0]
categories = result.get("categories", {})
for name, cat in categories.items():
print(name, cat.get("score"))TypeScript
const resp = await fetch("https://api.seermartech.cn/v3/on_page/lighthouse/live/json", {
method: "POST",
headers: { Authorization: "Bearer smt_live_YOUR_KEY", "Content-Type": "application/json" },
body: JSON.stringify([{ url: "https://example.com", for_mobile: true }]),
});
const result = (await resp.json()).tasks[0].result[0];
console.log(result.categories);响应评分
| 类别 | 说明 |
|---|---|
performance | 加载性能 |
accessibility | 可访问性 |
best-practices | 最佳实践 |
seo | SEO 基础项 |
业务场景
- 上线前核心页面 Lighthouse 门禁(如 performance > 80)
- 竞品页面性能对比