New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(plugin-stealth): Add new user-agent-language-platform plugin #104
Conversation
@Niek Interesting, thanks a lot for this PR! I wasn't aware that you could modify the Would you mind adding a test file that does before/after tests with this plugin? I would do it myself but there's no good way in Github (that I'm aware of) to push commits to this PR (without a new PR and you losing the "Contributor" status). :) Is there a specific reason to add The rest (userAgent, acceptLanguage, platform) is set by a single Thanks again! |
Once you add a test file you can specifically run it like so (from the root of the yarn ava -v ./evasions/webgl.vendor/index.test.js |
packages/puppeteer-extra-plugin-stealth/evasions/user-agent-language-platform/index.js
Outdated
Show resolved
Hide resolved
@berstend Thank you for the amazing repo! I will add the tests ASAP to the PR. I have removed the |
I added the tests, let me know if you need other changes @berstend |
@Niek awesome, thanks a lot! Will look at the PRs asap. :) |
@Niek thanks again and apologies for the delay (I'd like to blame the holidays) 😄 I've removed the Will merge in some other fixes & PRs and do a release afterwards. :) Thanks! 👍 |
Released in |
Awesome, thanks for the great work! |
What if i want to randomize User Agent? Use separate plugins or there exists skip function? |
This plugin basically replaces the following evasions:
https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions/accept-language
https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions/navigator.languages
At the same time, it fixes #91
Instead of changing request headers and the
navigator.languages
(navigator.language
was missing by the way) properties as in the evasions above, we use callsetUserAgentOverride
in the CDP Network domain directly which is a better way of achieving this.In addition, this evasion allows setting the
navigator.platform
andnavigator.vendor
properties, which makes it a lot less easy to detect puppeteer.