Pyhn 0.4.0: Hacker News in your terminal

toxinu3 pts0 comments

GitHub - toxinu/pyhn: Hacker news command line client · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

toxinu

pyhn

Public

Notifications<br>You must be signed in to change notification settings

Fork<br>37

Star<br>384

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>183 Commits<br>183 Commits

pyhn

pyhn

tests

tests

.gitignore

.gitignore

.python-version

.python-version

CHANGELOG.md

CHANGELOG.md

LICENSE

LICENSE

NOTICE

NOTICE

README.md

README.md

pyproject.toml

pyproject.toml

requirements.txt

requirements.txt

screenshot.png

screenshot.png

tox.ini

tox.ini

View all files

Repository files navigation

Pyhn

Hacker News in your terminal.

Pyhn reads from the official Hacker News API<br>(the public, read-only JSON API hosted on Firebase), so there is no HTML<br>scraping. Results are cached locally, and each section is fetched concurrently<br>and streamed into the list as it arrives, so the first page shows up almost<br>immediately.

Features

Official Hacker News API (no scraping)

Progressive, streaming load with skeleton placeholders

Concurrent item fetching

Local cache manager

Top, Newest, Best, Ask, Show, Show Newest and Jobs stories

Customize all the colors

Customize all the keybindings

Default vim-like keybindings

Auto refresh support

Plays nice with tmux and screen (over ssh too!)

Open stories in your web browser

Mouse support

Python 3.10+

MIT license

Installation

Pyhn requires Python 3.10 or newer. It is a command-line app, so the<br>recommended installs put it in an isolated environment on your PATH.

With uv (recommended):

uv tool install pyhn

With pipx:

pipx install pyhn

pyhn is available in the AUR.

Usage

Use help for all key bindings:

h , ? : Print help popup

Configuration

By default, the configuration file is in $HOME/.pyhn/config. It is created<br>with the defaults below on first run; you can set key bindings, colors and more.

This is an example file:

[keybindings]<br>page_up = ctrl u<br>page_down = ctrl d<br>first_story = g<br>last_story = G<br>up = k<br>down = j<br>refresh = r<br>show_comments_link = c<br>open_comments_link = C<br>show_story_link = s<br>open_story_link = S,enter<br>show_submitter_link = u<br>open_submitter_link = U<br>reload_config = ctrl R<br>newest_stories = n<br>top_stories = t<br>best_stories = b<br>show_stories = d<br>show_newest_stories = D<br>ask_stories = a<br>jobs_stories = J

[interface]<br>show_score = true<br>show_comments = true<br>show_published_time = false

[settings]<br>extra_page = 3<br>cache = /home/youruser/.pyhn/cache<br>cache_age = 5<br>browser_cmd = __default__<br># Refresh interval in minutes (default: 5, minimum: 1)<br>refresh_interval = 5

[colors]<br>body = default||standout<br>focus = yellow,bold||underline<br>footer = black|light gray<br>footer-error = dark red,bold|light gray<br>header = dark gray,bold|white|<br>title = dark red,bold|light gray<br>help = black|dark cyan|standout<br>skeleton = dark gray|default<br>domain = dark blue|default

Settings

extra_page how many extra pages of stories to load (30 stories per page)

cache_age minutes after which CacheManager considers the cache outdated

browser_cmd command used to open links (__url__ is replaced by the link)

refresh_interval minutes between auto refreshes (minimum 1)

The [interface] section toggles the optional score, comment-count and<br>published-time columns.

Examples:

> /tmp/pyhn.log && w3m __url__">browser_cmd = lynx __url__<br>browser_cmd = __default__<br>browser_cmd = w3m __url__<br>browser_cmd = echo "[INFO] Open with w3m: __url__" >> /tmp/pyhn.log && w3m __url__

Key bindings

You can set different key bindings for the same action with a comma separator.<br>Take a look at the urwid input<br>manual.

Colors

Color options are written as foreground|background|monochrome. The background<br>and monochrome parts are optional (e.g. yellow,bold||underline leaves the<br>background at the terminal default).

foreground

colors: 'default' (use the terminal's default foreground), 'black', 'dark red', 'dark green', 'brown', 'dark blue', 'dark magenta', 'dark cyan', 'light gray', 'dark gray', 'light red', 'light green', 'yellow', 'light blue', 'light magenta', 'light cyan', 'white'

settings:...

pyhn dark default light gray refresh

Related Articles