这里需要安装npm install puppeteer-extra puppeteer-extra-plugin-stealth,然后,在启动浏览器时,Puppeteer 会自动应用 Stealth.min.js 插件的功能。文章来源地址https://www.toymoban.com/news/detail-691605.html
const puppeteer = require('puppeteer-extra');
const StealthPlugin = require('puppeteer-extra-plugin-stealth');
async function removeBrowserFeatures() {
puppeteer.use(StealthPlugin());
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://example.com');
// 执行其他操作...
await browser.close();
}
removeBrowserFeatures();
文章来源:https://www.toymoban.com/news/detail-691605.html
到了这里,关于Puppeteer中使用Stealth.min.js库的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!