Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Show HN: Let's Block It – Custom uBlock Origin Filters Made Easy (letsblock.it)
261 points by xvello on Jan 24, 2022 | hide | past | favorite | 82 comments
uBlock Origin is more than an ad-blocker, it's a general purpose content filter that can be leveraged to hide low-quality content from pages you browse. While the main filter lists can remove mailing list popups and obvious nags, the definition of low-quality content is personal, so one size cannot fit all.

I used to have an ad-hoc script to render and publish a personal uBlock Origin filter list, added to all my browsers. The goal of this project is to enable more people to build such a list custom list to filter out low-quality content and nags. Chose from a list of community-maintained templates, set your options, add your custom rules, and get your personal filter list.

Code and content are licensed under the Apache 2.0 license and hosted on https://github.com/xvello/letsblockit. The project is still pretty young and needs more filter templates, and lots of frontend improvements (my last web project was in 2005, this is not my forte). Any feedback is welcome!



It's fascinating to browse HN history and see what uBlock rules HN'ers have considered worth writing comments about. The unique syntax makes it very easy to find those:

https://hn.algolia.com/?query=%23%23%20ublock&type=comment&d...

("## ublock")


The last line of your comment means this search is recursive.


Personal customized filters are a great idea! Congrats!

Here's something that might help others. On Whatsapp groups some users can become obnoxious, and one can fall into the trap of responding to their trolling. Yet AFAIK it's impossible to hide contributions from a given user in a group; one can only leave the group.

When using WhatsApp in the browser, a uBlock filter can hide contributions from a given user like this:

    web.whatsapp.com##div.message-in:has(div.copyable-text[data-pre-plain-text*="name_of_user"])
This hides text messages (even successive ones where the username isn't displayed) but doesn't hide messages with only images or other media. For those it's more difficult as the username is in a span that has no consistent characteristics; the username has to be unique and complete in order to not trigger false positives.

Or maybe there's a better way. Suggestions welcome.


That's the kind of filters I started this project for!

I would not accept this template in the project though, as I am not willing to endorse usage of Facebook/Meta's websites. This is listed in the project limitations in https://letsblock.it/help/contributing


Yet you include Google and YouTube?

WhatsApp is hugely popular in Europe and Asia, I don't see including a filter as an endorsement.


Including a filter for a platform could be seen as criticism. "Gotta use third party custom filters to make the platform useable."


Or how about not trying to read intentions into peoples actions (or reading their minds for that matter) and just providing a non-biased service?

The hubris in "That's the kind of filters I started this project for! I would not accept this template in the project though"

is just breathtaking. At least I now know not to waste my time with a project that can have such arbitrary and capricious restrictions based on the founders whims and personal biases. Maybe I don't like Facebook/Meta either but have something that requires their use - wouldn't being able to filter out the worst aspects of them still have significant value? Even more value?

Pretending things will cease to exist just because you don't like them is beyond juvenile levels of reasoning.


Still waiting for one that blocks FB ads. I gather Meta spends a lot of effort to make it hard though, contrary to most sites I've come across. Makes sense given their business model, I don't doubt that.


FBPurity (.com) seems to spend most of its time on that case. Works pretty well for months at a time, then FB changes something, and a new FBP update comes through a few days later.


I just block the entire facebook domain on NextDNS :-)


Yandex is one company that's known to put effort into resisting ad blockers—to the point that uBlock/AdBlock filter authors had to just give up. So it's certainly possible for FB.


This filter seems to work for me, but it'll probably break soon.

    ##:xpath(//div[@role="feed"]//div[.//a[@aria-label="Sponsored"]])


If you inspect the markup of Facebook ads you’ll see it’s beyond insane.


Yeah. That little block of text that says "Sponsored" alone is 4,224 characters of nonsense. https://pastebin.com/DZdNkiw2


That's insane!


The insane but logical outcome of the arms race between advertisers and adblockers.


I tried to scrape a private Facebook group once and came away with the same takeaway about that markup. They junkify everything so aggressively that it might actually be easier to render the page in a headless browser and "scrape" it with OCR.


Side note: this remembered me back in late 2000s there was a Firefox extension called RIP (Remove It Permanently) for the same use case. And Aardvark (later: HackTheWeb) for cleaning temporarily (before printing etc). IIRC they didn't survive gradual Firefox engine changes between v20 and v57. Anyway, good old times.


Just a heads up it's "reminded me", not "remembered me". When we're reminded of something, we then remember it.

I see ESL users trip on this one a lot.


If you want to get really fancy run uBlock in browser + NextDNS + block the IP's of all commonly known DNS on your router firewall. Then make sure everything (browsers, networking hardware, mobile devices) is doing DoH or DoT to NextDNS.

This way smart devices and apps cannot hardcode an IP for encrypted DNS to get around your DNS settings.

Works great for Roku - no more ads anywhere!


I've wondered if twitter and similar sites (google news?) are not running afoul of any accessibility laws. I've wanted to apply ublock origin rules but twitter does not have any aria tags and all the CSS rules are auto-generated and compressed (obfuscated?) so it's hard to make any rules that don't rely on content


I found this to be extremely annoying as well. I tried to block the trending container but it keeps being on some subpages.

It is absolutely annoying, but I think it’s a result of Twitter using react-native-web and not (primarily) an obfuscation tactic


uBlock Origin can block network requests too. These rules should block requests to trending hashtags and recommended user accounts:

  ||twitter.com/i/api/2/guide.json$xhr,1p
  ||twitter.com/i/api/1.1/users/recommendations.json$xhr,1p
Alternatively you can use nitter.net to browse Twitter


Thank you! Didn’t know that this was possible, I’ll give it a try!


This is awesome. I think it'd be useful to add filters for blocking sites that just copy SO and similar websites.


Agreed! I have lots of them in my list, using https://letsblock.it/filters/search-results as a template. I'm investigating adding presets to this filter (check a box to block the SO / github clones, they'll be added to the filter input alongside your blocked sites).


Reminds me of https://github.com/iorate/ublacklist

Hopefully you will add the startpage.com search engine (has same results as google) too :)


startpage.com (text results for now, I'll do image search later) support has been added to https://letsblock.it/filters/search-results ; enjoy!


Maybe you can fork it from the posted as the reply to the parent comment.



Another one that got commented in other similar topics is this one, albeit not updated since last month:

https://github.com/stroobants-dev/ublock-origin-shitty-copie...

It was the same as quenhus, but with Pinterest added.


I didn't realise uBlock Origin was so powerful, can hide authors from websites that you don't enjoy.

theguardian.com##.fc-item__byline:has-text(Zoe Williams):upward(.fc-slice__item)


Is this not just shoving your head in the sand though?


Seriously? You have infinite time? Please share your time lord secrets.


If you're going to bother with accounts it's a bit annoying that you can't just contribute directly from your account. Having to create a pull request is slightly annoying.

And at this point my personal list of uBlock rules is tailored to satisfy some very specific personal needs which I'd feel a bit apprehensive about just sharing without some degree of anonymity. Heck there are rules that would allow you to identify my account on other social media.

Also if this is to get as popular as userscripts/styles are/were then some way of finding rules per webpage would be nice.


Thanks for your feedback.

As this is just a humble weekend project, I had to cut in scope in order to move forward. This is why the project has no back-office and relies on Github for content contribution. I made this choice because the uBlock, EasyPrivacy and AdGuard communities are using the same tool to maintain their lists. I am open to changing that flow later this year, but not in the immediate future.

I understand your privacy concerns, and invite you to read https://letsblock.it/help/privacy to show that I take it seriously. AFAIK, Github is pretty lenient on identity, and wouldn't blink if you opened a throwaway anonymous account to contribute. You can also keep custom rules in https://letsblock.it/filters/custom-rules without necessarily contributing them as templates.


This is a great idea and is something similar to what I was thinking of implementing in the ad blocker that I develop.

Some suggested improvements would be to actually use domain names ('*.google.com') as the way to classify filters instead of just tags ('google'). This would make it possible to integrate with an ad blocker that automatically suggest filters to enable when you are browsing a specific website.

E.g. when you are browsing Google you could see the list of suggested filters you could enable for that site based upon the filters from letsblock.it

It would also probably be necessary to add some rating or scoring of the filters in the future to sort and flag those which are most helpful vs. those which are out of date or no longer work.


I really like the idea, I'm less enthused about the account tie-in, even though I do get why it exists. I'm not sure off the top of my head what a better solution would even be. It is good that you can still manually maintain your own filters if you want and just copy the rules in, so there's value here even for people who don't want to make accounts.

And I do really like the effort to make this kind of stuff more accessible, I think it's understated how important it is to have a nice a site with a tutorial saying "here's how you add a filter", and that there's a ton of value in making it easier for normal people to update that. I'm happy to see people helping to meet that need.

----

I'll look into possibly making a pull request when I have more time, but for whatever it's worth, here are my HN rules that hide my own karma from me without otherwise messing with any of the site's formatting. I've found that making my own karma invisible helps me avoid some of HN's more toxic qualities:

  news.ycombinator.com##.comhead .score:style(overflow: hidden; display: inline-block; line-height: 0.1em; width: 0; margin-left: -1.9em;)
  news.ycombinator.com##.comhead:not(.sitebit):style(overflow:hidden; display: inline-block);
  news.ycombinator.com###hnmain > tbody > tr:first-of-type table td:last-of-type .pagetop:style(font-size: 0!important; color: transparent!important;)
  news.ycombinator.com###hnmain > tbody > tr:first-of-type table td:last-of-type .pagetop > *:style(font-size: 10pt; line-height: 1.45em;)
  news.ycombinator.com###logout::before:style(content: "|"; padding: 0.25em;)
  news.ycombinator.com##form.profileform tbody tr:nth-child(3)
HN is pretty annoying to customize because the generated HTML is so bad, but the site is also really static, so filters almost never need to be updated. I've got a couple more janky ones that I use for blocklisting certain users or filtering articles, but they're not really reliable or consistent enough for me to share imo.

Caveats: I haven't tested these on mobile because I tend to avoid HN on mobile anyway, but I probably should test them sometime to make sure they don't break anything there. Also, some of these rules won't completely hide the elements from screen readers. It won't break anything, it just won't get rid of every reference to your karma. Unfortunately because of how HN's HTML is set up, it's kind of tricky to do better, but maybe I can try to think of something later that works better.


Thanks for your feedback, and your filter suggestion!

The first iteration of this project was a CLI that took a yaml file (simple map of filter name -> params) and rendered the filter list to stdout. I ran that binary in a netlify pipeline to publish my list for personal use. As the filter data is hosted alongside the sources, it would be pretty simple to add back that offline rendering capability, or run a self-hosted instance.

As you said, I moved away from the CLI and towards a website to make it more accessible for everyone. The UX is still not great (especially the manual refresh via the uBlock interface), but hopefully we can improve on this front with more visibility.


Created an issue to track work on this topic: https://github.com/xvello/letsblockit/issues/51


I'd love a way to suggest ideas. For example, the 'clean up google search result' filters don't include "People also search for", which can be removed with: google.*##[id^="eob_"]


Hello! The best way for this would be to open a "Filter update" issue in the github repo: https://github.com/xvello/letsblockit/issues/new/choose. I'll make sure to add a link from the view filter page.

I was confused because the "People also ask" section is correctly hidden, and I had to google about this "People also search for" thing that pops up when you bounce back from a search result. Thanks for the pointer!

As I've seen the `eob_` id prefix on other contextual blocks, I think I'll go with a more selective filter: `google.*###rso div.g div[jscontroller]`. It hides every "smart" blocks inside organic search result entries. Deploying right now!


Here's the ever-present warning when employing any ad-blocking: make sure you whitelist friendly blog sites, they need your ad money to operate! (Not that there is anything wrong with this project, just keep that in mind).

I do understand that this is something completely different, and it solves a real problem. Great job! Welcome back to the game, xvello, 2005 was a long time ago...

I might pop into the repo later and see about contributing.


> Here's the ever-present warning when employing any ad-blocking: make sure you whitelist friendly blog sites, they need your ad money to operate! (Not that there is anything wrong with this project, just keep that in mind).

I'd prefer blogs do what Serious Eats did for a while; if you blocked ads, they showed a message in its place saying "we get it completely, but consider donating". I'll happily donate or hop on a Patreon for a site I keep coming back to if you make it possible.

I block ads as a security measure, regardless of how much I appreciate/trust a site.


All of this is valid. While writing that comment, I had in mind a particular blog, one that responsibly displays its ads. I do get wanting to get rid of ads on sites I don't care about.


There's no blog I know of that is worth any ads they may want to display. This broad acceptance of using ads to generate revenue has warped the internet. It encouraged tracking, and finding out as much personal details, use of AI, etc. Best thing we can do is block all ads.


Hopefully you pay for the content you enjoy then?


many cases, I can't because it relies solely on the ad model. But paying for it really isn't the point, the whole point is advertising isn't semi benign like it was in broadcast TV / Newspapers of old. There is now massive incentive to essentially to target individuals specifically by gathering as much data about them and who they know and are influenced by and trying to predict / influence behavior. We have already seen when used for political advertising, it's been done for social engineering and influence the outcomes of elections in a way that is quite insidious. Weirdly, other than a minority, not many are worried about it because it is invisible. Mandate something to people, and there's a lot of yelling and screaming, but if you can do this without people feeling like they have been targeted, no problem!


I have some of these same feelings. But for me, those feelings are complimented by the conviction that without these kinds of monetization, the Internet would be largely useless. Of course, some might argue that this version of the Internet would be better for us as a society.

Regardless, in our capitalistic society, we couldn't enjoy things on the Internet without money flowing through it like this.


That friendly blog site includes trackers. They won’t get my money until they respect my privacy.


It would be great to see screenshots of what each option will block. Although many are obvious, some are less clear.


Agreed! I decided to launch without it due to limited time, but will keep that in the top priorities. Contributions are welcome if some users have time to contribute screenshots!


This is a great idea, I like that you can generate lists for DuckDuckGo as well. It'd be cool to also see lists for SearX, too. I see a lot of these list websites online but this one allows for more specific use cases rather than the "block everything" ones that I usually find.


Thanks for the feedback! Adding another search engine to the search-results filter is pretty easy. For reference, the (handlebars) template for it is available at https://github.com/xvello/letsblockit/blob/main/data/filters...

The tricky part about SearX is that it runs on several domains, while uBlock Origin cosmetic filters need to be scoped to a given domain name. We'd need to add a parameter to specify the instance(s) on which you want the filter to be generated. If you want to follow up on this, would you mind opening an issue at https://github.com/xvello/letsblockit/issues/new?template=up... to help me with the testing?


Created an issue to track work on this topic: https://github.com/xvello/letsblockit/issues/50


I do some custom filters for blocking useless elements on websites (paywall popups, long-footers, useless notifications, copyright statements etc, useless images on news websites) mainly using the uBlock picker. Here's some of them: https://www.toptal.com/developers/hastebin/goconuxufi.pl, will try to suggest these to letsblockit later.


Thanks, I'll give a look at your list! I feel like the best way to handle "small tweaks" would be to group them by target website, and use "Cleanup Google search result pages" as an example. Here's the source file for it: https://github.com/xvello/letsblockit/blob/main/data/filters...


These days what I typically want to block are the gdpr modals that pop up that demand you read and interact with a bunch of legalese or click I surrender, own me.


DNT was supposed to be a solution. Companies who insist on nagging you until you "voluntarily consent" are to blame. I'm not sure what killed DNT but it seems like they're trying to revive it again in Europe: https://news.ycombinator.com/item?id=30022523

No doubt companies who want to violate your privacy will lobby hard against this.


I remain convinced Do Not Track was a piece of sophisticated satire. The notion that companies would stop ad tracking because you asked them nicely is so openly ludicrous that no one could have seriously expected it to work.


Then are the consent popups satire too? To me the header would've just been a way to say "no consent" without requiring you to play whack a mole with popups.

If DNT is satire and consent popups are too, are these fines also a joke? https://www.enforcementtracker.com/


They are absolutely a joke when you consider the profits of the fined companies.


I don't know about that.

Google was fined 150 million EUR for not having a simple "refuse all" button in their consent nag. A single button. The complaint was that refusing is not as easy as accepting all cookies.

150M EUR is relatively small compared to Google's wealth, but so is the infraction. And they can't just write it off as a cost of doing business and continue the violation, because they were given a deadline to fix it and from there on a penalty of 100k EUR per day. Actually I don't have the data to do the maths but I seriously doubt Google's practice of making of you click a few times instead of once can make them 100k EUR per day in profit. And if it did, I'm sure the authorities would eventually increase the fine.

Assuming the fine results in compliance, it really doesn't look like a joke to me.


> The complaint was that refusing is not as easy as accepting all cookies.

How many other websites violate this rule and are allowed to get away with it for 4 years now (GDPR went into effect in 2018)? How many businesses are based on denying users their privacy rights? TrustArc's entire business is to provide an obnoxious, non-compliant consent popup as a service.

The Google ruling is a welcome development but doesn't invalidate the fact that enforcement is still very much lacking.


You might be interested in the Adguard Annoyances [1][2] blocklist which is easily added to uBlock Origin, just by ticking a checkbox in the "Filter lists" tab of the settings.

[1] https://kb.adguard.com/en/general/adguard-filter-policy#anno...

[2] https://github.com/AdguardTeam/AdguardFilters/tree/master/An...


Seriously, I don’t live in Europe, so why do I have to click the cookie agreement buttons?


So you start hating privacy laws


GDPR applies to EU citizens wherever they are in the world, so unless they know for sure that you're not an EU citizen, they have to give you the prompt.


In that case, I’d like a browser setting that allows me to indicate that I am not an EU citizen. Then a website could check for that flag and not bother me.


I agree that this is getting out of hand.

I investigated this, but as more and more websites are non-functional until you chose a consent option, just hiding the modal with a cosmetic filter won't help. There are several browser extensions to achieve this, and I feel like this is a superior solution than my project.


I don't use personally but this might be of interest for you:

https://github.com/r4vi/block-the-eu-cookie-shit-list


Is there a way to use uBlock Origin in Safari on iPhone/Mac?


You can't¹. There is a new browser called Orion² currently in private beta that uses the same engine as Safari, which you can use Firefox and Chrome extensions on. It works both on Mac, and surprisingly on iOS. I believe it's the only browser on iOS that allows you to use -some- desktop extensions. I use uBlock Origin with it on iOS and it works good enough.

¹ https://github.com/el1t/uBlock-Safari/issues/158

² https://browser.kagi.com/


Use it on desktop myself, big fan of having a vertical tab bar implementation that isn't garish to look at on macOS. And thank god I found Orion, I was using Adguard on desktop and was thinking about enabling their HTTPS filtering behavior but that just seemed like such a bad idea


Thank you so much for your work, a very easy to use interface! Hopefully you will add Facebook or Twitter post blocking in future updates!


Why not use Firefox builtin uBlock cloud sync and just copy paste filters from this site?, instead of creating account for this website.


Very good question! You are indeed free to copy the rendered filters to your uBlock settings (there is even a button for this). I see two reasons for using the account feature:

- I would never sync the same Firefox profile on my personal and work laptops, with letsblock.it I can use the same custom list on different Firefox profiles

- Rules will eventually break when websites are updated / redesigned. When that happens, one contributor can PR the fix for everyone, and you'll get it in the next 24h (uBlock Origin's minimal filter list refresh rate)


Cool. However, contributions via PRs are a bit more complicated than it needs to be.


Nicely done - thanks!


uBlock is starting to become a one-stop shop unicorn!


Offtopic: are "Show HN" topics with both link and text a new feature? The Submit page still says "If there is no url, the text (if any) will appear at the top of the thread.".

If it's a new feature, I find it extremely useful.





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

Search: