主题
通过任务 ID 获取 Google Autocomplete 高级结果
接口信息
HTTP 方法: GET
请求路径:
text
/v3/serp/google/autocomplete/task_get/advanced/$id通过任务 ID 获取 Google Autocomplete 高级结果。任务发布成功后,可在 30 天重复获取结果;获取已完成任务的结果不会产生额外费用。
计费说明
- 在提交任务时计费。
- 提交任务后,可在 30 天获取任务结果。
- 实扣费以响应头
X-SeerMarTech-Charge-CNY为准。
请求参数
请求路径中的 $id 替换为任务唯一标识。
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式。任务 ID 自生成之日起 30 天有效,可在有效期随时获取结果。 |
请求示例
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 = "02261816-2027-0066-0000-c27d02864073"
url = (
"https://api.seermartech.cn"
f"/v3/serp/google/autocomplete/task_get/advanced/{task_id}"
)
response = requests.get(
url,
headers={
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
},
)
data = response.json()
if data.get("status_code") == 20000:
print("任务结果:", data)
else:
print(
"请求失败,错误码:",
data.get("status_code"),
"错误信息:",
data.get("status_message"),
)TypeScript
typescript
import axios from "axios";
const taskId = "02231256-2604-0066-2000-57133b8fc54e";
axios
.get(
`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.response?.data || error.message);
});响应结构
接口返回 JSON 数据,顶层 tasks 数组。每个任务对象任务状态、请求参数和 Autocomplete 结果。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 请求级状态码。常见成功状态码为 20000。 |
status_message | string | 请求级状态说明。 |
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 范围。 |
status_message | string | 任务状态说明。 |
time | string | 任务执行耗时,单位为秒。 |
cost | float | 平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。 |
result_count | integer | result 数组中的数量。 |
path | array | 请求 URL 路径。 |
data | object | 创建任务时提交的参数。 |
result | array | 任务结果数组。 |
tasks[].data 字段
data 通常创建任务时提交的原始参数,例如搜索引擎、语言、地区、、客户端和设备等。
tasks[].result 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 创建任务时提交的。返回时会对编码进行解码,+ 会被解码为空格。 |
type | string | 创建任务时提交的搜索引擎类型。 |
se_domain | string | 创建任务时提交的搜索引擎域名。 |
location_code | integer | 创建任务时提交的地区代码。 |
language_code | string | 创建任务时提交的语言代码。 |
check_url | string | 对应搜索引擎结果页的直接 URL,可用于核验返回结果。 |
datetime | string | 获取结果的日期和时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2019-11-15 12:57:46 +00:00。 |
spell | object/null | 搜索引擎自动纠错信息。如果搜索引擎对进行了纠正,则返回纠正后的及纠错类型;未发生纠错时为 null。 |
refinement_chips | object/null | 搜索细化选项。 |
item_types | array | 当前搜索结果页中的结果类型。Autocomplete 高级接口的可用类型 autocomplete。 |
se_results_count | integer | 搜索结果页中的结果总数。 |
items_count | integer | items 数组中返回的结果数量。 |
items | array | 搜索结果页中的结果。 |
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.items.options 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 refinement_chips_option。 |
title | string | 细化选项标题。 |
url | string | 带细化参数的搜索 URL。 |
domain | string | 搜索结果中的域名。 |
items 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 autocomplete。 |
rank_group | integer | 素在相同 type素分组中的排名。不同类型之间的位置不会计此字段。 |
rank_absolute | integer | 素在整个搜索结果页中的绝对排名。 |
relevance | integer/null | 建议与目标的性,取值范围为 500 至 2000;数值越高表示性越强。以下客户端支持:chrome/chrome-omni。 |
suggestion | string | Google Autocomplete 返回的建议。 |
suggestion_type | string/null | Google Autocomplete 建议类型。以下客户端支持:chrome/chrome-omni。 |
search_query_url | string | 与该建议的搜索结果 URL。 |
thumbnail_url | string/null | 建议对应缩略图的 URL。以下客户端支持:gws-wiz、gws-wiz-serp。 |
highlighted | array/null | 搜索框中被高亮显示的建议列表。以下客户端支持:gws-wiz、psy-ab、gws-wiz-local。 |
响应示例
json
{
"version": "0.1.20240514",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0724 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "02261816-2027-0066-0000-c27d02864073",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.0412 sec.",
"cost": 0,
"result_count": 1,
"path": [
"v3",
"serp",
"google",
"autocomplete",
"task_get",
"advanced"
],
"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": [
{
"keyword": "albert einstein",
"type": "autocomplete",
"se_domain": "google.com",
"location_code": 2840,
"language_code": "en",
"check_url": "https://www.google.com/search?q=albert+einstein",
"datetime": "2019-11-15 12:57:46 +00:00",
"spell": null,
"refinement_chips": null,
"item_types": [
"autocomplete"
],
"se_results_count": 0,
"items_count": 3,
"items": [
{
"type": "autocomplete",
"rank_group": 1,
"rank_absolute": 1,
"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": 2,
"rank_absolute": 2,
"relevance": null,
"suggestion": "albert einstein quotes",
"suggestion_type": null,
"search_query_url": "https://www.google.com/search?q=albert+einstein+quotes",
"thumbnail_url": null,
"highlighted": null
},
{
"type": "autocomplete",
"rank_group": 3,
"rank_absolute": 3,
"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
}
]
}
]
}
]
}状态码与异常处理
- 顶层
status_code用于判断接口请求是否成功。 tasks[].status_code用于判断任务是否成功。- 建议同时检查
status_code、status_message以及result是否存在。 - 当任务状态码为错误状态,或
result为空时,应记录任务 ID 和错误信息,并根据业务需要重试或标记任务失败。 - 参考状态码范围:
10000至60000。
实用场景
- 扩展核心的长尾词库:批量获取 Google 自动补建议,发现用户真实搜索表达,用于选题和分组。
- 分析搜索意图:对不同地区、语言和客户端返回的建议进行对比,识别信息型、交易型和导航型搜索需求。
- 监测趋势变化:定期保存同一的自动补结果,发现新出现的品牌、产品或话题词。
- 构建搜索建议功能:将
suggestion、search_query_url和排名字段接站搜索或 SEO 工,为用户提供查询推荐。 - 评估建议词性:使用
relevance字段对自动补建议排序和筛选,优处理与目标词度更高的方向。