我正在尝试在远程服务器(无浏览器)上运行puppeter-cluster,并希望使用Cluster.connect()我需要在哪里声明它?
const cluster = await Cluster.connect({
browserWSEndpoint: `wss://chrome.browserless.io?token=MY-TOKEN-HERE`,
concurrency: Cluster.CONCURRENCY_PAGE,
puppeteerOptions: {
headless: true,
},
maxConcurrency: 2,
monitor: true,
});