主题
获取 ChatGPT LLM Scraper HTML 结果
GET /v3/appendix/errors
接口说明
本接口使用 GET 方法,通过任务 ID 获取 ChatGPT LLM Scraper 任务返回的 HTML。
请求方法与路径:
http
GET https://api.seermartech.cn/v3/ai_optimization/wp/v2/task_get/html/$id任务提交成功后,可在 7 天使用任务 ID 查询结果。查询已提交任务不会重复收取任务费用,扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求参数
任务 ID 作为 URL 路径参数传。
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
id | string | 是 | 任务唯一标识,UUID 格式。任务提交后,可在 7 天使用该 ID 查询任务结果。 |
请求示例
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 = "02261816-2027-0066-0000-c27d02864073"
response = requests.get(
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.raise_for_status()
data = response.json()
print(data)TypeScript
typescript
import axios from "axios";
const taskId = "02201650-1073-0066-2000-1d132bb28897";
axios
.get(
`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.response?.data || error.message);
});响应说明
接口返回 JSON 对象 tasks 数组。数组中的每个对应一个任务及执行结果。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 顶层响应状态码。完整状态码列表请参考 /v3/appendix/errors。建议客户端对异常和错误进行统一处理。 |
status_message | string | 顶层响应说明。完整消息列表请参考 /v3/appendix/errors。 |
time | string | 接口执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
tasks 数组
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。 |
status_code | integer | 任务状态码,通常在 10000 至 60000 范围。完整状态码列表请参考 /v3/appendix/errors。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 请求 URL 路径信息。 |
data | object | 创建任务时提交的参数。 |
result | array | 任务执行结果数组。 |
result 数组
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时提交的。返回时会对编码后的 %## 进行解码, plus 符号(+)会被解码为空格。 |
location_code | integer | 创建任务时提交的地区代码。 |
language_code | string | 创建任务时提交的语言代码。 |
datetime | string | 获取结果的日期和时间,使用 UTC 格式:yyyy-MM-dd HH-mm-ss +00:00。 |
items_count | integer | items 数组中的结果数量。 |
items | array | 抓取到的页面结果数组。 |
items 数组
| 字段 | 类型 | 说明 |
|---|---|---|
page | integer | 返回的 HTML 页面序号。 |
date | string | HTML 页面扫描时间,使用 UTC 格式:yyyy-MM-dd HH-mm-ss +00:00。 |
html | string | 抓取到的 HTML 页面。 |
UTC 时间示例:
text
2019-11-15 12:57:46 +00:00响应示例
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": "02261816-2027-0066-0000-c27d02864073",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.2800 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>"
}
]
}
]
}
]
}任务结果获取流程
通常可以调用任务列表接口获取已完成任务,再根据返回的任务 ID 获取 HTML 结果:
text
1. GET /v3/ai_optimization/wp/v2/tasks_ready
2. GET /v3/ai_optimization/wp/v2/task_get/html/$id也可以直接使用已保存的任务 ID 调用本接口。
当任务尚未完成、任务 ID 不存在或任务已 7 天有效期时,请根据 status_code 和 status_message 判断原因。
错误处理
建议至少检查以下字段:
- 顶层
status_code - 任务级
tasks[].status_code - 顶层及任务级
status_message tasks_errorresult是否为空
完整响应状态码和说明请参考:
text
/v3/appendix/errors实用场景
- 获取搜索结果页面 HTML:批量保存指定和地区对应的页面,用于 SEO 页面结构、标题和数据分析。
- 解析竞品页面结构:提取竞品页面的 HTML,分析层级、结构化数据和页面模板,制定优化方案。
- 构建采集流程:结合任务提交接口和任务结果查询接口,批量获取对应页面,支持定期 SEO 数据采集。
- 监测页面变化:按周期保存同一的 HTML 结果,通过版本对比发现标题、正文、链接和页面结构变化。
- 生成网页审计数据:将返回的 HTML 交给解析程序,提取页面并建立 SEO 技术审计指标。