使用 Brave 浏览器玩木偶? [英] Puppeteer with Brave browser?

查看:53
本文介绍了使用 Brave 浏览器玩木偶?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以使用 Brave 浏览器而不是基本版本的 Chromium 执行 puppeteer 脚本.我知道 Brave 是从 Chromium 开发的,因此您可以使用 brave 启动 selenium 脚本,但是您知道 puppeteer 是否也可以吗?

I'm wondering if it's possible executing a puppeteer script using Brave browser instead of the basic version of chromium. I know that Brave has been developed from chromium, and for that reason you can launch a selenium script using brave, but do you know if it's possible with puppeteer as well?

推荐答案

是的,您可以使用 Brave.唯一的问题是广告拦截不适用于无头模式.对于 headful 模式下的广告拦截,您需要设置/创建配置文件并将 userDataDir 选项指向它,因为 Brave 会在第一次启动时下载过滤器列表并存储这些个人资料中的列表.

Yes, you can use Brave. The only catch is the adblocking doesn't work with headless mode. For the adblocking in headful mode, you need to set/create a profile and point the userDataDir option to it because Brave downloads the filter lists the first time it launches and stores those lists in the profile.

const browser = await puppeteer.launch({
        headless: false,
        executablePath: "path/to/brave",
        userDataDir: "path/to/profile/dir"
});

这篇关于使用 Brave 浏览器玩木偶?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆