快速入门
参数说明
参数 | 类型 | 描述 |
---|---|---|
actor | string | 一个非常重要的参数,它代表一个服务。点击查看抓取器 actor 列表信息 |
input | object | actor 完成数据抓取任务所需的的参数。 |
proxy | object | country 字段,使用来自该区域的代理发送请求。 |
输入字段说明
参数 | 类型 | 默认值 | 描述 |
---|---|---|---|
url | string | 目标网站 | |
method | string | GET | 请求方法 |
redirect | boolean | false | 是否允许重定向 |
headers | object | 自定义请求头字段 |
发送第一个请求
以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);
});