Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> bunch of regexes for clickbait titles

Can you please share which ad blocker you use and how we might use regexes to do this? Sounds fascinating and I want to do that myself



Not really just regex, I called it that for brevity. uBlock Origin's cosmetic filters, in particular :has-text which does indeed support regex.

It's basically CSS selectors, but with some very powerful ones added in too.

Check the docs for details https://github.com/gorhill/uBlock/wiki/Procedural-cosmetic-f...

The particular filters I use include things like:

    ! Kills "You won't believe something useless! Some subtitle"
    youtube.com##ytd-rich-item-renderer:has-text(/you won'?t .*!( .*)?/i)

    ! Kills "100 idiotic life hacks that are definite safety hazards!"
    youtube.com##ytd-rich-item-renderer:has-text(/(\d+) (.+)s/i)
And a bunch more more specific to my interests and native language, but I hope you got the gist of it.

Also look at the sibling comment about other distraction-removals like shorts and engagement callout taming.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: