主题
Google 历史 SERP 实时查询
接口概述
/v3/dataforseo_labs/google/historical_serps/live 用于获取指定在指定地区、语言与时间范围采集到的 Google 历史搜索结果页(SERP)。
除常规自然结果外,本接口还会返回当期 SERP 中出现的精选摘要、知识图谱、People Also Ask、图片、视频、地图、本地、购物、AI Overview 等扩展结果,便于分析:
- 排名随时间的变化趋势
- SERP 版式变化
- 特殊搜索结果的出现与消失
- 竞争页面的历史
历史数据最长可追溯 12 个月。
请求信息
- 方法:
POST - 地址:
https://api.seermartech.cn/v3/dataforseo_labs/google/historical_serps/live - Content-Type:
application/json - Authorization:
Bearer smt_live_YOUR_KEY
计费与调用限制
本接口按请求计费。
- 参考价:以响应中的
cost字段为准 - 如需估算,可按成本(USD)换算为人民币;扣费以响应头
X-SeerMarTech-Charge-CNY为准
调用限制:
- 每分钟最多 2000 次 API 调用
- 每次 Live SERP 调用 支持 1 个任务
- 最大并发请求数 30
POST 请求体为 JSON 数组格式:
[{ ... }]
请求参数
任务参数
| 字段 | 类型 | 填 | 说明 |
|---|---|---|---|
keyword | string | 是 | ,最长 700 个字符。%## 会被解码,+ 会被解码为空格;如需保留 %,请写为 %25;如需保留 +,请写为 %2B。 |
date_from | string | 否 | 时间范围开始日期,格式:yyyy-mm-dd。若不传,默认返回从当前 datetime 向前最多 365 天的历史 SERP。最早支持回溯到当前时间前 365 天。 |
date_to | string | 否 | 时间范围结束日期,格式:yyyy-mm-dd。默认使用当天日期。示例:2021-09-01 |
location_name | string | 条件填 | 地区完整名称。未传 location_code 时填。location_name 与 location_code 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用地区。示例:United Kingdom |
location_code | integer | 条件填 | 地区唯一标识。未传 location_name 时填。location_name 与 location_code 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用地区编码。示例:2840 |
language_name | string | 条件填 | 语言完整名称。未传 language_code 时填。language_name 与 language_code 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用语言。示例:English |
language_code | string | 条件填 | 语言唯一标识。未传 language_name 时填。language_name 与 language_code 二选一。可通过 /v3/dataforseo_labs/locations_and_languages 获取可用语言编码。示例:en |
tag | string | 否 | 自定义任务标识,最长 255 个字符。可用于请求与结果匹,返回时会出现在响应的 data 对象中。 |
请求示例
cURL
bash
curl --location --request POST "https://api.seermartech.cn/v3/dataforseo_labs/google/historical_serps/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"keyword": "albert einstein",
"location_code": 2840,
"language_code": "en",
"date_from": "2021-08-01",
"date_to": "2021-10-01"
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/dataforseo_labs/google/historical_serps/live"
payload = [
{
"keyword": "albert einstein",
"location_name": "United States",
"language_name": "English",
"date_from": "2021-08-01",
"date_to": "2021-10-01"
}
]
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json)TypeScript
typescript
import axios from "axios";
const payload = [
{
keyword: "albert einstein",
location_code: 2840,
language_code: "en",
date_from: "2021-08-01",
date_to: "2021-10-01"
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/dataforseo_labs/google/historical_serps/live",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
},
data: payload
})
.then((response) => {
console.log(response.data);
})
.catch((error) => {
console.error(error);
});响应结构
接口返回 JSON 编码结果,顶层 tasks 数组。
顶层响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | API 当前版本 |
status_code | integer | 通用状态码,完整列表见 /v3/appendix/errors |
status_message | string | 通用状态信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总成本,单位 USD;扣费请以此字段为准 |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | 返回错误的任务数量 |
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 | 回显请求参数 |
result | array | 获取结果数组;按指定时间范围返回各月采集到的 SERP 数据 |
result[] 字段
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
keyword | string | 请求中的;返回时 %## 会被解码,+ 会被转为空格 |
location_code | integer | 地区编码 |
language_code | string | 语言编码 |
total_count | integer | 数据库中与请求匹的结果总数 |
items_count | integer | 当前 items 返回数量 |
items | array | 命中的历史 SERP 结果 |
items[] 通用字段
每个历史 SERP 记录通常以下字段:
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
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 |
spell | object | 搜索引擎自动纠错信息 |
item_types | array | 当前 SERP 中出现的结果类型集合 |
se_results_count | integer | SERP 总结果数 |
items_count | integer | items 数组中结果数量 |
items | array | 该次 SERP 中的结果项 |
spell 字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 自动纠正后的 |
type | string | 纠错类型,可选:did_you_mean、showing_results_for、no_results_found_for |
item_types 可选值
可能出现的 SERP素类型:
answer_box、carousel、multi_carousel、featured_snippet、google_flights、google_reviews、google_posts、images、jobs、knowledge_graph、local_pack、hotels_pack、map、organic、paid、people_also_ask、related_searches、people_also_search、shopping、top_stories、twitter、video、events、mention_carousel、recipes、top_sights、scholarly_articles、popular_products、podcasts、questions_and_answers、find_results_on、stocks_box、visual_stories、commercial_units、local_services、google_hotels、math_solver、ai_overview
主要结果类型字段说明
由于本接口支持的 SERP素非常多,以下保留各主要类型的核心字段定义。返回中当前 SERP 出现的类型。
1) organic 自然结果
| 字段 | 类型 | 说明 |
|---|---|---|
se_type | string | 搜索引擎类型 |
type | string | 固定为 organic |
rank_group | integer | 同类型分组排名 |
rank_absolute | integer | SERP 绝对排名 |
position | string | 位置,left 或 right |
xpath | string | 素 XPath |
domain | string | 域名 |
title | string | 标题 |
url | string | URL |
breadcrumb | string | 面屑 |
is_image | boolean | 是否图片 |
is_video | boolean | 是否视频 |
is_featured_snippet | boolean | 是否为精选摘要来源 |
is_malicious | boolean | 是否被标记为恶意 |
description | string | 摘要描述 |
pre_snippet | string | 描述前附加信息 |
extended_snippet | string | 描述后附加信息 |
amp_version | boolean | 是否有 AMP 版本 |
rating | object | 评分信息 |
highlighted | array | 描述中加粗词 |
links | array | 站点链接 |
about_this_result | object | “此结果”面板信息 |
main_domain | string | 主域名 |
relative_url | string | 相对 URL |
etv | float | 预估自然流量 |
estimated_paid_traffic_cost | float | 预估等价付费流量成本 |
rank_changes | object | 相比上月的排名变化 |
backlinks_info | object | 排名页面/站点的外链信息 |
rank_info | object | 页面与主域名权重信息 |
rating
| 字段 | 类型 | 说明 |
|---|---|---|
rating_type | string | 评分类型:Max5、Percents、CustomMax |
value | float | 评分值 |
votes_count | integer | 评价数 |
rating_max | integer | 满分值 |
links[]
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 link_element |
title | string | 站点链接标题 |
description | string | 描述 |
url | string | 站点链接 URL |
about_this_result
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 about_this_result_element |
url | string | 结果 URL |
source | string | 补信息来源 |
source_info | string | 附加说明 |
source_url | string | 来源 URL |
language | string | 结果语言 |
location | string | 结果地区 |
search_terms | array | 匹到的搜索词 |
related_terms | array | 搜索词 |
rank_changes
| 字段 | 类型 | 说明 |
|---|---|---|
previous_rank_absolute | integer | 上月绝对排名;若为新结果则为 null |
is_new | boolean | 是否为新出现结果 |
is_up | boolean | 是否上升 |
is_down | boolean | 是否下降 |
backlinks_info
| 字段 | 类型 | 说明 |
|---|---|---|
referring_domains | integer | 引荐域名数,子域名分开计数 |
referring_main_domains | integer | 主域名数 |
referring_pages | integer | 引荐页面数 |
dofollow | integer | dofollow 链接数 |
backlinks | integer | 总外链数 |
time_update | string | 外链数据更新时间,UTC |
rank_info
| 字段 | 类型 | 说明 |
|---|---|---|
page_rank | integer | 页面权重 |
main_domain_rank | integer | 主域名权重 |
2) paid 广告结果
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 paid |
rank_group | integer | 同类型分组排名 |
rank_absolute | integer | 绝对排名 |
position | string | left / right |
xpath | string | XPath |
title | string | 标题 |
domain | string | 广告域名 |
description | string | 描述 |
breadcrumb | string | 面屑 |
url | string | 落地页 URL |
highlighted | array | 加粗词 |
extra | object | 附加信息,如 ad_aclk |
description_rows | array | 扩展描述 |
links | array | 广告站点链接 |
main_domain | string | 主域名 |
relative_url | string | 相对 URL |
etv | float | 预估流量 |
estimated_paid_traffic_cost | float | 预估付费流量成本 |
rank_changes | object | 相比上月的排名变化 |
3) featured_snippet 精选摘要
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 featured_snippet |
rank_group | integer | 分组排名 |
rank_absolute | integer | 绝对排名 |
position | string | left / right |
xpath | string | XPath |
domain | string | 域名 |
title | string | SERP 标题 |
featured_title | string | 来源页标题 |
description | string | 摘要 |
url | string | 来源 URL |
table | array/object | 摘要表格,可能为空 |
main_domain | string | 主域名 |
relative_url | string | 相对 URL |
etv | float | 预估自然流量 |
estimated_paid_traffic_cost | float | 预估等价付费流量成本 |
rank_changes | object | 排名变化 |
4) ai_overview AI 概览
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 ai_overview |
rank_group | integer | 分组排名 |
rank_absolute | integer | 绝对排名 |
page | integer | 所在搜索结果页码 |
position | string | left / right |
xpath | string | XPath |
asynchronous_ai_overview | boolean | 是否异步加载 |
markdown | string | AI 概览的 Markdown 文本 |
items | array | AI 概览中的块 |
references | array | 参考来源 |
rectangle | object | 结果在 SERP 中的坐标和尺寸;若未启用计算则为 null |
ai_overview 子类型
ai_overview_elementai_overview_video_elementai_overview_table_elementai_overview_expanded_elementai_overview_reference
常见子字段
| 字段 | 类型 | 说明 |
|---|---|---|
title | string | 素标题 |
text | string | 文本 |
markdown | string | Markdown |
links | array | 链接列表 |
images | array | 图片列表 |
references | array | 引用来源 |
table | object | 表格 |
components | array | 展开型组件 |
rectangle
| 字段 | 类型 | 说明 |
|---|---|---|
x | float | 左上角 X 坐标 |
y | float | 左上角 Y 坐标 |
width | float | 宽度,像素 |
height | float | 高度,像素 |
5) knowledge_graph 知识图谱
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 固定为 knowledge_graph |
rank_group | integer | 分组排名 |
rank_absolute | integer | 绝对排名 |
position | string | left / right |
xpath | string | XPath |
title | string | 标题 |
sub_title | string | 副标题 |
description | string | 描述 |
card_id | string | 卡片 ID |
url | string | URL |
image_url | string | 图片 URL |
logo_url | string | Logo URL |
cid | string | 客户端 ID |
items | array | 知识图谱结构化条目 |
知识图谱中的 items 可能:
knowledge_graph_images_itemknowledge_graph_list_itemknowledge_graph_description_itemknowledge_graph_row_itemknowledge_graph_carousel_itemknowledge_graph_part_itemknowledge_graph_expanded_itemknowledge_graph_shopping_item
这些子类型可进一步:
linklinksitemsexpanded_elementtable
6) 常见 SERP素
以下类型同样可能出现在 items 中,返回字段与展示形态一致:
| 类型 | 说明 |
|---|---|
carousel | 轮播结果 |
multi_carousel | 多组轮播结果 |
answer_box | 直接答案框 |
related_searches | 搜索 |
people_also_search | 用户还会搜索 |
people_also_ask | 用户还问了 |
local_pack | 本地商家结果 |
hotels_pack | 店结果 |
map | 地图结果 |
google_flights | 航班结果 |
google_reviews | Google 评论模块 |
google_posts | Google 帖子模块 |
video | 视频结果 |
images | 图片结果 |
shopping | 购物结果 |
jobs | 职位结果 |
events | 活动结果 |
mention_carousel | 提及轮播 |
recipes | 菜谱结果 |
top_sights | 热门景点 |
top_stories | 热门新闻 |
twitter | 社交模块 |
scholarly_articles | 学术文章 |
popular_products | 热门商品 |
podcasts | 播客 |
questions_and_answers | 问答结果 |
find_results_on | 在站点查找结果 |
stocks_box | 股票卡片 |
visual_stories | 视觉 |
commercial_units | 商业卡片 |
local_services | 本地服务广告/服务 |
google_hotels | Google店模块 |
math_solver | 数学求解器 |
重要说明
时间范围
- 历史数据可查询最近 12 个月
- 若不传
date_from,默认从当前datetime往前最多取 365 天 - 若不传
date_to,默认使用当天
解码规则
keyword返回时会解码%##+会被视为空格- 如需保留字面
%,请传%25 - 如需保留字面
+,请传%2B
排名变化说明
rank_changes 以前一个月为基准计算,即使前一个月不在本次请求时间范围,也可能参与计算。
稳定性建议
建议根据 /v3/appendix/errors 中的状态码设计异常处理与重试机制,:
- 顶层
status_code - 任务级
tasks[].status_code
响应示例
json
{
"version": "0.1.20220216",
"status_code": 20000,
"status_message": "Ok.",
"time": "23.9825 sec.",
"cost": 0.0005,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "dataforseo_labs",
"function": "historical_serps",
"se_type": "google",
"keyword": "albert einstein",
"language_name": "English",
"location_code": 2840,
"date_from": "2021-08-01",
"date_to": "2021-10-01"
},
"result": [
{
"se_results_count": 85600000,
"items_count": 96,
"items": [
{
"type": "top_stories",
"rank_group": 1,
"rank_absolute": 3,
"position": "left"
},
{
"type": "answer_box",
"rank_group": 1,
"rank_absolute": 4,
"position": "left"
},
{
"type": "organic",
"rank_group": 1,
"rank_absolute": 1,
"position": "left",
"domain": "example.com",
"title": "示例自然结果",
"url": "https://example.com/",
"breadcrumb": "https://example.com",
"is_image": false,
"is_video": false,
"is_featured_snippet": false,
"is_malicious": false,
"description": "示例描述",
"amp_version": false,
"main_domain": "example.com",
"relative_url": "/",
"etv": 15.2,
"estimated_paid_traffic_cost": 119.48,
"rank_changes": {
"previous_rank_absolute": 1,
"is_new": false,
"is_up": false,
"is_down": false
}
},
{
"type": "featured_snippet",
"rank_group": 1,
"rank_absolute": 10,
"position": "left",
"domain": "www.rome.net",
"title": "Rome Metro - Lines, hours, fares and Rome metro maps",
"description": "Most important metro stations...",
"url": "https://www.rome.net/metro"
},
{
"type": "knowledge_graph",
"rank_group": 1,
"rank_absolute": 1,
"position": "right",
"title": "Eminem",
"sub_title": "American rapper"
},
{
"type": "ai_overview",
"rank_group": 1,
"rank_absolute": 1,
"page": 1,
"position": "left",
"asynchronous_ai_overview": false,
"markdown": "AI Overview 示例"
}
]
}
]
}
]
}错误码
本接口使用统一状态码体系:
- 顶层状态码:
status_code - 任务状态码:
tasks[].status_code
完整错误码与说明请参考:
/v3/appendix/errors
建议至少处理以下场景:
- 参数缺失或格式错误 -出并发或频率限制
- 账户余额不足
- 平台采集失败或结果不可用
- 临时性服务异常
实用场景
- 追踪排名波动:按月回看目标的历史 SERP,识别网站排名上升、下降或新结果页的时间点。
- 分析 SERP 版式演化:统计某在不同月份出现的
featured_snippet、people_also_ask、ai_overview等,评估自然点击空间变化。 - 监控竞争对手历史:提取历史自然结果与广告结果中的竞争域名,分析对手何时、退出或强化某类布局。
- 评估类型机会:根据历史 SERP 中图片、视频、问答、购物、新闻等模块的出现频率,判断更适合哪类生产。
- 复盘算法或市场事件影响:结合
rank_changes与 SERP 特征变化,定位某月排名异常背后的页面竞争、结果结构变化或搜索意图迁移。