#input schema proxy configuration

1 messages · Page 1 of 1 (latest)

honest vector
#

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();

wooden pond
#

just use

        "proxy": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Select proxies to be used.",
            "prefill": {
                "useApifyProxy": true
            },
            "editor": "proxy"
        }
#

as field in properties

#

read it and pass into createProxyConfiguration

lean pasture
honest vector