User agent randomized

This commit is contained in:
Profitroll 2023-01-14 13:24:44 +01:00
parent b97b10975d
commit affb54155c
2 changed files with 5 additions and 2 deletions

View File

@ -1,5 +1,6 @@
{
"dependencies": {
"puppeteer": "^14.4.0"
"puppeteer": "~19.5.2",
"user-agents": "~1.0.1260"
}
}

View File

@ -1,13 +1,15 @@
// npm install https://github.com/GoogleChrome/puppeteer/
const puppeteer = require('puppeteer');
const userAgent = require('user-agents');
(async () => {
const url = process.argv[2];
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setUserAgent(userAgent.random().toString());
await page.goto(url, {waitUntil: 'load'});
const html = await page.content();