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();
No description
4 Replies
helpful-purple
helpful-purple15mo ago
just use
"proxy": {
"title": "Proxy configuration",
"type": "object",
"description": "Select proxies to be used.",
"prefill": {
"useApifyProxy": true
},
"editor": "proxy"
}
"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
correct-apricot
correct-apricot15mo ago
Just as @Danek says, you can read more about handling inputs here: https://docs.apify.com/academy/getting-started/inputs-outputs
Inputs & outputs | Academy | Apify Documentation
Create an actor from scratch which takes an input, processes that input, then outputs a result that can be used elsewhere.
typical-coral
typical-coralOP14mo ago
Hi, I want to use Apify Proxy with native Puppeteer JS. Is this the correct setup? Thanks in advance! MAIN.JS: const input = await Actor.getInput(); const { proxyConfiguration } = input; const browser = await puppeteer.launch({ headless: "new", proxy: proxyConfiguration });
afraid-scarlet
afraid-scarlet13mo ago

Did you find this page helpful?