Skip to content

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

本接口使用 GET 方法,通过任务 ID 获取 Google Events SERP 高级结果:

GET https://api.seermartech.cn/v3/serp/google/events/task_get/advanced/$id

任务结果可在任务提交后的 30 天重复获取,获取结果本身不额外计费。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。

请求参数

接口路径中的 $id 为任务唯一标识符。

参数类型说明
idstring任务唯一标识符,为 UUID 格式。任务提交后 30 天可使用该 ID 随时获取结果。

认证方式

请求携带以下认证头:

http
Authorization: Bearer smt_live_YOUR_KEY
Content-Type: application/json

请求示例

cURL

bash
id="02261816-2027-0066-0000-c27d02864073"

curl --location --request GET \
  "https://api.seermartech.cn/v3/serp/google/events/task_get/advanced/${id}" \
  --header "Authorization: Bearer smt_live_YOUR_KEY" \
  --header "Content-Type: application/json"

TypeScript

typescript
import axios from "axios";

const taskId = "02231256-2604-0066-2000-57133b8fc54e";

axios
  .get(
    `https://api.seermartech.cn/v3/serp/google/events/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);
  });

Python

python
import requests

task_id = "02261816-2027-0066-0000-c27d02864073"
url = (
    "https://api.seermartech.cn/v3/serp/google/events/"
    f"task_get/advanced/{task_id}"
)

response = requests.get(
    url,
    headers={
        "Authorization": "Bearer smt_live_YOUR_KEY",
        "Content-Type": "application/json",
    },
)

if response.ok:
    result = response.json()
    print(result)
else:
    print(f"请求失败:HTTP {response.status_code}")
    print(response.text)

响应结构

接口返回 JSON 数据,顶层 tasks 数组。

顶层字段

字段类型说明
versionstring当前 API 版本。
status_codeinteger局响应状态码。完整状态码请参考错误码文档。
status_messagestring局提示信息。
timestring接口执行耗时,例如 0.0518 sec.
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提交任务时使用的参数。
resultarraySERP 结果数组。

data 字段

data 通常提交任务时的请求参数,例如:

字段类型说明
apistringAPI 类型,例如 serp
functionstringAPI 方法,例如 task_get
sestring搜索引擎,例如 google
se_typestring搜索结果类型,本接口为 events
language_codestring语言代码。
location_namestring搜索地域名称。
keywordstring搜索。
devicestring设备类型,例如 desktop
osstring操作系统,例如 windows
date_rangestring活动日期范围,例如 today

result 字段

基础结果字段

字段类型说明
keywordstringPOST 请求中的。返回时会对 URL 编码进行解码,+ 会被解码为空格。
typestringPOST 请求中的搜索引擎类型。
se_domainstringPOST 请求中的搜索引擎域名。
location_codeintegerPOST 请求中的地域代码。
language_codestring / null语言代码。本接口返回值为 null
check_urlstring搜索结果页的直接 URL。
datetimestring获取结果的日期和时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00
spellobject搜索引擎自动纠错信息。
refinement_chipsobject搜索细化选项。
item_typesarraySERP 中检测到的结果类型。本接口可能 event_item
se_results_countintegerSERP 结果总数。本接口固定返回 0,因为该搜索引擎不会提供结果总数。
items_countintegeritems 数组中的结果数量。
itemsarraySERP 结果项数组。

spell 自动纠错

当搜索引擎对进行自动纠正并返回修正后的结果时,返回该对象。

字段类型说明
keywordstring搜索引擎纠正后的,结果将针对该提供。
typestring自动纠错类型。可选值:did_you_meanshowing_results_forno_results_found_forincluding_results_for

refinement_chips 搜索细化选项

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

items 字段

字段类型说明
typestring素类型,固定为 refinement_chips_element
titlestring素标题。
urlstring带有细化参数的搜索 URL。
domainstringSERP 中的域名。

options 字段

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

event_item 活动结果字段

items 数组中的活动结果使用以下结构:

字段类型说明
typestring素类型,固定为 event_item
rank_groupinteger组排名。在同一 type 的组进行排序,不同类型之间不会影响该字段。
rank_absoluteintegerSERP 中的绝对排名,即所有结果中的位置。
positionstring素在 SERP 中的对齐位置,可选值:leftright
xpathstring素在页面中的 XPath。
titlestringSERP 结果标题。
descriptionstringSERP 结果描述。
urlstring结果 URL。
image_urlstring结果中展示的图片 URL。
event_datesobject / null活动举办日期和时间。没有日期信息时返回 null
location_infoobject活动场地信息。
feature_idstringSERP素的唯一标识符。
information_and_ticketsarray活动和购票链接。

event_dates 活动日期

字段类型说明
start_datetimestring活动开始时间。若活动时区,使用 UTC 格式 yyyy-mm-ddThh-mm-ss+00:00;若未指定时区,则使用未明确时区的本地时间格式 yyyy-mm-ddThh-mm-ss
end_datetimestring / null活动结束时间,格式规则与 start_datetime 相同。
displayed_datesstringSERP 页面中展示的日期或日期范围。

示例:

text
2024-11-07T16:00:00
2024-11-07T16:00:00+00:00

location_info 活动场地

字段类型说明
namestring活动场地名称。
addressstring活动场地地址。
urlstring活动场地在地图服务中的 URL。
cidstring地图服务定义的客户 ID,可用于调用 Google Reviews 接口获取评论列表。
feature_idstring活动场地在 SERP 中的唯一标识符。

information_and_tickets 信息与购票选项

字段类型说明
typestring素类型,固定为 information_and_tickets_element
titlestring信息或购票选项标题。
descriptionstring信息或购票选项描述。
urlstring或购票 URL。
domainstringSERP 中的域名。

响应示例

json
{
  "version": "0.1.20241101",
  "status_code": 20000,
  "status_message": "Ok.",
  "time": "0.0518 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",
        "events",
        "task_get",
        "advanced"
      ],
      "data": {
        "api": "serp",
        "function": "task_get",
        "se": "google",
        "se_type": "events",
        "language_code": "en",
        "location_name": "Los Angeles,California,United States",
        "keyword": "concerts",
        "device": "desktop",
        "os": "windows",
        "date_range": "today"
      },
      "result": [
        {
          "keyword": "concerts",
          "type": "events",
          "se_domain": "google.com",
          "location_code": 1000,
          "language_code": null,
          "check_url": "https://www.google.com/search?q=concerts",
          "datetime": "2024-11-07 12:00:00 +00:00",
          "spell": null,
          "refinement_chips": null,
          "item_types": [
            "event_item"
          ],
          "se_results_count": 0,
          "items_count": 1,
          "items": [
            {
              "type": "event_item",
              "rank_group": 1,
              "rank_absolute": 1,
              "position": "right",
              "xpath": "/html/body/div/div/div/div/div/div/div/ul/li",
              "title": "USC Thornton Winds Concert",
              "description": "USC Thornton Winds Concert | Opera | Cast and Crew | Performances, schedule and tickets",
              "url": "https://www.operabase.com/productions/usc-thornton-winds-concert-288717/en",
              "image_url": "https://api.seermartech.cn/cdn/i/example-image:0",
              "event_dates": {
                "start_datetime": "2024-11-07T16:00:00",
                "end_datetime": null,
                "displayed_dates": "Thu, Nov 7, 4 PM"
              },
              "location_info": {
                "name": "Bovard Auditorium",
                "address": "Bovard Administration Building, Los Angeles, CA",
                "url": "https://www.google.com/maps/",
                "cid": "4669174282059921205",
                "feature_id": "0x80c2c7e19c55535f:0x40cc3d456c923735"
              },
              "information_and_tickets": [
                {
                  "type": "information_and_tickets_element",
                  "title": "查看与购票",
                  "description": "活动及购票信息",
                  "url": "https://www.operabase.com/",
                  "domain": "operabase.com"
                }
              ],
              "feature_id": "0x80c2c7e19c55535f:0x40cc3d456c923735"
            }
          ]
        }
      ]
    }
  ]
}

状态码与异常处理

请根据顶层 status_code 和任务级别的 status_code 判断请求是否成功:

  • 20000:请求成功。
  • 40000 及以上:任务或请求处理失败,应结合 status_message 记录原因。
  • tasks_error 大于 0:表示部分任务返回错误,需要逐项检查 tasks 中的任务状态。

建议客户端同时处理以下:

  1. HTTP 请求失败;
  2. 顶层 status_code20000
  3. 任务级 status_code 非成功状态;
  4. result 为空或缺失;
  5. 结果字段为 null,例如没有结束时间或没有自动纠错信息。

沙盒测试

如需查看该端点可能返回的 SERP 特性和扩展字段,可使用本平台提供的沙盒环境。沙盒响应中的字段会使用模拟数据,调用沙盒接口不会产生费用。

实用场景

  • 采集指定城市的活动搜索结果:按和地域获取活动标题、时间、场地及购票链接,支持本地活动类网站扩库。
  • 监测活动类 SERP 曝位置:定期记录 rank_grouprank_absolute,评估活动页面在搜索结果中的排名变化。
  • 构建活动聚合与日历服务:利用 event_dateslocation_info 统一整理演出、展览、会议等活动信息,为用户提供按日期和地点筛选的日历。
  • 分析购票与信息来源:解析 information_and_tickets 中的域名和链接,比较不同票务平台及信息站点在 SERP 中的出现。
  • 挖掘本地活动机会:结合 refinement_chipsitem_types 识别用户搜索细分方向,为本地 SEO 页面和规划提供依据。

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