主题
Google Trends Explore 实时查询
接口说明
此接口用于实时获取 Google Trends「Explore」模块中的热度数据。可查询以下搜索类型下的趋势表现:
- Google Search(
web) - Google News(
news) - Google Images(
images) - Google Shopping(
froogle) - YouTube(
youtube)
如果你的系统需要即时返回结果,建议使用 Live 方法。与 Standard 方法不同,Live 方法无需 POST 创建任务、再 GET 轮询结果,而是在一次请求中直接返回数据。
使用限制
- 若 1 分钟向本平台提交 250 个 Live Explore 任务,可能返回限流错误。
- 由于 Google Trends 服务本身容量有限,且存在平台限制,所有 Google Trends 接口的平台总日请求量上限为 500,000 次。建议将请求分散到多天执行,以降低采集失败风险并获得更稳定的数据返回。
- 若你的场景异步获取结果,建议优使用标准任务模式
/v3/keywords_data/google_trends/explore/task_post: - 吞吐更高:最高可达 2000 次 API 调用/分钟
- 单次 POST 最多可提交 100 个任务
- 成本通常更低
历史数据范围
web类型最早支持:2004-01-01- 类型(
news、youtube、images、froogle)最早支持:2008-01-01
请求地址
POST https://api.seermartech.cn/v3/keywords_data/google_trends/explore/live
计费说明
本接口按请求计费,每次请求都会扣费,不受 keywords 数组中数量影响。 单个 keywords 数组最多可传 5 个。
参考价约 ¥0.1440 / 次。 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
请求格式
- 请求方法:
POST - Content-Type:
application/json - 编码:
UTF-8 - 请求体为 JSON 数组:
[{ ... }]
请求参数
| 字段名 | 类型 | 说明 |
|---|---|---|
keywords | array | 填。数组。最多 5 个;单个最长 100 个字符;最少长度需大于 1。中的逗号 , 会被移除并忽略。不能由以下字符组合构成:`< > |
location_name | string / array | 可选。搜索地区名。不传则返回结果。使用该字段时无需再传 location_code。也可传数组,为每个指定对应地区。示例:United Kingdom |
location_code | integer / array | 可选。搜索地区编码。不传则返回结果。使用该字段时无需再传 location_name。也可传数组,为每个指定对应地区。示例:2840 |
language_name | string | 可选。语言名称。默认 English。使用该字段时无需再传 language_code。示例:English |
language_code | string | 可选。语言编码。默认 en。使用该字段时无需再传 language_name。示例:en |
type | string | 可选。趋势类型。默认 web。可选值:web、news、youtube、images、froogle |
category_code | integer | 可选。趋势分类编码。默认 0,表示分类范围。 |
date_from | string | 可选。起始日期,格式:yyyy-mm-dd。默认取“去年今天对应的日期”。web 最小值为 2004-01-01,类型最小值为 2008-01-01。示例:2019-01-15 |
date_to | string | 可选。结束日期,格式:yyyy-mm-dd。默认取今天。示例:2019-01-15 |
time_range | string | 可选。预设时间范围。若指定了 date_from 或 date_to,该字段会被忽略。所有 type 通用值:past_hour、past_4_hours、past_day、past_7_days、past_30_days、past_90_days、past_12_months、past_5_years。 web 支持:2004_present。 news、youtube、images、froogle 支持:2008_present |
item_types | array | 可选。返回结果项类型。为了提升执行速度,建议一次只请求一种 item。可选值:google_trends_graph、google_trends_map、google_trends_topics_list、google_trends_queries_list。默认:google_trends_graph。注意:若请求 google_trends_topics_list 或 google_trends_queries_list,keywords 中最多只能有 1 个。 |
tag | string | 可选。自定义任务标识,最长 255 个字符。可用于请求与结果的业务。返回时会出现在响应的 data 对象中。 |
##助接口
可通过以下容路径获取可用地区、语言和分类:
- 地区列表:
/v3/keywords_data/google_trends/locations - 语言列表:
/v3/keywords_data/google_trends/languages - 分类列表:
/v3/keywords_data/google_trends/categories
请求示例
curl
bash
curl --location --request POST "https://api.seermartech.cn/v3/keywords_data/google_trends/explore/live" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json" \
--data-raw '[
{
"location_name": "United States",
"date_from": "2019-01-01",
"date_to": "2020-01-01",
"type": "youtube",
"category_code": 3,
"keywords": [
"rugby",
"cricket"
]
}
]'Python
python
import requests
url = "https://api.seermartech.cn/v3/keywords_data/google_trends/explore/live"
payload = [
{
"location_name": "United States",
"date_from": "2019-01-01",
"date_to": "2020-01-01",
"type": "youtube",
"category_code": 3,
"keywords": [
"rugby",
"cricket"
]
}
]
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 = [
{
location_name: "United States",
date_from: "2019-01-01",
date_to: "2020-01-01",
type: "youtube",
category_code: 3,
keywords: ["rugby", "cricket"]
}
];
axios({
method: "post",
url: "https://api.seermartech.cn/v3/keywords_data/google_trends/explore/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 | 与 POST 请求中提交的参数一致 |
result | array | 结果数组 |
result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
keywords | array | 请求中的数组 |
location_code | integer | 请求中的地区编码;如无数据则为 null |
language_code | string | 请求中的语言编码;如无数据则为 null |
check_url | string | 对应 Google Trends 结果页直达链接,可用于人工校验结果 |
datetime | string | 数据获取时间,UTC 格式:yyyy-mm-dd hh-mm-ss +00:00 |
items_count | integer | items 数组中的数量 |
items | array | Google Trends 页面模块数据 |
items 结果项说明
google_trends_graph
趋势图数据。
| 字段名 | 类型 | 说明 |
|---|---|---|
position | integer | 模块在页面中的位置,如 1、2、3 |
type | string | 固定为 google_trends_graph |
title | string | 模块标题 |
keywords | array | 该图表对应的 |
data | array | 时间序列趋势数据 |
averages | array | 整个时间范围的平均热度值 |
data[] 子字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
date_from | string | 当前区间起始日期,UTC,格式 yyyy-mm-dd |
date_to | string | 当前区间结束日期,UTC,格式 yyyy-mm-dd |
timestamp | integer | Unix 时间戳 |
missing_data | boolean | 是否缺失数据。若为 true,趋势图中通常会以虚线表示 |
values | integer / array | 指定时间点的相对热度值。100 表示峰值热度,50 表示热度约为峰值一半,0 表示数据不足。当指定多个时,数值会按所有中的最高值进行归一化后返回。 |
google_trends_map
地域热度分布数据。
| 字段名 | 类型 | 说明 |
|---|---|---|
position | integer | 模块在页面中的位置 |
type | string | 固定为 google_trends_map |
title | string | 模块标题 |
keywords | array | 该地图对应的 |
data | array | 区域维度热度数据 |
data[] 子字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
geo_id | string | Google Trends 地区标识,可用于与请求地区参数匹,如 US-NY |
geo_name | string | 地区名称 |
values | integer / array | 当前地区的相对热度值。100 表示峰值热度,50 表示约一半热度,0 表示数据不足。多时会按最高值归一化后返回 |
max_value_index | integer | 当一次请求比较多个时,表示当前地区中最大值对应的索引;若传 1 个,则为 null |
google_trends_topics_list
主题列表。
| 字段名 | 类型 | 说明 |
|---|---|---|
position | integer | 模块在页面中的位置 |
type | string | 固定为 google_trends_topics_list |
title | string | 模块标题 |
keywords | array | 该列表对应的 |
data | object | 主题数据对象 |
data.top[] 子字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
topic_id | string | Google Trends 主题唯一标识 |
topic_title | string | 主题名称 |
topic_type | string | 主题类别 |
value | string | 热度值,按相对比例计分,100 为最热门 |
data.rising[] 子字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
topic_id | string | Google Trends 主题唯一标识 |
topic_title | string | 主题名称 |
topic_type | string | 主题类别 |
value | string | 热度增长值,单位为百分比但不带 % 符号 |
google_trends_queries_list
查询词列表。
| 字段名 | 类型 | 说明 |
|---|---|---|
position | integer | 模块在页面中的位置 |
type | string | 固定为 google_trends_queries_list |
title | string | 模块标题 |
keywords | array | 该列表对应的 |
data | object | 查询数据对象 |
data.top[] 子字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
query | string | 查询词 |
value | string | 热度值,按相对比例计分,100 为最热门 |
data.rising[] 子字段:
| 字段名 | 类型 | 说明 |
|---|---|---|
query | string | 查询词 |
value | string | 热度增长值,单位为百分比但不带 % 符号 |
响应示例
json
{
"version": "0.1.20220420",
"status_code": 20000,
"status_message": "Ok.",
"time": "6.1707 sec.",
"cost": 0.009,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "2c5b7f2e-7d4a-4a1f-9d31-1234567890ab",
"status_code": 20000,
"status_message": "Ok.",
"time": "6.1707 sec.",
"cost": 0.009,
"result_count": 1,
"path": [
"v3",
"keywords_data",
"google_trends",
"explore",
"live"
],
"data": {
"api": "keywords_data",
"function": "explore",
"se": "google_trends",
"location_name": "United States",
"date_from": "2019-01-01",
"date_to": "2020-01-01",
"keywords": [
"seo api"
]
},
"result": [
{
"type": "trends",
"keywords": [
"seo api"
],
"location_code": 2840,
"language_code": "en",
"check_url": "https://trends.google.com/trends/explore?hl=en&geo=US&date=2019-01-01%202020-01-01&q=seo%20api",
"datetime": "2022-04-21 18:40:17 +00:00",
"items_count": 4,
"items": [
{
"position": 1,
"type": "google_trends_graph",
"title": "Interest over time",
"keywords": [
"seo api"
],
"data": [
{
"date_from": "2019-01-06",
"date_to": "2019-01-12",
"timestamp": 1546732800,
"missing_data": false,
"values": 54
},
{
"date_from": "2019-01-13",
"date_to": "2019-01-19",
"timestamp": 1547337600,
"missing_data": false,
"values": 61
}
],
"averages": []
},
{
"position": 2,
"type": "google_trends_map",
"title": "Interest by subregion",
"keywords": [
"seo api"
],
"data": [
{
"geo_id": "US-NY",
"geo_name": "New York",
"values": 100,
"max_value_index": null
},
{
"geo_id": "US-CA",
"geo_name": "California",
"values": 89,
"max_value_index": null
}
]
},
{
"position": 3,
"type": "google_trends_topics_list",
"title": "Related topics",
"keywords": [
"seo api"
],
"data": {
"top": [
{
"topic_id": "/m/012345",
"topic_title": "Search engine optimization",
"topic_type": "Topic",
"value": "100"
}
],
"rising": [
{
"topic_id": "/m/067890",
"topic_title": "API",
"topic_type": "Topic",
"value": "250"
}
]
}
},
{
"position": 4,
"type": "google_trends_queries_list",
"title": "Related queries",
"keywords": [
"seo api"
],
"data": {
"top": [
{
"query": "best seo api",
"value": "100"
}
],
"rising": []
}
}
]
}
]
}
]
}错误处理
建议在接时同时处理两层状态:
- HTTP 状态码
- 响应体中的
status_code/status_message tasks[].status_code/tasks[].status_message
完整错误码可参考容路径:
/v3/appendix/errors
常见注意事项:
- Live 接口短时间高并发调用可能触发限流
- Google Trends 平台容量不足时,可能出现采集失败或结果缺失
- 请求
topics_list/queries_list时,如果keywords过 1 个,可能无法返回对应模块 date_from出对应type的最早可用时间时,可能返回校验错误
实用场景
- 监测品牌热度走势:按周或按月拉取品牌词趋势曲线,判断品牌变化,为投放节奏和动作提供依据。
- 比较多需求强弱:同时传多个候选词,快速查看相对热度差异, SEO 选词与优级排序。
- 定位区域市场机会:通过
google_trends_map查看不同地区的强度,识别高潜力州、省或国家,支持本地化与区域投放。 - 挖掘主题与查询词:获取
google_trends_topics_list和google_trends_queries_list,发现用户正在的延伸话题,用于选题与专题页规划。 - 跟踪渠道型搜索趋势:切换
type为youtube、news、images或froogle,分析不同渠道中的搜索变化,优化视频、资讯或电商场景下的 SEO 策略。