HN Submission Filter

Hacker News is a valuable news aggregator, but it is not immune to spam, agenda-driven posts, and low-quality submissions, especially from accounts with very high karma. Karma is not a guarantee of good judgment or good content. I built this script because I got tired of seeing the same high-profile accounts repeatedly pushing noise, marketing, and propaganda into the feed. This tool puts filtering power back in the reader’s hands so Hacker News can be shaped into something useful again.

This is a lightweight userscript for Hacker News that hides submissions based on:

  • Submitter username (wildcards supported)
  • Keywords or patterns in the title (wildcards / regex supported)
  • Source website domain

Works in Tampermonkey and Violentmonkey.

Features

  • Hide posts from specific authors
  • Hide posts containing certain words or patterns
  • Hide posts from specific websites
  • Case-insensitive matching
  • Supports wildcards and regular expressions for keywords
  • Automatically hides spacing rows after hidden submissions
  • Works with dynamically loaded content (infinite scroll)

Supported Managers

This script works with:

  • Tampermonkey (Chrome, Firefox, Edge, Safari)
  • Violentmonkey (Chrome, Firefox)

It does not require any special permissions.

Installation

  1. Install a userscript manager:
  2. Create a new userscript.
  3. Paste the script code into the editor.
  4. Save.
  5. Visit https://news.ycombinator.com

Configuration

All configuration happens at the top of the script.

Blocked Users

Hide submissions by specific submitters:

const blockedUsers = [
	"spammer123",
	"exampleuser1",
	"throwaway*"
];
  • Matching is case-insensitive.
  • Wildcard-based username blocking using * and ?.

If you’re wondering who to block, start here.

Blocked Keywords / Patterns

Hide submissions if the title matches any pattern:

const blockedWords = [
	"AI.*",
	"crypt.*",
	"bitcoin|btc"
];

Supported syntax:

PatternMeaning
*Any number of characters
?Single character
bitcoin|btcOR condition
AI.*Starts with AI

Examples:

  • "AI.*" → AI news, AI breakthroughs
  • "crypt.*" → crypto, cryptocurrency
  • "pump?" → pump, pumps

Matching is case-insensitive.

Blocked Domains

Hide submissions from specific websites:

const blockedDomains = [
	"twitter.com",
	"medium.com",
	"badsite.org"
];

Behavior:

  • Matches only the base domain
  • Ignores www.
  • Ignores anything after the TLD

Examples:

How It Works

For each submission on Hacker News:

  1. Reads the title text
  2. Reads the submitter username
  3. Reads the website domain
  4. If any filter matches:
    • The submission row is hidden
    • The metadata row is hidden
    • The spacer row after it is hidden

A MutationObserver monitors the page so newly loaded posts are filtered automatically.

Privacy

  • Runs entirely in your browser
  • No network requests
  • No data collection

License

This project was written by främling <http://framling.org> and is licensed under the GNU General Public License version 3 (or any later version).

See the LICENSE file for details.

Changelog

  • v1.1
    • Added support for wildcard-based username blocking using * and ?
      • Example: throwaway* blocks throwaway, throwaway123, etc.
      • Matching is case-insensitive
    • Unified username matching logic for both submissions and comments
    • Blocked commenters now have their entire reply threads hidden, preventing orphaned replies
    • Improved internal structure by compiling username patterns into regular expressions once for better performance
    • No changes required to existing block lists: plain usernames continue to work as exact matches
  • v1.0
    • Initial release

Downloads