Find file
Fetching contributors…
Cannot retrieve contributors at this time
109 lines (73 sloc) 1.69 KB


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


There are two ways of installing the library:

pip install hn

Alternatively, run the following from the command line:

python install


Usage patterns for working with the hn CLI.


Basic search terms and querying. Allows for specifying number of results with n flag (maximum is 100), and starting ordinal position of results with the s flag.

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


The d flag allows for searches 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 zachwill -T submission -S points -n 100


The u or U flags allows 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