mcpField
A
Amazon Trends API

Amazon Trends API

リモート
trendsapi.aiビジネス・マーケティング010 週間前に更新
リポジトリ公式サイト

Amazon Trends API について

Amazon Trends APIは、Python・JavaScriptクライアントまたはHTTP経由で、商品検索関心の推移、成長率、ベストセラー情報を提供します。EC調査向けで、キーワードの履歴データと現在のランキング情報を区別しています。

主な機能

  1. 01キーワード関心の時系列取得
  2. 02期間別の成長率測定
  3. 03リアルタイムのベストセラー情報
  4. 04カテゴリによるフィード絞り込み
  5. 05非同期Pythonクライアント
  6. 06HTTP API経由のアクセス

活用シーン

  1. 01Amazon商品語の検索関心の追跡
  2. 02期間ごとのキーワード成長率の比較
  3. 03現在のベストセラー順位の確認
  4. 04Pandasによる時系列分析

設定

リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。

エンドポイントhttps://amazon.api.trendsapi.ai/mcp
インストールコマンドをコピー
Claude CodeTerminal
Cursor.cursor/mcp.json
VS Code.vscode/mcp.json
Claude Desktopclaude_desktop_config.json
Windsurf~/.codeium/windsurf/mcp_config.json

コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。

すべてのエンドポイント
Streamable HTTPhttps://amazon.api.trendsapi.ai/mcp認証が必要

ツール

詳細

Amazon の商品検索需要 API

Trends API による Amazon の検索関心度とベストセラーフィード。スクレイパーを使わない EC 調査です。

ライセンス: MIT PyPI Python npm

キー:trendsapi.ai/#get-key。HTTP コントラクトとすべてのソース:trendsapi-ai/trendsapi。

認証

pip install trendsapi-amazon
export TRENDSAPI_KEY=your_key

Python 3.9 以降。HTTP API と同じキーを使用します。

from trendsapi_amazon import TrendsAPI

client = TrendsAPI()                    # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")

キーワードヘルパーの既定値は source: "amazon" です。同じクライアントでほかのプラットフォームを利用するには、source= を渡します。公式の完全版クライアント(すべてのソース、プリセットなし):trendsapi。

メソッド

メソッドREST mode戻り値
get_time_series(keyword, source=, data_mode=)get_time_serieslist[TrendsDataPoint]
get_growth(keyword, percent_growth=, source=, data_mode=)get_growthGetGrowthResponse
get_live(limit=, offset=, category=)get_top_trendsGetTopTrendsResponse
get_top_trends(type=, ...)get_top_trendsGetTopTrendsResponse

source は小文字です(amazon)。type は正確に指定してください(Amazon Best Sellers Top Rated)。両方を混在させると 400 エラーになります。

from trendsapi_amazon import TrendsAPI

client = TrendsAPI()                    # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")

series = client.get_time_series("standing desk")
print(series[-1].date, series[-1].value)

growth = client.get_growth("standing desk", percent_growth=["3M", "12M"])
print(growth.results[0].growth, growth.results[0].direction)

hot = client.get_live(limit=10)
print(hot.data)                         # [[1, "..."], ...]

get_time_series

points = client.get_time_series("standing desk")

各ポイント:

フィールド常に有無意味
dateはいYYYY-MM-DD
valueはいこの系列の 0~100 の指数
keywordはいエコー
volumeいいえ利用可能な場合の絶対ボリューム
source または datatypeいいえパイプラインのラベル

Python では list[TrendsDataPoint] が返されます。["date"] ではなく .date と .value を使用してください。 JS では同じフィールドがオブジェクトプロパティとして返されます。

get_growth

g = client.get_growth("standing desk", percent_growth=["12M", "3M", "YTD"])
print(g.results[0].growth, g.results[0].direction)

percent_growth の既定値:["12M"]。プリセット:7D 14D 30D 1M 2M 3M 6M 9M 12M/1Y 18M 24M/2Y 36M/3Y 48M 60M/5Y MTD QTD YTD。カスタム指定:{"name": "Launch", "recent": "2024-06-01", "baseline": "2024-01-01"}。

フィールド意味
search_termキーワード
data_sourceソース
results期間ごとに 1 つのオブジェクト(period、growth、direction、日付、値)
metadata件数/成功フラグ

複数の期間を指定しても、リクエスト数は 1 件としてカウントされます。Python:growth.results[0].growth。JS:growth.results[0].growth。

get_live

hot = client.get_live(limit=10)
フィールド意味
as_of_tsスナップショット時刻
typeフィード名
limit、offset、countページネーション
data[rank, label] の行

Python:hot.data。JS:hot.data。offset= と category= は任意です(Amazon Best Sellers by Category、Top Websites のみ)。

非同期

import asyncio
from trendsapi_amazon import AsyncTrendsAPI

async def main():
    c = AsyncTrendsAPI()
    return await asyncio.gather(
        c.get_time_series("standing desk"),
        c.get_time_series("standing desk", source="google search"),
    )

asyncio.run(main())

200 応答ごとに 1 件のリクエストとして課金されます。

Pandas

from dataclasses import asdict
import pandas as pd
from trendsapi_amazon import TrendsAPI

df = pd.DataFrame(asdict(p) for p in TrendsAPI().get_time_series("standing desk"))
df["date"] = pd.to_datetime(df["date"])
print(df.set_index("date")["value"].resample("ME").mean().tail())

JavaScript / TypeScript

npm install trendsapi-amazon

Node 18 以降、Deno、Bun、Workers に対応しています。同じ API キーを使用します。上記のフィールド一覧が適用されます。

メソッド
メソッドREST mode戻り値
getTimeSeries(keyword, { source, data_mode })get_time_series週次ポイント
getGrowth(keyword, { percent_growth, source, data_mode })get_growth成長オブジェクト
getLive({ limit, offset, category })get_top_trendsライブフィード
getTopTrends({ type, ... })get_top_trendsライブフィード
import { TrendsAPI } from "trendsapi-amazon";

const client = new TrendsAPI({ apiKey: process.env.TRENDSAPI_KEY! });
const series = await client.getTimeSeries("standing desk");
console.log(series.at(-1)?.date, series.at(-1)?.value);

const growth = await client.getGrowth("standing desk", {
  percent_growth: ["3M", "12M"],
});
console.log(growth.results[0].growth, growth.results[0].direction);

const live = await client.getLive({ limit: 10 });
console.log(live.data);                 // [[1, "..."], ...]

呼び出し(curl)

フィールド値
エンドポイントPOST https://api.trendsapi.ai/api
認証Authorization: Bearer $TRENDSAPI_KEY
履歴get_time_series または get_growth で source: amazon
キーワード商品名のフレーズ。例:スタンディングデスク
ライブ typeAmazon Best Sellers Top Rated、Amazon Best Sellers by Category
curl -sS -X POST https://api.trendsapi.ai/api \
  -H "Authorization: Bearer $TRENDSAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"mode":"get_time_series","source":"amazon","keyword":"standing desk"}'

ソースに関する注意事項

  • value は検索関心度を示す 0〜100 の指数であり、販売個数ではありません。
  • フィードでは現在売れている商品がわかります。キーワード系列では検索されている内容がわかります。
  • Google Shopping は別の source(google shopping)です。

エラー

HTTPクライアント
200ペイロードを解析しました。Python のデータクラス/JS の型付きオブジェクト
400エラーが発生します。source または type の綴りを修正してください
401エラーが発生します。TRENDSAPI_KEY を確認してください
404エラーが発生します。そのキーワードの系列はありません。再試行しないでください
429エラーが発生します。クォータに達しました
5xxクライアントが再試行した後、エラーが発生します

HTTP の body フィールドは JSON 文字列です。SDK はこれをデコードします。curl を直接使う場合は、body をもう一度解析する必要があります。

サイト:https://trendsapi.ai/trends/amazon-trends。

ライセンス

MIT。詳細は LICENSE をご覧ください。

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。