主题
通过任务 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 为任务唯一标识符。
| 参数 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识符,为 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 数组。
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本。 |
status_code | integer | 局响应状态码。完整状态码请参考错误码文档。 |
status_message | string | 局提示信息。 |
time | string | 接口执行耗时,例如 0.0518 sec.。 |
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 | SERP 结果数组。 |
data 字段
data 通常提交任务时的请求参数,例如:
| 字段 | 类型 | 说明 |
|---|---|---|
api | string | API 类型,例如 serp。 |
function | string | API 方法,例如 task_get。 |
se | string | 搜索引擎,例如 google。 |
se_type | string | 搜索结果类型,本接口为 events。 |
language_code | string | 语言代码。 |
location_name | string | 搜索地域名称。 |
keyword | string | 搜索。 |
device | string | 设备类型,例如 desktop。 |
os | string | 操作系统,例如 windows。 |
date_range | string | 活动日期范围,例如 today。 |
result 字段
基础结果字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | POST 请求中的。返回时会对 URL 编码进行解码,+ 会被解码为空格。 |
type | string | POST 请求中的搜索引擎类型。 |
se_domain | string | POST 请求中的搜索引擎域名。 |
location_code | integer | POST 请求中的地域代码。 |
language_code | string / null | 语言代码。本接口返回值为 null。 |
check_url | string | 搜索结果页的直接 URL。 |
datetime | string | 获取结果的日期和时间,采用 UTC 格式:yyyy-mm-dd hh-mm-ss +00:00。 |
spell | object | 搜索引擎自动纠错信息。 |
refinement_chips | object | 搜索细化选项。 |
item_types | array | SERP 中检测到的结果类型。本接口可能 event_item。 |
se_results_count | integer | SERP 结果总数。本接口固定返回 0,因为该搜索引擎不会提供结果总数。 |
items_count | integer | items 数组中的结果数量。 |
items | array | SERP 结果项数组。 |
spell 自动纠错
当搜索引擎对进行自动纠正并返回修正后的结果时,返回该对象。
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 搜索引擎纠正后的,结果将针对该提供。 |
type | string | 自动纠错类型。可选值:did_you_mean、showing_results_for、no_results_found_for、including_results_for。 |
refinement_chips 搜索细化选项
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 refinement_chips。 |
xpath | string | 素在页面中的 XPath。 |
items | array | 搜索细化项数组。 |
options | array | 进一步的搜索细化选项。 |
items 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 refinement_chips_element。 |
title | string | 素标题。 |
url | string | 带有细化参数的搜索 URL。 |
domain | string | SERP 中的域名。 |
options 字段
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 refinement_chips_option。 |
title | string | 选项标题。 |
url | string | 带有细化参数的搜索 URL。 |
domain | string | SERP 中的域名。 |
event_item 活动结果字段
items 数组中的活动结果使用以下结构:
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 event_item。 |
rank_group | integer | 组排名。在同一 type 的组进行排序,不同类型之间不会影响该字段。 |
rank_absolute | integer | SERP 中的绝对排名,即所有结果中的位置。 |
position | string | 素在 SERP 中的对齐位置,可选值:left、right。 |
xpath | string | 素在页面中的 XPath。 |
title | string | SERP 结果标题。 |
description | string | SERP 结果描述。 |
url | string | 结果 URL。 |
image_url | string | 结果中展示的图片 URL。 |
event_dates | object / null | 活动举办日期和时间。没有日期信息时返回 null。 |
location_info | object | 活动场地信息。 |
feature_id | string | SERP素的唯一标识符。 |
information_and_tickets | array | 活动和购票链接。 |
event_dates 活动日期
| 字段 | 类型 | 说明 |
|---|---|---|
start_datetime | string | 活动开始时间。若活动时区,使用 UTC 格式 yyyy-mm-ddThh-mm-ss+00:00;若未指定时区,则使用未明确时区的本地时间格式 yyyy-mm-ddThh-mm-ss。 |
end_datetime | string / null | 活动结束时间,格式规则与 start_datetime 相同。 |
displayed_dates | string | SERP 页面中展示的日期或日期范围。 |
示例:
text
2024-11-07T16:00:00
2024-11-07T16:00:00+00:00location_info 活动场地
| 字段 | 类型 | 说明 |
|---|---|---|
name | string | 活动场地名称。 |
address | string | 活动场地地址。 |
url | string | 活动场地在地图服务中的 URL。 |
cid | string | 地图服务定义的客户 ID,可用于调用 Google Reviews 接口获取评论列表。 |
feature_id | string | 活动场地在 SERP 中的唯一标识符。 |
information_and_tickets 信息与购票选项
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 素类型,固定为 information_and_tickets_element。 |
title | string | 信息或购票选项标题。 |
description | string | 信息或购票选项描述。 |
url | string | 或购票 URL。 |
domain | string | SERP 中的域名。 |
响应示例
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中的任务状态。
建议客户端同时处理以下:
- HTTP 请求失败;
- 顶层
status_code非20000; - 任务级
status_code非成功状态; result为空或缺失;- 结果字段为
null,例如没有结束时间或没有自动纠错信息。
沙盒测试
如需查看该端点可能返回的 SERP 特性和扩展字段,可使用本平台提供的沙盒环境。沙盒响应中的字段会使用模拟数据,调用沙盒接口不会产生费用。
实用场景
- 采集指定城市的活动搜索结果:按和地域获取活动标题、时间、场地及购票链接,支持本地活动类网站扩库。
- 监测活动类 SERP 曝位置:定期记录
rank_group和rank_absolute,评估活动页面在搜索结果中的排名变化。 - 构建活动聚合与日历服务:利用
event_dates和location_info统一整理演出、展览、会议等活动信息,为用户提供按日期和地点筛选的日历。 - 分析购票与信息来源:解析
information_and_tickets中的域名和链接,比较不同票务平台及信息站点在 SERP 中的出现。 - 挖掘本地活动机会:结合
refinement_chips和item_types识别用户搜索细分方向,为本地 SEO 页面和规划提供依据。