跳转到主要内容

概述

本指南演示如何使用 Olostep 的 Batches 端点从流行的 AI 搜索工具(包括 Google AI Mode、Gemini、Microsoft Copilot、ChatGPT、Perplexity 和 Google AI Overview)获取数据。 通过利用每个平台的专用解析器,您可以大规模提取结构化的搜索结果,非常适合用于:
  • 竞争情报收集
  • 多平台搜索结果比较
  • AI 搜索引擎监控

请求制定

第一步:准备您的查询

创建一个您想要搜索的查询数组。在此演示中,我们将查询不同城市的新闻:
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'
];

第二步:为每个 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()
    };
  });
};

第三步:提交批量请求

使用生成的项目提交您的批量请求:
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 以获取支持或定制实施帮助。