メインコンテンツへスキップ

概要

このガイドでは、OlostepのBatchesエンドポイントを使用して、Google AI Mode、Gemini、Microsoft Copilot、ChatGPT、Perplexity、Google AI Overviewなどの人気AI検索ツールからデータを取得する方法を示します。 各プラットフォームに特化したパーサーを活用することで、大規模な構造化検索結果を抽出でき、以下の用途に最適です:
  • 競合インテリジェンスの収集
  • 複数プラットフォームの検索結果の比較
  • AI検索エンジンの監視

リクエストの作成

ステップ1: クエリを準備する

検索したいクエリの配列を作成します。このデモでは、異なる都市のニュースをクエリします:
const axios = require('axios');

// 設定
const CONFIG = {
  url: 'https://api.olostep.com/v1/batches',
  token: 'YOUR_API_KEY_HERE'
};

// デモ: 異なる都市のクエリを生成
const BASE_QUERY = 'what is the news today in';
const CITIES = [
  'New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix',
  'Philadelphia', 'San Antonio', 'San Diego', 'Dallas', 'San Jose'
];

ステップ2: 各AIツールのアイテムを生成する

各AI検索ツールには特定のパーサーIDとURL構造が必要です。以下は各プラットフォームのアイテム生成関数です:
パーサーID: @olostep/google-aimode-results
const generateAIModeItems = () => {
  return CITIES.map((city, index) => {
    const query = `${BASE_QUERY} ${city}`;
    const encodedQuery = encodeURIComponent(query);
    return {
      url: `https://google.com/aimode?q=${encodedQuery}`,
      custom_id: (index + 1).toString()
    };
  });
};

ステップ3: バッチリクエストを送信する

生成されたアイテムでバッチリクエストを送信します:
const response = await axios.post(CONFIG.url, {
  parser: { id: '@olostep/gemini-results' },
  items: generateGeminiItems()
}, {
  headers: {
    'Authorization': `Bearer ${CONFIG.token}`,
    'Content-Type': 'application/json'
  }
});

const batchId = response.data.id;
注意: 送信後、結果を取得するために完了をポーリングしてください。

レスポンス形式

バッチリクエストを送信し、完了をポーリングした後、以下の形式でレスポンスを受け取ります:
{
  "url": "https://www.google.com//search?q=what+is+the+news+today+in+Austin&hl=en&udm=50&aep=11&newwindow=1&sei=mt_oaPvDBrKh5NoPy9W1sQE&mstk=AUtExfANCngr4KIDEH7t1EJsJ3xHfdsjka647_hz7r0UJWh1VM4FhWV9j1f2QOy0ylJU2l9-zWCxfORo5WzWeAN52_oVMM7nGAgEIRdyzsjtT7h1qhBn8Qj2RiN8HFQke6uYjmqnTeR4O1opgHbiLdAe5ZNfkzDyE_9O2zE&csuir=1",
  "prompt": "what is the news today in Austin",
  "answer_markdown": "In Austin news, officials announced that progress has been made on the city's homelessness response \n\n.  \n\n**Top story: Homelessness**  \n\n* Austin officials and local advocates reported \"real, measurable progress\" in addressing the needs of the city's homeless population.\n* The announcement came ahead of a report from the Ending Community Homelessness Coalition (ECHO)... ",
  "sources": [
    {
      "url": "https://www.kxan.com/video/austin-mayor-citys-decreased-homelessness-is-a-big-deal/11151402/#:~:text=Elected%20city%20and%20county%20officials%2C%20along%20with,experiencing%20homelessness%20in%20Austin.%20Read%20More:%20https://www.kxan.com/news/local/austin/echo%2Dto%2Dpresent%2Dreport%2Don%2Dstate%2Dof%2Daustins%2Dhomelessness%2Dresponse%2Dsystem/",
      "title": "KXAN\n·",
      "description": "Austin mayor: City's decreased homelessness is 'a big deal'",
      "icon": null,
      "domain": "https://www.kxan.com",
      "cited": true
    },
    {
      "url": "https://www.fox7austin.com/tag/us/tx/travis-county/austin/east-austin#:~:text=Austin%20pd%20arrests%20man%20in%20deadly%20east%20austin%20double%20shooting",
      "title": "FOX 7 Austin",
      "description": "East Austin",
      "icon": null,
      "domain": "https://www.fox7austin.com",
      "cited": true
    },
    ...
  ],
  "country": null
}
完全なレスポンス例:

価格とジオロケーションマトリックス

以下の表は、国別の検索サポートと各パーサーによるクレジット消費量を示しています。
機能Google AI ModeChatGPTPerplexityGoogle AI OverviewGeminiMicrosoft CopilotGrok
対応国
バッチサイズ制限2500250025002500250010001000
クレジット3533333

対応国の確認

以下のエンドポイントを使用して、各パーサーの対応国リストを取得します:
GET https://api.olostep.com/v1/countries?service=batches&parser={parser_id}
リクエスト例:
curl "https://api.olostep.com/v1/countries?service=batches&parser=@olostep/perplexity-results"
何か不足しているものがありますか?サポートやカスタム実装の支援については info@olostep.com までお問い合わせください。