dimanche 27 septembre 2020

Puppeteer Random user-agent args

Recently I asked this random useragents from .json file but the thing is that after I added "capture screen" of puppeteer it keeps showing headless chrome, so I copied the previous topic answer into wrong place.

Now the real useragent js page came from this page:

const browser = await puppeteer.launch({
headless: false,
args: ['--headless', '--disable-infobars', '--user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36', '--no-sandbox', `--proxy-server=socks5://127.0.0.1:${port}`] : ['--no-sandbox'],

});

So how do I create rnadom list inside the arguments? My previous help which doesnt worked for me as the random useragents code was not in correct place is here: Puppeteer browser useragent list

But adding that code inside this wont work.

So after --user-agent= I want to add "random" function but how?




Aucun commentaire:

Enregistrer un commentaire