Hacker News new | past | comments | ask | show | jobs | submit login
uBlock Origin rules for HN: removing MSM news sources reduces systemic stress
88 points by h_o_o_t on Dec 3, 2023 | hide | past | favorite | 40 comments
I recently added some uBlock Origin rules for HN that remove news sources focusing principally on `The` News rather than technical topics and the net result has been a much more pleasurable experience on par with HN from a few years ago.

I can read the `news` news in many places, and I do, but I like to come here for industry and niche technical topics.

Many I've spoken to share this sentiment and I hope this is of benefit to anyone wishing to focus more on what they are interested in.

You can block a source or keywords with the same rule:

news.ycombinator.com##table:not(.fatitem) tr > td.title:has-text(/{phrase1}|{phrase2}/):nth-ancestor(1)

e.g. a brief sample of sites that are not principally about technology and recur somewhat frequently (choose your own):

  news.ycombinator.com##table:not(.fatitem) tr > td.title:has-text(/businessinsider.com|dailymail.co.uk|foxnews.com|theverge.com|cnn.com|reuters.com|zerohedge.com|insider.com|bloomberg.com|euronews.com|theguardian.com|wsj.com|ft.com|theconversation.com|thetimes.co.uk|bbc.co.uk|nytimes.com|newyorker.com|theatlantic.com/):nth-ancestor(1)
or simply a phrase:

news.ycombinator.com##table:not(.fatitem) tr > td.title:has-text(/web3|crypto/):nth-ancestor(1)

This rule isn't perfect as it only removes the title line and keeps the number of comments, but it is definitely good enough and I am enjoying reading HN a great deal more.

You can add these to your Android phone too with Firefox and uBO.




The problem is that HN will typically be the only place that will debunk these news stories and distill them into facts as opposed to sensationalism.

I am also surprised you put the Verge in there but not Ars. The latter having fallen down the cliff in recent years and not doing a lot of original reporting despite their budget.


I think we've entered an era where this isn't worth the mental toll anymore. Especially as LLMs ramp up in adoption, the internet is becoming one giant demoralising psyop. I'm more interested in filtering and minimizing the impact rather than trying to engage with it.


It's a fair point but I think you must weigh that against what you principally want to occupy yourself with for that session.

Given that the number of comments are still visible, you can still see the hot topics, and then try to read the title from the tab. But I've actually found myself not doing that anyway.

Regarding the list, it's non-exhaustive.


I'm not sure that humans evolved to be able to do anything useful with continuous, real-time, globalized information anyway.

So what if 6.99999 billion of us can instantly learn about the atrocities committed by the evilest 10,000 or so? What is there to do about it anyway? The overwhelming majority of us just process it into some vague us vs them emotion, internalize it as either "oh that's nice" or "those bastards", and then move on with our lives anyway, after losing a bit more faith in humanity.

Lies, lies, and the occasional fact-check... does it materially change anything at all?


Why’s this comment flagged?


Userscript/Violentmonkey version

  // ==UserScript==
  // @name         Hide Specific HN Entries
  // @namespace    Violentmonkey Scripts
  // @version      0.1
  // @description  Hide HN entries from specific websites
  // @author       h_o_o_t, smnrg
  // @match        https://news.ycombinator.com/*
  // @grant        none
  // ==/UserScript==

  (function() {
      'use strict';

      const blockedSites = [
          'businessinsider.com',
          'dailymail.co.uk',
          'foxnews.com',
          'theverge.com',
          'cnn.com',
          'reuters.com',
          'zerohedge.com',
          'insider.com',
          'bloomberg.com',
          'euronews.com',
          'theguardian.com',
          'wsj.com',
          'ft.com',
          'theconversation.com',
          'thetimes.co.uk',
          'bbc.co.uk',
          'nytimes.com',
          'newyorker.com',
          'theatlantic.com',
          'bbycroft.net'
      ];

      const entries = document.querySelectorAll('table:not(.fatitem) tr > td.title');

      entries.forEach(entry => {
          const link = entry.querySelector('a');
          if (link && blockedSites.some(site => link.href.includes(site))) {
              const row = entry.parentElement;
              row.style.display = 'none';
              if (row.nextElementSibling) row.nextElementSibling.style.display = 'none';
              if (row.nextElementSibling && row.nextElementSibling.nextElementSibling) row.nextElementSibling.nextElementSibling.style.display = 'none';
          }
      });
  })();


I have a similar one that filters on keywords as well as URLs, https://paste.sh/5XE7NvGM#Zb9Wx4P9Pi5XbIO01igypbk2


I have one that filters on keywords too, with a toggle button to show them again in red, been thinking about adding URLs for a while but never got around to it


Awesome! :)


- "This rule isn't perfect as it only removes the title line and keeps the number of comments"

Try a pattern like this, to match three <tr/>'s in a row:

    :xpath(.. | ../following-sibling::tr[1] | ../following-sibling::tr[2])
(Or a cyclic permutation of it, depending on which <tr/> you're anchoring to).


I've just seen your post from 3 days ago too :)

6 points by perihelions:

    news.ycombinator.com##.title:has-text(/\b(Elon|Altman|OpenAI)\b/i):xpath(.. | ../following-sibling::tr[1] | ../following-sibling::tr[2])
...

https://news.ycombinator.com/item?id=38471347


This is seamless, nice one!

For anyone else:

news.ycombinator.com##table:not(.fatitem) tr > td.title:has-text(/{phrase1}|{phrase2}/):xpath(.. | ../following-sibling::tr[1] | ../following-sibling::tr[2])


Why does this post not wrap properly on mobile? Anyone else?. Seems like others are working fine


Sorry about that, it's desktop too and I have no idea why. I tried to force line breaks but to no avail.

If anyone knows how to fix I'd be grateful to know.


Post the code into a Gist, and then link the Gist into your post.


Thanks, taking a look now.


There is a large rule in the post with no whitespace so browsers won't break it up into multiple lines (by default)


td { word-wrap: anywhere } will fix it.


If you host it on GitHub pages you can share a link for others to add as a unblock filter list


Thanks, will do.


Along the same lines, the below filters will do flawed but decent-ish job of hiding comments from specific commentators if you have to regularly resist the urge to get into arguments with people.

  news.ycombinator.com##tr.athing.comtr:has-text(/(example_user_one)|(example_user_two)/)
  news.ycombinator.com##tr.athing.comtr:has-text(/(example_user_one)|(example_user_two)/) + tr.athing.comtr:not(:has(.ind img[width="0"]))
They're imperfect because of how HN generates its HTML, so it will occasionally clobber replies that are alongside hidden comments as well or won't perfectly remove the entire thread. That tends to be somewhat rare I think, but worth being aware of.

I've complained about HN's HTML in the past, but it really is quite badly set up for parsing or styling; using a full-on table column for indentation is a kind of wild hack that makes it difficult to parse replies. But the filter still mostly works, because replies in these situations usually end up being back-and-forth with the same person. So tackling a comment and its immediate reply often ends up correctly hiding the entire thread.

----

> This rule isn't perfect as it only removes the title line and keeps the number of comments

Happily this can be fixed, just use an adjacent sibling selector(https://developer.mozilla.org/en-US/docs/Web/CSS/Next-siblin...) and duplicate your initial filter:

  news.ycombinator.com##table:not(.fatitem) tr > td.title:has-text(/web3|crypto/):nth-ancestor(1)
  news.ycombinator.com##table:not(.fatitem) tr > td.title:has-text(/web3|crypto/):nth-ancestor(1) + tr
It's probably overkill, but you can also add a 3rd instance to get rid of the spacing gap.

  news.ycombinator.com##table:not(.fatitem) tr > td.title:has-text(/web3|crypto/):nth-ancestor(1) + tr + tr.spacer
----

I'm a fan of these kind of low-change filters for sites, I think it's something Ublock Origin can be really helpful for since a lot of people already have it installed and trust it.

But especially given HN's DOM makes this harder to do, I would also suggest that if you're looking at doing much more extensive modifications you're probably going to end up building a webextension or piping the site into another application using RSS or something.

But uBO filters are a pretty great accessible middle-ground.


Ignore list would make for a good native feature, e.g. just auto-collapse comments by people from the list.

Along the same lines, a watch/friend list would be handy too - highlight comments from selected people in some subtle way, so to make it easier to spot them.

... though I think dang would easily produce good arguments against both of these :)


Nice thank you. I had suspected this would get developed a little here.


Super weird flex. Especially things like Verge which is right on topic for HN. We get regular business updates about tech firms from posts on Reuters, bloomberg etc also. So not only are you paranoid about ads but general news stories also?


I'd disagree somewhat there, they are examples of "sites that are not principally about technology and recur somewhat frequently", and it ends "(choose your own)".

The point is that these recur often and do not specifically have a technology focus, but are current events focused.

The list choices are not really the point either, just examples to highlight the uBO rules.

Also: "So not only are you paranoid about ads but general news stories also?" - I'm not sure what you mean to be honest.


I need this to resist the temptation to read the HN comments on politics, ha.


It's a shame this has to be done by uBO.

Filtering options should be a feature here, so users could categorize and mostly clean out pages from content they don't like or find useful, or to fight spammers.


Tell HN:


For years, I was interested in journalism, and used to read/speed-read many newspapers per day. It was a great education in multiple ways. But also it wore on me, because I had more awareness than the average person of things going on, and I felt like I needed to do something about it, but I couldn't.

I eventually took a break from any news exposure at all, then gently added back in a front page skim of a high-quality outlet or two, then shifted for awhile to Reddit front page, then faded back out to zero. At the moment, I'm unlikely to hear about a current news event unless it's alluded to on HN or (this is awful) LinkedIn.

News-related stress now is mostly limited to ridiculous situations in tech industry (we've become the coked-up sociopaths field, a bit like 1980s Wall Street stereotypes used to be), and very local news situations that affect me in noticeable ways (e.g., housing, noise pollution).


Can i get one that filters out all the AI hype?


I gotchu, https://paste.sh/5XE7NvGM#Zb9Wx4P9Pi5XbIO01igypbk2

You'll need a userscript extension installed on your browser such as tampermonkey or greasemonkey.

This script is quite flexible, filter based on URL or on keyword in title. Add/remove filters as you please.


why is this flagged? It seems like a perfectly good "How to" info. post.


I emailed HN and received a very nice reply. It's been unflagged now and wasn't done so by moderators.


Thank you.


This makes HN more like lobste.rs, except perhaps for VC news which are banned on lobste.rs, and sound like they’re not removed by this filter.

I prefer to have a dose of “news” news, and I got that through HN. But I won’t object, it’s probably better.


[flagged]


I assume they mean that they read those mainstream news sources independently, but come here as an escape from current events and politics and mainstream take some things.


I just mean, you know, I read the news, but not necessarily from that list, it's just an example :)


Not a throwaway FYI, a first post.


My paranoid mind sees a fresh account telling me to blanket ignore/block one of the most important western institutions for civil discourse (the free press).

The guideline is:

> Anything that good hackers would find interesting. That includes more than hacking and startups. If you had to reduce it to a sentence, the answer might be: anything that gratifies one's intellectual curiosity.

The guidelines don't even mention tech or technical.


[flagged]


Mainstream Media I assume.




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

Search: