Google Trends API

Google Trends interest over time for up to 5 search terms compared on one 0-100 scale, where 100 is the peak search interest of any term in the window. Returns one series per term, in the order you sent them, with a value for every time bucket. Choose the country or region with geo (worldwide when omitted) and the window with timeframe (the past 12 months when omitted); both are echoed in the response. Interest over time only, not related queries or regions.

USD 0.002000 / 成功した呼び出し

パブリックID: search.google.trends · バージョン 1

料金

USD 0.002000 / 成功した呼び出し

クイックスタート

API キーでこのツールを検索し、返された provider と endpoint の仕様を確認してから実行してください。

GLOOP_API_BASE に API の URL、GLOOP_API_KEY にサーバー側のキーを設定してください。

curl

curl --fail-with-body "${GLOOP_API_BASE%/}/v1/discover" \
  -H "Authorization: Bearer $GLOOP_API_KEY" \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "limit": 5,
  "query": "Google Trends"
}'

Python

import os, json, urllib.request

url = os.environ['GLOOP_API_BASE'].rstrip('/') + "/v1/discover"
headers = {'Authorization': 'Bearer ' + os.environ['GLOOP_API_KEY']}
headers['Content-Type'] = 'application/json'
data = "{\n  \"limit\": 5,\n  \"query\": \"Google Trends\"\n}".encode('utf-8')
request = urllib.request.Request(url, data=data, headers=headers)
with urllib.request.urlopen(request) as response:
    print(json.load(response))

Node.js

const url = process.env.GLOOP_API_BASE.replace(/\/$/, '') + "/v1/discover";
const headers = { Authorization: `Bearer ${process.env.GLOOP_API_KEY}` };
headers['Content-Type'] = 'application/json';
const response = await fetch(url, { method: 'POST', headers, body: JSON.stringify({
  "limit": 5,
  "query": "Google Trends"
}) });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
console.log(await response.json());
ツール API ドキュメント · POST /v1/inspect

入力スキーマ

{
  "additionalProperties": false,
  "properties": {
    "geo": {
      "description": "Where the searches came from: an uppercase ISO country code (US, GB, DE) or a country subdivision (US-CA, GB-ENG). Omit it, or send worldwide, for worldwide interest.",
      "type": "string"
    },
    "keywords": {
      "description": "Search terms to compare, 1 to 5, each 2 to 100 characters and without commas (e.g. [\"coffee\", \"tea\"]). Values are relative across the whole set, so the same term scores differently next to different terms.",
      "items": {
        "maxLength": 100,
        "minLength": 2,
        "type": "string"
      },
      "maxItems": 5,
      "minItems": 1,
      "type": "array"
    },
    "timeframe": {
      "description": "The window to chart, ending now: 1h, 4h, 1d or 7d (hours and days), 1m or 3m (months), 12m, 5y, or all (back to January 2004). Buckets grow with the window: minutes up to 1d, hours for 7d, days for 1m and 3m, weeks for 12m and 5y, months for all.",
      "enum": [
        "1h",
        "4h",
        "1d",
        "7d",
        "1m",
        "3m",
        "12m",
        "5y",
        "all"
      ],
      "type": "string"
    }
  },
  "required": [
    "keywords"
  ],
  "title": "Google Trends input",
  "type": "object"
}

出力スキーマ

{
  "type": "object"
}

同じカテゴリのツール