はじめに
パラメーターの説明
| パラメータ | 型 | 説明 |
|---|---|---|
| actor | string | 非常に重要なパラメーターで、サービスを表します。スクレイパーのactorリスト情報を表示するにはクリックしてください |
| input | object | データスクレイピングタスクを完了するためにactorが要求するパラメーター。 |
| proxy | object | 国フィールド。この地域のプロキシを使用してリクエストを送信します。 |
入力フィールドの説明
| パラメータ | 型 | デフォルト | 説明 |
|---|---|---|---|
| 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);
});