Coder Social home page Coder Social logo

hn's Introduction

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.

hn's People

Contributors

fmenozzi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.