Skip to main content

Watch a URL for new comments and likes with cross-platform desktop notifications.

Project description

HN-Watch

HN-Watch is a small cross-platform CLI that watches a Hacker News item page and alerts you when the post gets new comments or more points.

It is built with:

  • Python
  • requests
  • BeautifulSoup

It works on:

  • Linux
  • macOS
  • Windows

What It Watches

HN-Watch only supports Hacker News item pages:

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

It checks:

  • comment count
  • point count

If either number goes up, HN-Watch prints an alert in the terminal and sends a desktop notification.

How Notifications Work

HN-Watch uses platform-specific notifications:

  • Linux: notify-send
  • macOS: terminal-notifier if installed, otherwise osascript
  • Windows: PowerShell WinForms message box

The tool always also prints alerts in the terminal, so it still works even if desktop notifications are unavailable.

Install

The easiest install path for most users is pipx.

Linux

python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install hn-watch

Optional desktop notification dependency:

sudo apt install libnotify-bin

macOS

brew install pipx
pipx ensurepath
pipx install hn-watch

Optional preferred notification tool:

brew install terminal-notifier

Windows

py -m pip install --user pipx
py -m pipx ensurepath
pipx install hn-watch

Usage

Pass the Hacker News item URL with --url:

hn-watch --url "https://news.ycombinator.com/item?id=47779274"

Or run it with no URL and it will prompt for one:

hn-watch

Useful options:

hn-watch --url "https://news.ycombinator.com/item?id=47779274" --interval 60
hn-watch --url "https://news.ycombinator.com/item?id=47779274" --timeout 15
hn-watch --url "https://news.ycombinator.com/item?id=47779274" --show-unchanged

Example Output

Watching https://news.ycombinator.com/item?id=47779274
Polling every 60 seconds
Baseline: Making Wax Sealed Letters at Scale | Hacker News | comments=3 | points=1
[ALERT] HN-Watch Alert: Comments: 3 -> 4 (+1)

How It Works

  1. HN-Watch fetches the Hacker News item page with requests.
  2. It parses the HTML with BeautifulSoup.
  3. It reads the post's current point count and comment count from the page.
  4. It sleeps for the configured interval.
  5. It fetches the page again and compares the new counts to the previous snapshot.
  6. If points or comments increased, it sends a notification.

Important Notes

  • HN-Watch is intentionally limited to Hacker News item pages.
  • It does not watch the HN front page, user pages, or external sites.
  • It tracks increases in points and comments only.
  • A URL with an anchor is fine. HN-Watch ignores the #... fragment and watches the underlying item page.

Help

See the built-in CLI help:

hn-watch --help

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hn_watch-0.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hn_watch-0.1.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file hn_watch-0.1.0.tar.gz.

File metadata

  • Download URL: hn_watch-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hn_watch-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28be62d6ffc227f4f8c4f75e354fefd80747434ceda24c55bf910f0497bbe698
MD5 4054a7a9bc4cb1543932a5fb29261412
BLAKE2b-256 041373b6fab6be8c70f7a5c8f3f4385850a39d8f12954fb20136734c77a782da

See more details on using hashes here.

Provenance

The following attestation bundles were made for hn_watch-0.1.0.tar.gz:

Publisher: publish.yml on hayden3456/hn-watch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hn_watch-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hn_watch-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hn_watch-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fef624d1fd28d53024f1b19bbc66ae1c493cdeb1090e865b621a61cad0296bbe
MD5 230b71aa36f11616b01187e256abfcf5
BLAKE2b-256 682eaacf180406d09ef4a2b4f7d39a0feae083f2ba4282c2289cd3b45a82b059

See more details on using hashes here.

Provenance

The following attestation bundles were made for hn_watch-0.1.0-py3-none-any.whl:

Publisher: publish.yml on hayden3456/hn-watch

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page