Google Trends API
Google Trendsから過去および現在の検索人気度データを取得します。engine=google_trends を設定し、1つ以上の検索語を q に渡します。必要に応じて geo、date、cat でリクエストの範囲を指定できます。
Endpoint
Section titled “Endpoint” GET https://serp.shifter.io/v1?engine=google_trends&api_key=YOUR_API_KEY
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | あなたのSERP APIキー |
engine | string | yes | google_trends を指定する必要があります |
q | string | yes | 検索語。複数の場合はカンマ区切りで指定可能 |
geo | string | no | 地域コード。デフォルトは worldwide です。geoパラメータオプション一覧 を参照してください |
region | string | no | country、city、subregion、または metro。compared_breakdown_by_region に適用されます |
date | string | no | YYYY-MM-DD YYYY-MM-DD 形式の範囲、または now 1-H、now 4-H、now 1-d、now 7-d、today 1-m、today 3-m、today 5-y、all のいずれか |
cat | string | no | カテゴリID。カテゴリ一覧 を参照してください |
Example request
Section titled “Example request”curl "https://serp.shifter.io/v1?engine=google_trends&api_key=YOUR_API_KEY&geo=US&q=american%20football&date=2021-01-01%202022-01-01"import requests
params = { "engine": "google_trends", "api_key": "YOUR_API_KEY", "geo": "US", "q": "american football", "date": "2021-01-01 2022-01-01",}r = requests.get("https://serp.shifter.io/v1", params=params)data = r.json()import fetch from 'node-fetch';
const url = 'https://serp.shifter.io/v1?' + new URLSearchParams({ engine: 'google_trends', api_key: 'YOUR_API_KEY', geo: 'US', q: 'american football', date: '2021-01-01 2022-01-01',});const data = await (await fetch(url)).json();Example response
Section titled “Example response”{ "search_parameters": { "engine": "google_trends", "q": "american football", "geo": "US", "date": "2021-01-01 2022-01-01" }, "interest_over_time": { "timeline_data": [ { "date": "Jan 3 - 9, 2021", "timestamp": "1609632000", "values": [ { "query": "american football", "value": "100", "extracted_value": 100 } ] } ], "averages": [ { "query": "american football", "value": 68 } ] }, "interest_by_region": [ { "geo": "US-FL", "location": "Florida", "value": "100" } ], "related_queries": { "top": [ { "query": "nfl scores", "value": "100" } ], "rising": [ { "query": "nfl playoffs", "value": "Breakout" } ] }}