返回API列表
Google趋势词查询接口
根据关键词名称查询Google趋势词的详细信息,包括趋势数据、时间段、关联的SEO关键词数据等。
POST /api/admin/google-trends-keyword/search身份验证
所有API请求都需要在请求头中包含API Key进行身份验证。
请求头格式:
X-API-Key: your_api_key_here请求头
Content-Type: application/json X-API-Key: your_api_key_here
请求参数
{
"keyword": "关键词名称",
"period": "时间段(可选)"
}keywordstring (必填) - 要查询的Google趋势词名称
periodstring (可选) - 时间段,如 "past_1_hour", "past_4_hours", "past_1_day" 等
响应示例
{
"success": true,
"data": {
"id": 1,
"keyword": "example keyword",
"period": "past_1_day",
"keywordCount": 5,
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T12:00:00.000Z",
"trendData": [
{
"id": 1,
"query": "example keyword",
"trendsValue": 100,
"period": 1,
"hasData": true,
"trendLink": "https://trends.google.com/...",
"listType": "rising_searches",
"collectedAt": "2025-01-01T12:00:00.000Z",
"trendDate": "2025-01-01T00:00:00.000Z",
"keywordId": 123
}
],
"seoData": {
"id": 123,
"keyword": "example keyword",
"searchVolume": 1000,
"keywordDifficulty": 45,
"cpc": 1.5,
"competition": 0.75,
"trendScore": 85,
"commercialScore": 90,
"overallScore": 88,
"kws": 12,
"language": "en"
}
}
}响应字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| keyword | string | Google趋势词名称 |
| period | string | null | 时间段 |
| keywordCount | number | 关键词数量 |
| trendData | array | 趋势数据列表(最近10条) |
| trendData[].trendsValue | number | 趋势数值 |
| trendData[].listType | string | 列表类型(如 rising_searches, trending_searches) |
| seoData | object | null | 关联的SEO关键词数据(如果存在) |
错误响应
401 - 认证失败
{
"error": "认证失败"
}400 - 参数错误
{
"success": false,
"error": "缺少关键词参数"
}404 - 未找到
{
"success": false,
"error": "未找到该Google趋势词"
}代码示例
cURL
curl -X POST https://youzikuaibao.com.cn/api/admin/google-trends-keyword/search \
-H "Content-Type: application/json" \
-H "X-API-Key: your_api_key_here" \
-d '{"keyword": "example keyword", "period": "past_1_day"}'Python
import requests
url = "https://youzikuaibao.com.cn/api/admin/google-trends-keyword/search"
headers = {
"Content-Type": "application/json",
"X-API-Key": "your_api_key_here"
}
data = {
"keyword": "example keyword",
"period": "past_1_day"
}
response = requests.post(url, json=data, headers=headers)
result = response.json()
print(result)JavaScript (fetch)
fetch('https://youzikuaibao.com.cn/api/admin/google-trends-keyword/search', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': 'your_api_key_here'
},
body: JSON.stringify({
keyword: 'example keyword',
period: 'past_1_day'
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));