深度 SerpApi快速入门入门

快速上手

参数说明

参数类型描述
actorstring一个非常重要的参数,它代表一个服务。点击查看抓取器 actor 列表信息
inputobjectactor 完成数据抓取任务所需的的参数。
proxyobject国家字段,使用来自此区域的代理发送请求。

任务成功描述

  • HTTP 代码 200 表示任务已成功,响应体为数据。

任务进行中描述

  • HTTP 代码 201 表示任务正在处理中,请通过 taskId 获取任务结果。
{"message": "task in progress", "taskId":"30681c8b-bfd3-48eb-a7c9-006e40b00591"}

任务失败描述

  • HTTP 代码 429,请求过多。
  • HTTP 代码 400,请检查任务参数是否有效。
  • HTTP 代码 500,内部服务器错误。

请求示例

使用 Python 获取 Google 搜索数据

import { Scrapeless } from '@scrapeless-ai/sdk';
 
const client = new Scrapeless({
  apiKey: 'YOUR_API_KEY'
});
 
client.deepserp.createTask({
    actor: "scraper.google.search",
    input: {
        q: "Top news headlines",
        gl: "us",
        hl: "en",
        google_domain: "google.com"
    }
}).then(async (result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error('Error:', error);
  });