Skip to content

通过任务 ID 获取 Google Autocomplete 高级结果

接口信息

HTTP 方法: GET
请求路径:

text
/v3/serp/google/autocomplete/task_get/advanced/$id

通过任务 ID 获取 Google Autocomplete 高级结果。任务发布成功后,可在 30 天重复获取结果;获取已完成任务的结果不会产生额外费用。

计费说明

  • 在提交任务时计费。
  • 提交任务后,可在 30 天获取任务结果。
  • 实扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

请求路径中的 $id 替换为任务唯一标识。

参数类型说明
idstring任务唯一标识,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 结果。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger请求级状态码。常见成功状态码为 20000
status_messagestring请求级状态说明。
timestring接口执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
tasks_countintegertasks 数组中的任务数量。
tasks_errorintegertasks 数组中返回错误的任务数量。
tasksarray任务结果数组。

tasks 任务字段

字段类型说明
idstring任务唯一标识,UUID 格式。
status_codeinteger任务状态码,通常处于 1000060000 范围。
status_messagestring任务状态说明。
timestring任务执行耗时,单位为秒。
costfloat平台原始 USD 成本兼容字段;人民币实扣以 X-SeerMarTech-Charge-CNY 为准。
result_countintegerresult 数组中的数量。
patharray请求 URL 路径。
dataobject创建任务时提交的参数。
resultarray任务结果数组。

tasks[].data 字段

data 通常创建任务时提交的原始参数,例如搜索引擎、语言、地区、、客户端和设备等。

tasks[].result 字段

字段类型说明
keywordstring创建任务时提交的。返回时会对编码进行解码,+ 会被解码为空格。
typestring创建任务时提交的搜索引擎类型。
se_domainstring创建任务时提交的搜索引擎域名。
location_codeinteger创建任务时提交的地区代码。
language_codestring创建任务时提交的语言代码。
check_urlstring对应搜索引擎结果页的直接 URL,可用于核验返回结果。
datetimestring获取结果的日期和时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。示例:2019-11-15 12:57:46 +00:00
spellobject/null搜索引擎自动纠错信息。如果搜索引擎对进行了纠正,则返回纠正后的及纠错类型;未发生纠错时为 null
refinement_chipsobject/null搜索细化选项。
item_typesarray当前搜索结果页中的结果类型。Autocomplete 高级接口的可用类型 autocomplete
se_results_countinteger搜索结果页中的结果总数。
items_countintegeritems 数组中返回的结果数量。
itemsarray搜索结果页中的结果。

refinement_chips 字段

字段类型说明
typestring素类型,固定为 refinement_chips
xpathstring素在页面中的 XPath。
itemsarray搜索细化选项数组。

refinement_chips.items 字段

字段类型说明
typestring素类型,固定为 refinement_chips_element
titlestring细化选项标题。
urlstring带细化参数的搜索 URL。
domainstring搜索结果中的域名。
optionsarray进一步的搜索细化选项。

refinement_chips.items.options 字段

字段类型说明
typestring素类型,固定为 refinement_chips_option
titlestring细化选项标题。
urlstring带细化参数的搜索 URL。
domainstring搜索结果中的域名。

items 字段

字段类型说明
typestring素类型,固定为 autocomplete
rank_groupinteger素在相同 type素分组中的排名。不同类型之间的位置不会计此字段。
rank_absoluteinteger素在整个搜索结果页中的绝对排名。
relevanceinteger/null建议与目标的性,取值范围为 5002000;数值越高表示性越强。以下客户端支持:chrome/chrome-omni
suggestionstringGoogle Autocomplete 返回的建议。
suggestion_typestring/nullGoogle Autocomplete 建议类型。以下客户端支持:chrome/chrome-omni
search_query_urlstring与该建议的搜索结果 URL。
thumbnail_urlstring/null建议对应缩略图的 URL。以下客户端支持:gws-wizgws-wiz-serp
highlightedarray/null搜索框中被高亮显示的建议列表。以下客户端支持:gws-wizpsy-abgws-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_codestatus_message 以及 result 是否存在。
  • 当任务状态码为错误状态,或 result 为空时,应记录任务 ID 和错误信息,并根据业务需要重试或标记任务失败。
  • 参考状态码范围:1000060000

实用场景

  • 扩展核心的长尾词库:批量获取 Google 自动补建议,发现用户真实搜索表达,用于选题和分组。
  • 分析搜索意图:对不同地区、语言和客户端返回的建议进行对比,识别信息型、交易型和导航型搜索需求。
  • 监测趋势变化:定期保存同一的自动补结果,发现新出现的品牌、产品或话题词。
  • 构建搜索建议功能:将 suggestionsearch_query_url 和排名字段接站搜索或 SEO 工,为用户提供查询推荐。
  • 评估建议词性:使用 relevance 字段对自动补建议排序和筛选,优处理与目标词度更高的方向。

统一入口:官网 · LLM API · 控制台