puppeteer-extra
puppeteer-extra copied to clipboard
user agent override incorrect behavior
Hi. Thanks for this absolute awesome plugin.
I think I found a bug in user agent override:
By default, you are using puppeteers default user agent and strip away the headless part:
async onPageCreated(page) {
const override = {
userAgent:
this.opts.userAgent ||
(await page.browser().userAgent()).replace(
'HeadlessChrome/',
'Chrome/'
),
acceptLanguage: this.opts.locale || 'en-US,en',
platform: this.opts.platform || 'Win32'
}
while you set platform
to 'Win32'
.
In the end you will however have a user agent that includes (X11; Linux x86_64) (because that is puppeteers default user agent that you retrieve with await page.browser().userAgent()
) while your platform is set by default to Win32.
This is detected by fingerprint2.js in the form of hasLiedOs = true
...
Best, NIkolai