通用抓取API快速入门入门

快速入门

参数说明

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

输入字段说明

参数类型默认值描述
urlstring目标网站
methodstringGET请求方法
redirectbooleanfalse是否允许重定向
headersobject自定义请求头字段

发送第一个请求

https://httpbin.io/get 的数据抓取为例。

通过 API 端点捕获数据

import { Scrapeless } from '@scrapeless-ai/sdk';
 
const client = new Scrapeless({
  apiKey: 'YOUR_API_KEY'
});
 
client.universal.scrape({
   actor: "unlocker.webunlocker",
   input: {
      url: "https://httpbin.io/get",
      redirect: False,
      method: "GET",
   },
   proxy: {
      country: "ANY",
   }
}).then(async (result) => {
    console.log(result);
  })
  .catch((error) => {
    console.error('Error:', error);
  });