r/qutebrowser • • Sep 30 '26

uBlock origin-like add-blocking script for qutebrowser

Disclamer first: this is a vibecoded script based on the original script I was using and uBlock's code

I have tried many different scripts to block youtube's adds, but all of them were imperfect... so I asked claude to improve the script that I was using based on uBlock's code. The result are two scripts that remove all the video adds, plus the banners and popups.

The scripts are here:

https://github.com/urtzienriquez/config_files/tree/main/qutebrowser/greasemonkey

I hope you like them! :)

PD: TheCompiler, have you thought about the possibility of making a "community repo" to share userscripts etc? In the absence of plugins, it could be a good way of centralizing these kind of things... but I get that that means more work for you, and it would be very reasonable that you don't want that "extra responsibllity".

PD2: Thanks for this incredible browser :)

14 Upvotes

4 comments sorted by

3

u/ZoWakaki Oct 01 '26

FYI, there is greasefork.

A place to share user-scripts. I have been using this for few years now, before that was using something from there.

2

u/urenur Oct 02 '26

Hey! Thanks for the page! Didnt know about it.

Yeah, thats actually the script I was using and in which the current one is based :) found it in some corner in github...

2

u/ZoWakaki Oct 03 '26

Yup, the wonders what a web search on your web-searcher-of-choice can yield, including within reddit.

While I did check both scripts, I did give you the benefit of the doubt that it was coincidence how certain arrays were populated.

E.g.:

 const cssSelectorArr = [
        `#masthead-ad`,//首页顶部横幅广告.
        `ytd-rich-item-renderer.style-scope.ytd-rich-grid-row #content:has(.ytd-display-ad-renderer)`,//首页视频排版广告.
        `.video-ads.ytp-ad-module`,//播放器底部广告.
        `tp-yt-paper-dialog:has(yt-mealbar-promo-renderer)`,//播放页会员促销广告.
        `ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-ads"]`,//播放页右上方推荐广告.
        `#related #player-ads`,//播放页评论区右侧推广广告.
        `#related ytd-ad-slot-renderer`,//播放页评论区右侧视频排版广告.
        `ytd-ad-slot-renderer`,//搜索页广告.
        `yt-mealbar-promo-renderer`,//播放页会员推荐广告.
        `ytd-popup-container:has(a[href="/premium"])`,//会员拦截广告
        `ad-slot-renderer`,//M播放页第三方推荐广告
        `ytm-companion-ad-renderer`,//M可跳过的视频广告链接处
    ];

compared to yours,

  const adSelectors = [
    '#masthead-ad',
    'ytd-rich-item-renderer.style-scope.ytd-rich-grid-row #content:has(.ytd-display-ad-renderer)',
    '.video-ads.ytp-ad-module',
    'tp-yt-paper-dialog:has(yt-mealbar-promo-renderer)',
    'ytd-engagement-panel-section-list-renderer[target-id="engagement-panel-ads"]',
    '#related #player-ads',
    '#related ytd-ad-slot-renderer',
    'ytd-ad-slot-renderer',
    'yt-mealbar-promo-renderer',
    'ytd-popup-container:has(a[href="/premium"])',
    'ad-slot-renderer',
    'ytm-companion-ad-renderer',
  ];

and how certain logic are implemented.

I am by no means an expert and I am not going to accuse you of plagiarism, as your work could be called transformative enough. And as I said benefit of doubt that it was mere coincidence. But some might consider it a dick move to ape a script, publish it as your own without giving a modicum of credit to the original script nor the author.

4

u/urenur Oct 03 '26

The script has in the description that is based in his script....