返回API列表

Google趋势词查询接口

根据关键词名称查询Google趋势词的详细信息,包括趋势数据、时间段、关联的SEO关键词数据等。

POST /api/admin/google-trends-keyword/search

🔑API Key 获取

在使用API接口之前,您需要先获取API Key。请前往管理后台生成您的API Key。

前往获取API Key

身份验证

所有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"
    }
  }
}

响应字段说明

字段类型说明
keywordstringGoogle趋势词名称
periodstring | null时间段
keywordCountnumber关键词数量
trendDataarray趋势数据列表(最近10条)
trendData[].trendsValuenumber趋势数值
trendData[].listTypestring列表类型(如 rising_searches, trending_searches)
seoDataobject | 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));