puppeteer-extra
puppeteer-extra copied to clipboard
Add 'user-agents' package
The user-agents package is updated daily to include popular user agents. For instance, a random ua sample:
{
"appName": "Netscape",
"connection": {
"downlink": 10,
"effectiveType": "4g",
"rtt": 0
},
"platform": "Win32",
"pluginsLength": 3,
"vendor": "Google Inc.",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36",
"viewportHeight": 660,
"viewportWidth": 1260,
"deviceCategory": "desktop",
"screenHeight": 800,
"screenWidth": 1280
}
I would use a custom function as indicated in puppeteer-extra-plugin-anonymize-ua, but I would also like to implement the other ua data, such as viewport, platform, etc.
What would be the best way to go about adding the user-agents
library to either puppeteer-extra-plugin-stealth
or puppeteer-extra-plugin-anonymize-ua
?
For the time being you could use the custom function feature of the puppeteer-extra-plugin-anonymize-ua
plugin. :)
puppeteer.use(require('puppeteer-extra-plugin-anonymize-ua')({
customFn: (ua) => "MyCustomUserAgent/1.0"
}))
This sounds like a nice addition to puppeteer-extra
, will implement it when I find some time.