主题
按任务 ID 获取 WordPress v2 SERP 高级结果
GET /v3/serp/wp/v2/task_get/advanced/$id
通过任务 ID 获取已完成的 WordPress v2 SERP 高级结果。任务在创建时计费;任务完成后的 30 天,可重复获取结果。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
任务 ID 在创建任务时返回,采用 UUID 格式。请在任务创建后的 30 天查询结果。
请求
http
GET https://api.seermartech.cn/v3/serp/wp/v2/task_get/advanced/$id
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json路径参数
| 参数 | 类型 | 填 | 说明 |
|---|---|---|---|
id | string | 是 | 任务唯一标识符,UUID 格式。可在任务创建后 30 天用于获取结果。 |
请求示例
curl
bash
TASK_ID="02261816-2027-0066-0000-c27d02864073"
curl --location --request GET \
"https://api.seermartech.cn/v3/serp/wp/v2/task_get/advanced/${TASK_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/serp/wp/v2/task_get/advanced/{task_id}",
headers={
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
timeout=60
)
response.raise_for_status()
result = response.json()
# 检查整体请求状态
if result["status_code"] == 20000:
task = result["tasks"][0]
if task["status_code"] < 40000:
print(task["result"])
else:
print(f"任务错误:{task['status_code']} - {task['status_message']}")
else:
print(f"请求错误:{result['status_code']} - {result['status_message']}")TypeScript
typescript
import axios from "axios";
const taskId = "02261816-2027-0066-0000-c27d02864073";
async function getTaskResult() {
const response = await axios.get(
`https://api.seermartech.cn/v3/serp/wp/v2/task_get/advanced/${taskId}`,
{
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
}
);
const data = response.data;
// 检查整体请求状态
if (data.status_code !== 20000) {
throw new Error(`${data.status_code}: ${data.status_message}`);
}
const task = data.tasks?.[0];
// 检查单个任务状态
if (!task || task.status_code >= 40000) {
throw new Error(`${task?.status_code}: ${task?.status_message}`);
}
console.log(task.result);
}
getTaskResult().catch(console.error);沙箱测试
可使用以下沙箱地址查看本接口支持的结果及字段。沙箱返回模拟数据,不产生费用。
text
https://sandbox.seermartech.cn/v3/serp/google/images/task_get/advanced/00000000-0000-0000-0000-000000000000响应结构
接口返回 JSON 对象,顶层 tasks 数组。每个任务对象对应一次任务查询结果。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | API 当前版本。 |
status_code | integer | 整体请求状态码。完整状态码请参考错误码说明。 |
status_message | string | 整体请求状态信息。 |
time | string | 请求处理耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
tasks_count | integer | tasks 数组中的任务数量。 |
tasks_error | integer | tasks 数组中返回错误的任务数量。 |
tasks | array | 任务结果数组。 |
任务字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识符,UUID 格式。 |
status_code | integer | 单个任务状态码,通常位于 10000 至 60000 范围。 |
status_message | string | 单个任务状态信息。 |
time | string | 任务处理耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 当前请求的 URL 路径组成部分。 |
data | object | 创建任务时提交的原始参数。 |
result | array | SERP 结果数组。 |
data 字段
data 返回创建任务时使用的参数,常见字段如下:
| 字段 | 类型 | 说明 |
|---|---|---|
api | string | API 分类。 |
function | string | 请求功能,例如 task_get。 |
se | string | 搜索引擎标识。 |
se_type | string | 搜索类型。 |
keyword | string | 查询。URL 编码字符会被解码,+ 会转换为空格。 |
language_code | string | 语言代码。 |
location_code | integer | 地区代码。 |
device | string | 设备类型。 |
os | string | 操作系统。 |
result 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 用于查询的。 |
type | string | 创建任务时指定的搜索引擎类型。 |
se_domain | string | 搜索引擎域名。 |
location_code | integer | 地区代码。 |
language_code | string | 语言代码。 |
check_url | string | 搜索结果页直达链接,可用于人工核验结果。 |
datetime | string | 获取结果的 UTC 时间,格式为 yyyy-mm-dd hh:mm:ss +00:00。 |
spell | object | 搜索引擎自动纠错信息。未发生纠错时可能为空。 |
refinement_chips | object | 搜索结果页中的搜索细化标签。 |
item_types | array | SERP 中出现的结果类型。可能 carousel、images_search、related_searches。 |
se_results_count | integer | 搜索引擎返回的结果总数。 |
items_count | integer | items 数组中返回的结果数量。 |
items | array | SERP 结果数组。 |
spell 对象
当搜索引擎对进行了自动纠错时,接口会在 spell 中返回纠错信息。
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 搜索引擎纠正后的,结果基于该返回。 |
type | string | 自动纠错类型。 |
type 可取以下值:
did_you_mean:您是否想搜索。showing_results_for:正在显示纠正后的结果。no_results_found_for:未找到原结果。including_results_for:结果中纠错。
refinement_chips 对象
搜索细化标签用于表示搜索引擎提供的筛选条件。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips。 |
xpath | string | 素在结果页中的 XPath。 |
items | array | 搜索细化标签列表。 |
refinement_chips.items 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips_element。 |
title | string | 细化标签标题。 |
url | string | 携带细化条件的搜索 URL。 |
domain | string | 结果页所属域名。 |
options | array | 该细化标签下的进一步筛选选项。 |
refinement_chips.options 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 refinement_chips_option。 |
title | string | 筛选选项标题。 |
url | string | 携带筛选参数的搜索 URL。 |
domain | string | 结果页所属域名。 |
SERP素类型
items 数组中的对象通过 type 区分类型。
carousel:与图片轮播
用于表示与查询词的和图片轮播模块。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 carousel。 |
rank_group | integer | 同类型中的组排名。 |
rank_absolute | integer | 素在整个 SERP 中的绝对排名。 |
position | string | 素在页面中的对齐位置:left 或 right。 |
xpath | string | 素 XPath。 |
title | string | SERP 中的标题。 |
items | array | 与查询词的和图片条目。 |
rectangle | object | 素在 SERP 中的坐标和像素尺寸。当前该搜索类型不支持 calculate_rectangles,因此始终为 null。 |
carousel.items 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 carousel_element。 |
title | string | ,可用于进一步细化图片搜索。 |
subtitle | string | 素副标题。 |
image_url | string | 压缩后的特色图片地址。 |
rectangle | object | 图片区域信息。当前始终为 null。 |
images_search:图片搜索结果
表示单个图片搜索结果。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 images_search。 |
rank_group | integer | 同类型结果中的组排名。 |
rank_absolute | integer | 在整个 SERP 中的绝对排名。 |
xpath | string | 素 XPath。 |
title | string | 图片所在页面的标题。 |
subtitle | string | 结果副标题,通常为来源域名。 |
alt | string | 图片的 alt 文本。 |
url | string | 承载该图片的页面 URL。 |
source_url | string | 图片源文件 URL。 |
encoded_url | string | 搜索引擎服务器中缓存图片版本的 URL。 |
related_searches:搜索
表示 SERP 中的搜索模块。
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 related_searches。 |
rank_group | integer | 同类型中的组排名。 |
rank_absolute | integer | 在整个 SERP 中的绝对排名。 |
position | string | 素在页面中的对齐位置:left 或 right。 |
xpath | string | 素 XPath。 |
items | array | 模块中的附加条目;不存在时为 null。 |
rectangle | object | 素区域信息。当前该搜索类型不支持矩形坐标计算,因此始终为 null。 |
响应示例
json
{
"version": "0.1.20220627",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1245 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "02261816-2027-0066-0000-c27d02864073",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0921 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"serp",
"wp",
"v2",
"task_get",
"advanced",
"02261816-2027-0066-0000-c27d02864073"
],
"data": {
"api": "serp",
"function": "task_get",
"se": "google",
"se_type": "images",
"language_code": "en",
"location_code": 2840,
"keyword": "iphone wallpaper",
"device": "desktop",
"os": "windows"
},
"result": [
{
"keyword": "iphone wallpaper",
"type": "images",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.google.com/search?tbm=isch&q=iphone+wallpaper",
"datetime": "2022-06-27 12:57:46 +00:00",
"item_types": [
"carousel",
"images_search",
"related_searches"
],
"se_results_count": 0,
"items_count": 3,
"items": [
{
"type": "carousel",
"rank_group": 1,
"rank_absolute": 1,
"position": "left",
"xpath": "/body/div/c-wiz/div/div/c-wiz/scrolling-carousel/div",
"title": null,
"items": [
{
"type": "carousel_element",
"title": "aesthetic",
"subtitle": null,
"image_url": "https://example.com/image.jpg",
"rectangle": null
}
],
"rectangle": null
},
{
"type": "images_search",
"rank_group": 1,
"rank_absolute": 2,
"xpath": "/html/body/div/c-wiz/div/div/div/div/div/div/div/span/div/div",
"title": "50,000+ Best iPhone Wallpaper Photos",
"subtitle": "pexels.com",
"alt": "Best iPhone Wallpaper Photos",
"url": "https://www.pexels.com/search/iphone%20wallpaper/",
"source_url": "https://images.pexels.com/photos/example.jpg",
"encoded_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:example"
},
{
"type": "related_searches",
"rank_group": 1,
"rank_absolute": 25,
"position": "left",
"xpath": "/html/body/div/c-wiz/div/div/div/div/div/div/div/div/span/div/div",
"items": null,
"rectangle": null
}
]
}
]
}
]
}状态码与错误处理
建议同时检查顶层 status_code 和 tasks[].status_code:
20000:请求或任务处理成功。40000及以上:请求或任务处理失败,应读取对应的status_message并执行异常处理。- 任务尚未完成时,
result可能为空;请通过任务就绪接口确认任务状态后再获取结果。
在生产环境中,建议针对网络时、鉴权失败、任务 ID 无效、任务未完成及接口限流等设计重试与告警机制。
实用场景
- 监控图片搜索排名:定期获取目标下的图片结果、来源页面与绝对排名,评估图片 SEO 可见度变化。
- 分析竞品图片来源:提取
url、source_url和subtitle,识别在图片搜索中占据靠前位置的竞品域名与页面。 - 挖掘图片选题:利用轮播、搜索和搜索细化标签,扩展长尾图片与专题页面选题。
- 审核图片素材落地页:根据图片结果的标题、
alt文本和承载页面 URL,检查品牌素材是否被正确索引及展示。 - 构建视觉搜索报库:按、地区、语言和设备归档图片 SERP 快,为策略和行业趋势分析提供历史数据。