From affb54155c3ffc64b1fd21804adf7afce059a930 Mon Sep 17 00:00:00 2001 From: Profitroll <47523801+profitrollgame@users.noreply.github.com> Date: Sat, 14 Jan 2023 13:24:44 +0100 Subject: [PATCH] User agent randomized --- PageSaver/package.json | 3 ++- PageSaver/pageSaver.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/PageSaver/package.json b/PageSaver/package.json index bbc651f..9634c86 100644 --- a/PageSaver/package.json +++ b/PageSaver/package.json @@ -1,5 +1,6 @@ { "dependencies": { - "puppeteer": "^14.4.0" + "puppeteer": "~19.5.2", + "user-agents": "~1.0.1260" } } diff --git a/PageSaver/pageSaver.js b/PageSaver/pageSaver.js index 1b241e5..e2f945f 100644 --- a/PageSaver/pageSaver.js +++ b/PageSaver/pageSaver.js @@ -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();