Google 趋势 API
以结构化 JSON 获取实时热搜榜、爆发关键词与搜索量激增数据。
这是什么 API?
Serqo 的 Google 趋势 API(Google Trends API)提供对全球 52 个国家/地区、19 个核心分类实时热点搜索与突发趋势的编程访问。彻底摆脱易被风控、易因前端改版崩溃的本地爬虫脚本,提供规范归一化的结构化 JSON 数据,包含搜索量、增长率、关联查询与新闻文章数。
常见使用场景
- 为媒体与新闻聚合平台提供实时热搜榜单与趋势挂件。
- 在竞争对手察觉前捕捉突发爆款长尾词,抢占 SEO 内容先机。
- 跨区域监控突发舆情与全球市场搜索兴趣转移。
- 为量化交易、情绪分析与社媒营销策略提供即时外部热度数据。
- 自动化社交媒体选题与广告营销文案灵感挖掘。
请求示例
POST https://serqo.io/v1/trends
/v1/trends 同时支持 POST(JSON 请求体)与 GET(URL 查询参数)。
请求头
创建 API Key 并保存在服务端,通过 x-api-key 请求头传入。
| 请求头 | 取值 | 说明 |
|---|---|---|
| Content-Type | application/json | 请求正文为 JSON。 |
| x-api-key | YOUR_API_KEY | 用于验证请求的 API Key。 |
export SERP_API_KEY='YOUR_API_KEY'
curl https://serqo.io/v1/trends \
-H "x-api-key: $SERP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"geo": "US",
"category": "Technology",
"period": "24h",
"sort": "search-volume",
"limit": 10
}' 支持的分类与国家列表
可直接调用 GET /v1/trends/meta 获取当前系统支持的全部行业分类、国家地区代码、时间周期与排序规则(含中英文双语对照)。
curl -H "x-api-key: $SERP_API_KEY" https://serqo.io/v1/trends/meta
代码示例
可使用标准 HTTP 客户端调用,无需安装 SDK。以下示例分别使用 Node.js 22 及以上版本和 Python 3。
const response = await fetch('https://serqo.io/v1/trends', {
method: 'POST',
headers: {
'x-api-key': process.env.SERP_API_KEY,
'Content-Type': 'application/json',
},
body: JSON.stringify({
geo: 'US',
category: 'Technology',
period: '24h',
sort: 'search-volume',
limit: 10,
}),
});
const data = await response.json();
for (const item of data.data.trends) {
console.log(`#${item.rank} ${item.keyword} (${item.searchVolume.toLocaleString()} searches, +${item.growth}%)`);
} import os
import requests
response = requests.post(
'https://serqo.io/v1/trends',
headers={
'x-api-key': os.environ['SERP_API_KEY'],
'Content-Type': 'application/json',
},
json={
'geo': 'US',
'category': 'Technology',
'period': '24h',
'sort': 'search-volume',
'limit': 10,
},
timeout=10,
)
payload = response.json()
for trend in payload['data']['trends']:
print(f"Rank {trend['rank']}: {trend['keyword']} (Vol: {trend['searchVolume']}, Growth: +{trend['growth']}%)") 参数说明
| Parameter | Type | Default | Description |
|---|---|---|---|
| geo | string | US | 两位 ISO 国家代码(如 US、GB、DE、JP)。默认:US。 |
| category | string | number | all | 分类名称或数字 ID(如 Technology 或 18)。默认:全部大类。 |
| period | string | 24h | 趋势统计时间窗口:4h、24h、48h、7d。默认:24h。 |
| sort | string | search-volume | 排序规则:search-volume(按搜索量)、growth(按爆发增长率)、recency(最新发布)、title。默认:search-volume。 |
| limit | number | 20 | 最多返回的趋势条目数(1 到 100)。默认:20。 |
响应结构
HTTP 200。包含归一化趋势数据、搜索量、突发增长率与关联查询的标准 JSON 响应:
{
"success": true,
"requestId": "req_f7dd5016-3ea6-470b-b952-a51bb73b63fe",
"data": {
"trends": [
{
"rank": 1,
"keyword": "microsoft code red",
"normalizedKeyword": "microsoft code red",
"geo": "US",
"searchVolume": 20000,
"growth": 400,
"startTimestamp": 1795538400,
"startTime": "2026-11-24T16:40:00.000Z",
"isNew": false,
"categoryIds": [18],
"categories": [
{ "id": 18, "name": "Technology", "nameZh": "科技" }
],
"relatedQueries": [
"microsoft code red",
"microsoft outage code red",
"cloud"
],
"articleCount": 11,
"articles": [
{ "id": "4952966199", "lang": "en", "geo": "US" }
]
}
]
},
"meta": {
"geo": "US",
"countryName": "United States",
"countryNameZh": "美国",
"category": "Technology",
"categoryId": 18,
"period": "24h",
"sort": "search-volume",
"durationMs": 3023,
"totalCandidates": 528,
"totalResults": 1,
"datasetFrom": "2026-11-24T01:20:00.000Z",
"datasetTo": "2026-11-25T01:00:00.000Z",
"credits": 1,
"cache": "miss"
}
} 定价与额度消耗
透明计费机制,缓存命中与异常失败绝不扣费:
缓存命中免费:在缓存 TTL 内命中的重复请求消耗 0 积分。
失败不扣费:因上游超时或异常失败的请求自动释放额度,不计入账单。
并发合并机制:同一瞬间针对相同参数的并发请求自动合并单次抓取,不重复计费。
常见问题
Google 趋势搜索如何计费?
每次成功的 Google Trends 请求扣除 1 积分。短期缓存命中的相同查询消耗 0 积分。上游超时或不可用时自动全额返还预留额度,绝不扣费。
支持哪些国家地区与行业分类?
支持 52 个主流国家(美国、英国、德国、日本、印度等)以及 19 个官方行业大类(科技、商业金融、娱乐、体育等)。可随时调用 GET /v1/trends/meta 获取最新对照表。