Skip to content

Latest commit

 

History

History
55 lines (42 loc) · 2.08 KB

README.md

File metadata and controls

55 lines (42 loc) · 2.08 KB

A simple commandline hacker news client.

Features:

  • Browse the front page anonymously (i.e. no login) and sort by new, hot, best
  • Search for stories via the Algolia API and sort by date, popularity
  • Format output for plain or terminal markdown viewing (via e.g. mdcat)
    • Markdown via mdcat et al only possible on supported terminals (e.g. kitty, iTerm2)
  • Format output in json or csv for scripting
    • See here for details on the Item schema

Examples:

  • Get top 30 stories on the front page:

    hn
  • Get newest 50 stories on the front page and output as markdown using mdcat:

    hn --ranking new --limit 50 --style markdown | mdcat
  • Search for stories containing "foobar" ranked by date and output as json:

    hn --query "foobar" --ranking date --style json

Full CLI:

Options:
    -h, --help      show this help message and exit
    -v, --version   show program version information and exit
    -l, --limit     max number of results to fetch (default: 30)
    -s, --style     output style, one of plain, markdown, md, json, csv (default: plain)
    -r, --ranking   ranking method
                        one of top, new, best for front page items (default: top)
                        one of date, popularity for search result items (default: popularity)
    -q, --query     search query
    -t, --tags      filter search results on specific tags (default: story)

Notes:
    The csv output columns (and json field names) are:

    id,deleted,type,by,time,text,dead,parent,poll,kids,url,score,title,parts,descendents

    See https://github.com/HackerNews/API for schema details.

    Search tags are ANDed by default but can be ORed if between parentheses. For
    example, "author_pg,(story,poll)" filters on "author_pg AND (type=story OR type=poll)".
    See https://hn.algolia.com/api for more.

This code is licensed under the GNU General Public License version 3.