主题
Google Trends 支持的语言列表
GET /v3/keywords_data/google_trends/languages
接口说明
GET https://api.seermartech.cn/v3/keywords_data/google_trends/languages
本接口用于获取 Google Trends API 支持的语言列表。接口无需提交请求参数,调用成功后将返回可用语言信息的 JSON 数据。
计费说明
调用本接口不收取费用,响应中的 cost 通常为 0。扣费以响应头 X-SeerMarTech-Charge-CNY 为准。
响应字段
顶层字段
| 字段 | 类型 | 说明 |
|---|---|---|
version | string | 当前 API 版本 |
status_code | integer | 通用状态码 |
status_message | string | 通用提示信息 |
time | string | 请求执行耗时,单位为秒 |
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 | GET 请求中传的参数。本接口无请求参数时,该对象接口标识信息 |
result | array | 语言列表 |
result 数组字段
| 字段 | 类型 | 说明 |
|---|---|---|
language_name | string | 语言名称 |
language_code | string | 按 ISO 639-1 标准定义的语言代码 |
完整状态码和错误信息请参考错误码文档。
请求示例
cURL
bash
curl --location --request GET \
"https://api.seermartech.cn/v3/keywords_data/google_trends/languages" \
--header "Authorization: Bearer smt_live_YOUR_KEY" \
--header "Content-Type: application/json"PHP
php
<?php
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => 'https://api.seermartech.cn/v3/keywords_data/google_trends/languages',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer smt_live_YOUR_KEY',
'Content-Type: application/json',
],
]);
$response = curl_exec($ch);
if ($response === false) {
echo '请求失败:' . curl_error($ch);
} else {
$result = json_decode($response, true);
print_r($result);
}
curl_close($ch);JavaScript
javascript
const axios = require('axios');
axios({
method: 'get',
url: 'https://api.seermartech.cn/v3/keywords_data/google_trends/languages',
headers: {
Authorization: 'Bearer smt_live_YOUR_KEY',
'Content-Type': 'application/json'
}
})
.then(function (response) {
// 处理响应数据
console.log(response.data);
})
.catch(function (error) {
console.error('请求失败:', error.response?.data || error.message);
});Python
python
import requests
url = "https://api.seermartech.cn/v3/keywords_data/google_trends/languages"
headers = {
"Authorization": "Bearer smt_live_YOUR_KEY",
"Content-Type": "application/json",
}
response = requests.get(url, headers=headers)
if response.ok:
result = response.json()
print(result)
else:
print(f"请求失败。HTTP 状态码:{response.status_code}")
print(response.text)C#
csharp
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
public static class ApiDemo
{
public static async Task GetGoogleTrendsLanguages()
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", "smt_live_YOUR_KEY");
var response = await httpClient.GetAsync(
"https://api.seermartech.cn/v3/keywords_data/google_trends/languages"
);
var content = await response.Content.ReadAsStringAsync();
if (response.IsSuccessStatusCode)
{
// 处理 JSON 响应
Console.WriteLine(content);
}
else
{
Console.WriteLine(
$"请求失败。HTTP 状态码:{(int)response.StatusCode},响应:{content}"
);
}
}
}响应示例
json
{
"version": "0.1.20200408",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1977 sec.",
"cost": 0,
"tasks_count": 1,
"tasks_error": 0,
"tasks": [
{
"id": "00000000-0000-0000-0000-000000000000",
"status_code": 20000,
"status_message": "Ok.",
"time": "0.1977 sec.",
"cost": 0,
"result_count": 2,
"path": [
"v3",
"keywords_data",
"google_trends",
"languages"
],
"data": {
"api": "keywords_data",
"function": "languages",
"se": "google_trends"
},
"result": [
{
"language_name": "English",
"language_code": "en"
},
{
"language_name": "Chinese",
"language_code": "zh"
}
]
}
]
}实用场景
- 获取语言代码,为 Google Trends 趋势查询自动填合法的语言参数,减少因语言错误导致的请求失败。
- 构建多语言,将语言名称与 ISO 639-1 代码映射到下拉选择器中,支持不同市场的 SEO 研究。
- 校验本地化,在批量创建趋势分析任务前检查项目使用的语言是否受支持,提升任务成功率。
- 生成区域化报表,根据语言代码筛选和整理不同语言市场的趋势数据,制定 SEO策略。