An easy-to-use CLI and Python library for HNSearch's API.



Working with the HNSearch API on the command line should be easy and intuitive. The JSON output should be able to be piped between commands.


The easiest way to install the CLI and Python library is by using pip.

pip install hn


Specify number of results with the n flag, and starting ordinal position with the s flag.

            hn term
            hn multiple terms -n 100
            hn multiple terms -n 100 -s 100


The d flag allows for searchs filtered to a specific date (in YYYY‑MM‑DD or MM‑DD‑YY format).

            hn -d 03-16-12
            hn -d 2012-03-16

            hn github -d 2012-03-16
            hn techcrunch -d 03-16-12


Return the number of results encountered with the ‑‑hits flag.

            hn pg --hits
            hn zachwill --hits


By default, sorting will be descending (though both asc and desc can be used).

            hn github -S points
            hn github -S username desc
            hn -d 03-16-12 -S username asc -n 100


In addition to filtering by date creation, you can specify the hours to search within on the specific day.

            hn -d 03-16-12 -t 0 12
            hn -d 03-16-12 -t 13 23

            hn -d 03-16-12 -t 12am 12pm
            hn -d 03-16-12 -t 1pm 11pm


The T flag allows filtering by specific types of items (comment or submission).

            hn zachwill -T comment
            hn pg -T submission -S points -n 100


The u or U flags allow filtering by a specific username.

            hn -U zachwill
            hn ycombinator -U pg

            hn -U pg -T submission -S points
            hn -U pg -T comment -S points asc