通过 /etc/hosts

问题描述

我正在抓取一些网站以获取他们在 Python 中使用 selenium内容。我可以通过 firefox 运行无头 geckodriver,将 marionette 功能设置为 True,启用 adblockplus 扩展并且它运行良好。但是,最近版本的 firefox(截至 2021 年 3 月)不支持性能日志记录 - 这对我来说是必须的。所以我不得不改用 chromedriver 和 Chromium。日志记录功能很好,但在无头模式下运行时,chrome 不支持浏览器扩展并引发错误

所以我认为我一直将 chromedriver 与 Chromium 一起使用,但没有 adblockplus 或任何其他广告拦截确实损害了我的运行时,并且有一些叠加层,否则不会存在。

如何找到并提取我的 adblockplus 浏览器扩展的过滤器列表,以便我可以通过使用其中的域名和我的 /etc/hosts 文件来应用相同的过滤,即发送所有那些“坏”域到 0.0.0.0

解决方法

如果您打开设置并单击高级。你会看到过滤器。每个过滤器都指向一个 url,在那里存储。

enter image description here

1.我之前链接的简单列表:https://easylist-downloads.adblockplus.org/easylist.txt 2. ABP 过滤器 https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt