このスクリプトは2社のNBAマネーラインを取得し、全ページをたどって、ブックメーカーごとに1行表示します。Node.js 18以降が必要で、パッケージは不要です。下の出力はNode.js 24のものです。
キーを設定する
ダッシュボードでキーを作成し、DINO_API_KEYとしてエクスポートします。スクリプトはAuthorization: Bearerヘッダーで送ります。
スクリプトを実行する
次をodds.mjsとして保存し、node odds.mjsを実行します。
const url = new URL("https://api.dino.markets/v2/odds"); url.search = new URLSearchParams({ league: "nba", markets: "moneyline", books: "draftkings,fanduel", limit: "5" }); const headers = { Authorization: `Bearer ${process.env.DINO_API_KEY}` }; let cursor = null; do { if (cursor) url.searchParams.set("cursor", cursor); const response = await fetch(url, { headers }); const body = await response.json(); if (!response.ok) throw new Error(`${response.status} ${body.error}: ${body.message}`); for (const event of body.events) { if (new Date(event.start_time) <= new Date()) continue; // only games that have not started const team = Object.fromEntries(event.participants.map((p) => [p.role, p.name])); console.log(`${team.away} at ${team.home}, ${event.start_time}`); for (const book of event.books) { const prices = book.markets[0].outcomes.map((o) => `${o.name} ${o.american}`); console.log(` ${book.name}: ${prices.join(", ")}`); } } cursor = body.next_cursor; if (!cursor) console.log(`${response.headers.get("x-requests-remaining")} credits left`); } while (cursor);
2026年11月25日03:33 UTCに実行した、最初の2試合と最後の行:
Miami Heat at Philadelphia 76ers, 2026-11-25T22:10:00Z DraftKings: Philadelphia 76ers -116, Miami Heat -102 FanDuel: Philadelphia 76ers -104, Miami Heat -112 Chicago Bulls at Charlotte Hornets, 2026-11-26T00:10:00Z DraftKings: Charlotte Hornets -163, Chicago Bulls +137 FanDuel: Charlotte Hornets -158, Chicago Bulls +134 ... 999960 credits left
試合をページで読む
limitは1〜100試合で、省略すると25です。next_cursorがnullでない間は、同じフィルターを付けてcursorとして送ります。スクリプトはループを示すために5にしています。
クレジットを数える
スクリプトが読む各ページは1回の呼び出しで1クレジットなので、limitを大きくすると同じ試合をより少ないクレジットで読めます。GET /v2/eventsは同じ試合を価格なしで一覧し、無料です。
エラーを読む
エラーのレスポンスにはerror、message、request_idがあります。キーが誤っていると、スクリプトは次の行で停止します。
Error: 401 unauthorized: API key is invalid or not tied to a subscription.
エラーのページにすべてのコードがあります。
質問
JavaScript SDKはありますか?
ありません。APIはHTTPS上のプレーンなJSONなので、組み込みのfetchで足ります。
Webページから呼び出せますか?
自分のサーバーから呼び出してください。キーを見られる人は誰でもクレジットを使えます。
1試合を取得するには?
イベントIDを指定してGET /v2/events/{id}/oddsを呼び出します。レスポンスにブックメーカーがある場合は1クレジットです。
429が返ったらどうすればよいですか?
rate_limitedはRetry-Afterの秒数待ちます。quota_exceededは翌月まで待つか、プランを変更します。