[英]Playwright stealth
I have been using puppeteer for a while, but decided to convert to playwright.我一直在使用木偶师,但决定转换为剧作家。 In puppeteer, there was a plugin
puppeteer-extra-stealth
which was able to hide headless chrome and websites did not detect headless mode.在 puppeteer 中,有一个插件
puppeteer-extra-stealth
能够隐藏无头 chrome 并且网站没有检测到无头模式。 Is there a similar thing for playwright?剧作家有类似的事情吗?
There is a playwright-extra
in development however according to the creator this won't include the stealth evasions.有一个
playwright-extra
正在开发中,但根据创作者的说法,这不包括隐形逃避。 See: https://github.com/berstend/puppeteer-extra/pull/303 for more information.有关更多信息,请参阅: https://github.com/berstend/puppeteer-extra/pull/303 。
That being said, you don't really need an external package in order to implement functionality that the puppeteer-extra-stealth
package offers.话虽如此,您实际上并不需要外部 package 来实现 puppeteer
puppeteer-extra-stealth
package 提供的功能。 Here is my attempt: https://gist.github.com/nicoandmee/1ec1b6a07c94f82df41d2496194ef3a6这是我的尝试: https://gist.github.com/nicoandmee/1ec1b6a07c94f82df41d2496194ef3a6
In addition to doing everything the puppeteer package is doing, my code is generating a unique browser fingerprint based on real data collected from google analytics.除了做 puppeteer package 所做的一切之外,我的代码还根据从谷歌分析收集的真实数据生成一个独特的浏览器指纹。 This fingerprint is then used as part of the "evasions."
然后将该指纹用作“逃避”的一部分。 It should be sufficient for most use-cases.
对于大多数用例来说应该足够了。
There is playwright-stealth , but it uses python.有playwright-stealth ,但它使用 python。 With that said, the API for playwright is very similar across languages, shouldn't be very hard to port it to the one you want to use it in.
话虽如此,用于剧作家的 API 在各种语言中都非常相似,将其移植到您想要使用的语言应该不难。
In playwright you can start the browser in a headful mode:在 playwright 中,您可以在 headful 模式下启动浏览器:
const browser = await playwright.firefox.launch(headless=false)
More about browser launch params: https://playwright.dev/docs/api/class-browsertype#browser-type-launch有关浏览器启动参数的更多信息: https://playwright.dev/docs/api/class-browsertype#browser-type-launch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.