0.1.4 • Published 2 years ago
@fuseble.inc/puppeteer v0.1.4
Puppeteer Cluster
Example - Starter
import { PuppeteerCluster, wait } from '@fuseble.inc/puppeteer';
const cluster = await PuppeteerCluster.launch('clusterId', {
concurrency: 'BROWSER',
maxConcurrency: 2,
});
cluster.task('taskId', async (page, { browser, logger, clusterId, taskId, changeTask }) => {
await page.goto('https://example.com');
await page.screenshot({ path: 'example.png' });
await wait(1000);
});
await cluster.init();
await cluster.close();
Browserless Setting
Docker Setting
docker run -p 3000:3000 \
-e "CONNECTION_TIMEOUT=-1" \
-e "WORKSPACE_DELETE_EXPIRED=true" \
-e "WORKSPACE_EXPIRE_DAYS=7" \
-e "EXIT_ON_HEALTH_FAILURE=true" \
-e "DEFAULT_BLOCK_ADS=true" \
-e "DEFAULT_LAUNCH_ARGS=[\"--window-size=1920,1080\", \"--mute-audio\"]" \
--restart always -d \
--name browserless-3000 browserless/chrome:1-chrome-stable