ill-bronzeI
Apify & Crawlee2y ago
6 replies
ill-bronze

input schema proxy configuration

Hi guys, how to insert proxy configuration on my scraper?



INPUT SCHEMA:
{
"title": "PlaywrightCrawler Template",
"type": "object",
"schemaVersion": 1,
"properties": {
"startUrls": {
"title": "Start URLs",
"type": "array",
"description": "URLs to start with.",
"editor": "requestListSources",
"prefill": [
{
"url": "https://apify.com"
}
]
}
}
}

MAIN.JS:

import { Actor } from 'apify';
import { PuppeteerCrawler } from 'crawlee';
import { router } from './routes.js';

await Actor.init();

const input = await Actor.getInput();
const startUrls = input?.startUrls || [{ url: 'https://apify.com' }];

const proxyConfiguration = await Actor.createProxyConfiguration();

const crawler = new PuppeteerCrawler({
proxyConfiguration,
requestHandler: router,
});

await crawler.run(startUrls);
await Actor.exit();
image.png
Was this page helpful?