主题
Google Trends 地区列表
用于获取 Google Trends 支持的地区列表。
注意:由于平台服务政策限制,俄罗斯和白俄罗斯的所有地区在服务中已不再支持。
接口说明
该接口返回可用于 Google Trends 任务的地区数据。 你也可以在请求路径中追加国家 ISO 代码获取某个国家下的地区列表。
请求地址
http
GET https://api.seermartech.cn/v3/keywords_data/google_trends/locations
GET https://api.seermartech.cn/v3/keywords_data/google_trends/locations/$country计费说明
本接口不收费。 扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
可选筛选
如需按国家筛选地区列表,可在路径中传国家 ISO 代码,例如:
/v3/keywords_data/google_trends/locations/us
另可下载完整地区单 CSV(最后更新时间:2026-04-06)作为离线对使用。
路径参数
| 字段名 | 类型 | 说明 |
|---|---|---|
country | string | 可选,国家 ISO 代码;传后返回该国家下的地区列表。示例:us |
返回结果
接口返回 JSON 数据,顶层 tasks 数组给出可用地区列表。
顶层字段
| 字段名 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 局状态码 |
status_message | string | 局状态信息 |
time | string | 执行耗时,单位秒 |
cost | float | 本次请求总费用,单位 USD |
tasks_count | integer | tasks 数组中的任务数量 |
tasks_error | integer | 返回错误的任务数量 |
tasks | array | 任务结果数组 |
完整错误码与状态信息请参考
/v3/appendix/errors
tasks[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
id | string | 任务唯一标识,UUID 格式 |
status_code | integer | 任务状态码,范围通常为 10000-60000 |
status_message | string | 任务状态信息 |
time | string | 任务执行耗时,单位秒 |
cost | float | 单个任务费用,单位 USD |
result_count | integer | result 数组数量 |
path | array | 请求路径 |
data | object | GET 请求 URL 中传的参数 |
result | array | 地区结果列表 |
result[] 字段
| 字段名 | 类型 | 说明 |
|---|---|---|
location_code | integer | 地区编码 |
location_name | string | 地区完整名称 |
location_code_parent | integer | 上级地区编码 |
country_iso_code | string | 地区所属国家 ISO 代码 |
location_type | string | 地区类型;取值遵循 Google 地理定向类型 |
geo_name | string | Google Trends 使用的地区名称,可用于与请求中的 location_name 做匹 |
geo_id | string | Google Trends 使用的地区标识,可用于与请求中的 location_code 做匹 |
地区层级示例
json
{
"location_code": 9041134,
"location_name": "Vienna International Airport,Lower Austria,Austria",
"location_code_parent": 20044
}location_code_parent = 20044 对应的上级地区可能为:
json
{
"location_code": 20044,
"location_name": "Lower Austria,Austria"
}请求示例
cURL
bash
curl --location --request GET "https://api.seermartech.cn/v3/keywords_data/google_trends/locations" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"按国家筛选:
bash
curl --location --request GET "https://api.seermartech.cn/v3/keywords_data/google_trends/locations/us" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"Python
python
import requests
url = "https://api.seermartech.cn/v3/keywords_data/google_trends/locations"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json"
}
# 获取可用地区
response = requests.get(url, headers=headers)
result = response.json
if result.get("status_code") == 20000:
print(result)
else:
print(f"error. Code: {result.get('status_code')} Message: {result.get('status_message')}")TypeScript
typescript
import axios from "axios";
// 获取 Google Trends 支持的地区列表
axios({
method: "get",
url: "https://api.seermartech.cn/v3/keywords_data/google_trends/locations",
headers: {
Authorization: "Bearer smt_live_YOUR_KEY",
"content-type": "application/json",
},
}).then((response) => {
const result = response.data;
console.log(result);
}).catch((error) => {
console.log(error);
});响应示例
json
{
"version": "0.1.20210917",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1012 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"data": {
"api": "keywords_data",
"function": "locations",
"se": "google_trends"
},
"result": []
}
]
}状态码说明
| 状态码 | 说明 |
|---|---|
20000 | 请求成功 |
10000-60000 | 任务级状态码范围,表示不同处理状态或错误 |
更多错误码请参考 /v3/appendix/errors。
使用建议
- 在创建 Google Trends 任务前,调用本接口获取可用地区,传无效
location_code。 - 若你的业务只某个国家,建议使用
/locations/$country形式缩小返回范围。 - 可结合
geo_name和geo_id字段,将本接口结果与趋势分析结果做映射和标准化处理。
实用场景
- 校验地区参数:在提交 Google Trends 查询前拉取地区列表,减少因地区编码无效导致的任务失败。
- 构建地区选择器:为后台系统或客户界面生成可选地区下拉框,提升任务效率与准确性。
- 建立地区映射表:将
location_code、geo_id、geo_name统一库,便于后续趋势结果的标准化处理。 - 按国家初始化数据范围:按国家获取地区列表,再批量创建分地区趋势监控任务,支持化市场分析。
- 洗历史任务参数:对已有地区进行比对,识别已不支持或命名不一致的地区,降低数据异常风险。