主题
获取 Google Autocomplete 高级结果(按任务 ID)
通过本接口可根据任务 id 获取 Google Autocomplete 的高级结果。
接口说明
- 请求方式:
GET - 请求地址:
https://api.seermartech.cn/v3/serp/google/autocomplete/task_get/advanced/$id
计费说明
本接口本身不单独收费,在创建任务时计费。任务提交成功后,可在 30 天 多次获取结果。
扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。该 ID 可在任务创建后的 30 天 用于随时获取结果。 |
返回结果说明
接口返回 JSON 数据,顶层 tasks 数组,每个任务项中对应获取结果。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码,完整错误码请参考错误码文档 |
status_message | string | 通用状态信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总成本,单位 USD |
tasks_count | integer | tasks 数组中的任务数 |
tasks_error | integer | tasks 数组中返回错误的任务数 |
tasks | array | 任务结果数组 |
tasks[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000 |
status_message | string | 任务状态信息 |
time | string | 任务执行耗时,单位秒 |
cost | float | 任务成本,单位 USD |
result_count | integer | result 数组中的结果数 |
path | array | URL 路径 |
data | object | 与创建任务时 POST 请求中传的参数一致 |
result | array | 获取结果数组 |
result[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时的。返回时会对 %## 进行解码,+ 会被解码为空格 |
type | string | POST 请求中的搜索引擎类型 |
se_domain | string | POST 请求中的搜索引擎域名 |
location_code | integer | POST 请求中的地区代码 |
language_code | string | POST 请求中的语言代码 |
check_url | string | 搜索引擎结果直达链接,可用于人工核验结果准确性 |
datetime | string | 结果抓取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00 |
spell | object | 搜索引擎自动纠错信息;如果搜索词被纠正,这里会返回纠正后的及纠错类型,否则为 null |
refinement_chips | object | 搜索细化标签信息 |
item_types | array | 当前 SERP 中出现的结果类型列表。该端点可能返回:autocomplete |
se_results_count | integer | SERP 结果总数 |
items_count | integer | items 数组中的数量 |
items | array | Autocomplete 结果明细 |
refinement_chips 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 refinement_chips |
xpath | string | 素的 XPath |
items | array | 细化标签列表 |
refinement_chips.items[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 refinement_chips_element |
title | string | 标签标题 |
url | string | 带细化参数的搜索链接 |
domain | string | SERP 中的域名 |
options | array | 进一步细化选项 |
refinement_chips.items[].options[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 refinement_chips_option |
title | string | 选项标题 |
url | string | 带细化参数的搜索链接 |
domain | string | SERP 中的域名 |
items[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 autocomplete |
rank_group | integer | 同类型的分组排名 |
rank_absolute | integer | 该在整个 SERP 中的绝对排名 |
relevance | integer | 建议词与目标的度,取值范围 500 到 2000,值越大表示度越高。在 client 为 chrome/chrome-omni 时返回 |
suggestion | string | Google Autocomplete 建议词 |
suggestion_type | string | 建议词类型。在 client 为 chrome/chrome-omni 时返回 |
search_query_url | string | 对应建议词的搜索结果页链接 |
thumbnail_url | string | 缩略图链接。在 client 为 gws-wiz 或 gws-wiz-serp 时返回 |
highlighted | array | 搜索框中被高亮的建议词片段。在 client 为 gws-wiz、psy-ab、gws-wiz-local 时返回 |
沙箱调试
可使用沙箱地址查看该端点可能返回的字段结构,字段值为模拟数据,不会产生费用。
https://sandbox.seermartech.cn/v3/serp/google/autocomplete/task_get/advanced/00000000-0000-0000-0000-000000000000
请求示例
curl
bash
id="02261816-2027-0066-0000-c27d02864073"
curl --location --request GET "https://api.seermartech.cn/v3/serp/google/autocomplete/task_get/advanced/${id}" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
task_id = "02231256-2604-0066-2000-57133b8fc54e"
url = f"https://api.seermartech.cn/v3/serp/google/autocomplete/task_get/advanced/{task_id}"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.get(url, headers=headers)
data = response.json
print(data)TypeScript
typescript
import axios from "axios";
const taskId = "02231256-2604-0066-2000-57133b8fc54e";
axios({
method: "get",
url: `https://api.seermartech.cn/v3/serp/google/autocomplete/task_get/advanced/${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 批量获取结果
使用中,通常请求已完成任务列表,再按任务 ID 拉取高级结果。
Python
python
import requests
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
# 1. 获取已完成任务列表
ready_url = "https://api.seermartech.cn/v3/serp/google/autocomplete/tasks_ready"
ready_resp = requests.get(ready_url, headers=headers)
ready_data = ready_resp.json
results = []
if ready_data.get("status_code") == 20000:
for task_group in ready_data.get("tasks", []):
for task_info in task_group.get("result", []) or []:
endpoint = task_info.get("endpoint_advanced")
task_id = task_info.get("id")
# 2. 直接使用返回的高级结果地址
if endpoint:
r = requests.get(f"https://api.seermartech.cn{endpoint}", headers=headers)
results.append(r.json)
# 3. 或使用任务 ID 重新拼接查询地址
# if task_id:
# r = requests.get(
# f"https://api.seermartech.cn/v3/serp/google/autocomplete/task_get/advanced/{task_id}",
# headers=headers
# )
# results.append(r.json)
print(results)响应示例
json
{
"version": "0.1.20240514",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0724 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"se_type": "autocomplete",
"se": "google",
"api": "serp",
"function": "task_get",
"language_code": "en",
"location_code": 2840,
"keyword": "albert einstein",
"client": "gws-wiz-serp",
"device": "desktop",
"os": "windows"
},
"result": [
{
"se_results_count": 0,
"items_count": 10,
"items": [
{
"type": "autocomplete",
"rank_group": 4,
"rank_absolute": 4,
"relevance": null,
"suggestion": "albert einstein death",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+death",
"thumbnail_url": null,
"highlighted": null
},
{
"type": "autocomplete",
"rank_group": 5,
"rank_absolute": 5,
"relevance": null,
"suggestion": "albert einstein quotes",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+quotes",
"thumbnail_url": "http://t0.gstatic.com/images?q=tbn:ANd9GcRnmMaYbKfIi4s248o1yaRqUZUCsaoJxjiS4BA_s2d8h-WKhBkVbPU98CW-Xw&s=10",
"highlighted": null
},
{
"type": "autocomplete",
"rank_group": 6,
"rank_absolute": 6,
"relevance": null,
"suggestion": "albert einstein news",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+news",
"thumbnail_url": null,
"highlighted": null
},
{
"type": "autocomplete",
"rank_group": 7,
"rank_absolute": 7,
"relevance": null,
"suggestion": "albert einstein wife",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+wife",
"thumbnail_url": null,
"highlighted": null
},
{
"type": "autocomplete",
"rank_group": 8,
"rank_absolute": 8,
"relevance": null,
"suggestion": "albert einstein brain",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+brain",
"thumbnail_url": null,
"highlighted": null
},
{
"type": "autocomplete",
"rank_group": 9,
"rank_absolute": 9,
"relevance": null,
"suggestion": "albert einstein inventions",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+inventions",
"thumbnail_url": null,
"highlighted": null
},
{
"type": "autocomplete",
"rank_group": 10,
"rank_absolute": 10,
"relevance": null,
"suggestion": "albert einstein hospital",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+hospital",
"thumbnail_url": null,
"highlighted": null
}
]
}
]
}
]
}状态码与异常处理
status_code表示接口或任务执行状态。- 建议同时检查顶层
status_code与tasks[].status_code。 - 如
tasks[].status_code >= 40000,通常表示任务级错误,应结合status_message做异常处理。 - 建议为任务结果轮询、空结果、字段缺失、任务过期等设计完整容错机制。
使用说明
- 该接口适用于查询已经提交且已完成的 Autocomplete 任务结果。
- 如任务尚未完成,建议调用
/v3/serp/google/autocomplete/tasks_ready获取可读取的任务列表。 - 结果保留期为 30 天,期限后可能无法再次获取。
- 某些字段在特定
client下返回,接时应按返回值做容处理。
实用场景
- 挖掘长尾词:获取目标的自动补建议,扩选题库与 SEO 词库覆盖面。
- 识别搜索意图分支:根据
suggestion、highlighted和refinement_chips分析用户常见搜索延伸方向,分层与专题页规划。 - 监控热点联想变化:定期按拉取 Autocomplete 结果,观察建议词变动,及时发现新趋势与突发热点。
- 优化广告与落地页词:将高建议词补到投放词、标题和落地页文案中,提高流量匹度。
- 验证多地区多语言差异:结合
location_code与language_code对比不同市场下的联想词差异,支持化 SEO 与本地化策略。