Created
May 10, 2024 14:41
-
-
Save LidiaKovac/3c3e840b528e495ca8943bdb6a6d0aef to your computer and use it in GitHub Desktop.
AWS EC2 Pupetteer configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const browser = await puppeteer.launch({ | |
headless: config.headless, | |
args: ["--no-sandbox", "--disable-setuid-sandbox"], | |
ignoreDefaultArgs: ["--disable-extensions"], | |
}) | |
const page = await this.browser.newPage() | |
await page.setRequestInterception(true) | |
page.on("request", (req) => { | |
if ( | |
req.resourceType() == "stylesheet" || | |
req.resourceType() == "font" || | |
req.resourceType() == "image" | |
) { | |
req.abort() | |
} else { | |
req.continue() | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment