Show HN: CLI for Hacker News (github.com)

8 points by Aperocky ↗ HN
Hi HN! I've built hnterminal, a pip package that lets you browse, upvote, and comment on HN from terminal:

  $ pip install hnterminal
  $ hnterminal
hnterminal is an interactive REPL environment with commands like "get_front_page", "get_tree", "upvote", "reply_to", etc, each of which supports rich arguments and comes with full help documentation.

On the read side, hnterminal uses the HN API to construct front page and comment trees. On the write side, it reads the webpage and constructs an API response from parsed information. Unfortunately, a write API does not exist for HN (that I know of). Login is accomplished with a login cookie that is only stored in memory as it runs. You don't need to login to browse HN, its only for upvotes and commenting.

5 comments

[ 2.2 ms ] story [ 23.1 ms ] thread
replying from HN terminal as well. I love this. :)
If it showed full links those would be clickable with cmd+click on fp w iterm or such
you can use get_link [POINTER] to get the full HN link on any story/comment. For story links, they are listed whenever `get_story` or `get_tree` is called.
For example:

  hnterminal > gt 4
  POINTER -1: PARENT STORY
  Show HN: CLI for Hacker News
  2023-03-26 12:23:28
  AUTHOR: Aperocky
  FULL URL: https://github.com/Aperocky/hnterminal