主题
获取 LLM Scraper HTML 结果
接口说明
用于按任务 ID 获取已完成的 LLM Scraper HTML 抓取结果。
请求方式: GET请求地址:
https://api.seermartech.cn/v3/ai_optimization/wp/v2/task_get/html/$id
$id 为任务唯一标识。
计费说明
该接口本身不会重复扣费。费用只在创建任务时产生,任务结果可在提交后的 7 天获取。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
路径参数
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID,UUID 格式的唯一标识。可在任务创建后的 7 天 随时用于获取结果。 |
响应结构
接口返回 JSON 数据,顶层 tasks 数组,用于表示本次返回的任务结果。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 接口级状态码。完整列表参考 /v3/appendix/errors。建议为异常状态设计完善的处理机制。 |
status_message | string | 接口级状态说明。完整列表参考 /v3/appendix/errors。 |
time | string | 请求执行耗时,单位秒。 |
cost | float | 本次请求成本,单位 USD。对于结果查询通常为 0。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务 ID,UUID 格式。 |
status_code | integer | 任务级状态码,范围通常为 10000-60000。完整列表参考 /v3/appendix/errors。 |
status_message | string | 任务级状态说明。 |
time | string | 任务执行耗时,单位秒。 |
cost | float | 该任务成本,单位 USD。 |
result_count | integer | result 数组中的结果数量。 |
path | array | 请求路径信息。 |
data | object | 与创建任务时 POST 请求中传的参数一致。 |
result | array | 任务结果数组。 |
result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时传的。返回时会对 %## 进行解码,+ 会被还原为空格。 |
location_code | integer | 创建任务时使用的地区代码。 |
language_code | string | 创建任务时使用的语言代码。 |
datetime | string | 结果生成时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
items_count | integer | items 数组中的结果数量。 |
items | array | 抓取到的 HTML 页面结果列表。 |
items[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
page | integer | 返回的 HTML 页序号。 |
date | string | HTML 页面抓取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
html | string | 抓取到的 HTML 原文。 |
调用示例
curl
bash
id="02261816-2027-0066-0000-c27d02864073"
curl --location --request GET "https://api.seermartech.cn/v3/ai_optimization/wp/v2/task_get/html/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
task_id = "02201650-1073-0066-2000-1d132bb28897"
url = f"https://api.seermartech.cn/v3/ai_optimization/wp/v2/task_get/html/{task_id}"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json)TypeScript
typescript
import axios from "axios";
const taskId = "02201650-1073-0066-2000-1d132bb28897";
axios({
method: "get",
url: `https://api.seermartech.cn/v3/ai_optimization/wp/v2/task_get/html/${taskId}`,
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
})
.then((response) => {
// 输出返回结果
console.log(response.data);
})
.catch((error) => {
console.error(error);
});结合 tasks_ready 获取已完成任务
在使用中,通常调用:
GET /v3/ai_optimization/wp/v2/tasks_ready
获取已完成任务列表,再根据返回的任务 ID 或 endpoint_html 地址调用:
GET /v3/ai_optimization/wp/v2/task_get/html/$id
来拉取 HTML 结果。
响应示例
json
{
"version": "0.1.20200129",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.3212 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "02201650-1073-0066-2000-1d132bb28897",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.021 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"ai_optimization",
"wp",
"v2",
"task_get",
"html"
],
"data": {
"api": "ai_optimization",
"function": "task_get",
"se": "wp",
"se_type": "v2",
"language_name": "English",
"location_code": 2840,
"keyword": "albert einstein",
"tag": "tag1",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "albert einstein",
"location_code": 2840,
"language_code": "en",
"datetime": "2019-11-15 12:57:46 +00:00",
"items_count": 1,
"items": [
{
"page": 1,
"date": "2019-11-15 12:57:46 +00:00",
"html": "<html>...</html>"
}
]
}
]
}
]
}状态码与错误处理
- 顶层
status_code表示接口整体执行状态。 tasks[].status_code表示任务状态。- 建议同时检查:
- 顶层
status_code是否为20000 tasks_error是否为0tasks[].result是否存在且非空
常见处理建议:
| 场景 | 建议 |
|---|---|
顶层 status_code 非 20000 | 按接口级错误处理,请求可能未成功执行。 |
tasks[].status_code 为错误码 | 按任务级错误处理,记录任务 ID 便于重试或排查。 |
result 为空 | 任务可能尚未完成、结果已过期,或请求的任务 ID 无效。 |
| 过 7 天后查询 | 结果可能不可再获取,建议重新创建任务。 |
使用建议
- 提交抓取任务后,通过
/v3/ai_optimization/wp/v2/tasks_ready轮询已完成任务。 - 拿到任务 ID 后,调用本接口获取 HTML。
- 将
html原文库,便于后续做页面结构分析、AI 摘要对比、抽取或审计。 - 若需要多页结果,请遍历
items数组并按page字段处理。
实用场景
- 抓取 LLM 结果页原始 HTML,用于保留页面快,便于后续做追溯与取证。
- 比对 不同下的 HTML 结构差异,识别页面模块变化对可见性分析的影响。
- 抽取 页面中的链接、标题、摘要等,为 SEO 监测和分析提供底层数据。
- 存档 指定时间点的页面 HTML,支持竞品监控、版本回溯和异常排查。
- 校验 AI 抓取结果是否完整落库,帮助数据团队提升任务调度与结果消费的稳定性。