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

For a quick and dirty DIY solution, add something like this to your uBlock filter list:

  google.*##.g:has(a[href*="thetopsites.com"])
  duckduckgo.*##.results > div:has(a[href*="thetopsites.com"])

The linked project goes way beyond this though, very neat!



At the risk of making an unsubstantive comment, this is a huge help to me, and I've been trying to figure out how to do this for years.

Thank you!


Glad to be of help!

Forgot to mention that you can also block arbitrary text with the `:has-text(/regex/)` selector.

Block Medium's cookie notification on any domain:

  *##body>div:has(div:has-text(/To make Medium work.*Privacy Policy.*Cookie Policy/i))
Or apply it to search engine results:

  google.*##.g:has(*:has-text(/word combination to block/i))
  duckduckgo.*##.results > div:has(*:has-text(/word combination to block/i))


Thanks for the tip.

That works well enough for me, and it saves having another browser extension to configure!


> it saves having another browser extension to configure!

Not just that, it saves having another browser extension to trust. A large number of the sites I get to are through search results. A malicious extension that has access to modify search results could do a lot of damage.

Hell, I know people who get to their bank and other sensitive sites by typing the name of the institution into Google, rather than typing the URL. Being able to modify search results would be great for phishing.


This is why I always do banking/TDAM in Firefox safe mode. I'd rather be tracked (or even hacked by some malicious script through the bank's fault) by my bank, than hacked by an extension I installed, because I wouldn't have much liability in the former but I would in the prior.


You think they're going to accept liability just because it's their fault? In order to get that far they'd have to investigate and then find themselves at fault.


Of all the bad things banks do, not accepting liability for theft or loss of funds doesn't seem like a very common one. I've never had trouble with any bank reversing fraudulent transactions or withdrawals.


You can even block based on the result's text, see my other post: https://news.ycombinator.com/item?id=29550393

One less extension equals one less security/privacy liability too!


i tried pinterest and did not work for me

google.##.g:has(a[href="pinterest.com"])

google.##.g:has(a[href="*.pinterest.com"])

dunno. i primarily use duck which apparently does not show that many pinterest results and even that one didn't work. i would have to investigate


If you're typing strings which include the * character, you must either escape it with a \ (\*) or write it in a code block.

I STRONGLY recommend the latter.

I think what you're trying to write is:

  google.*##.g:has(a[href=*"pinterest.com"])
(I'm inferring that based on the italic/roman text in your pattern line. I'm probably inferring wrong.)

HN's markup interpreter will style any line indented by two or more spaces as code, and not interpret special symbols. The lines will wrap, however (wrapping is a relatively new feature).


try this:

google.##.g:has(a[href="pinterest.com"])


Thank you Sir/Ma'am.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: