hackernews

Hacker News scraping for Node.js

npm install hackernews
1 downloads in the last day
10 downloads in the last week
34 downloads in the last month

node-hackernews

A Hacker News scraper/bot for Node.js. Drink responsibly.

Module

npm install hackernews

Methods:

  • hackernews.popular([pageNumber = 1,] callback(err, json)) — Most popular stories.

  • hackernews.newest([pageNumber = 1,] callback(err, json)) — Newset submissions.

  • hackernews.story(id, [pageNumber = 1,] callback(err, json)) — Story and its comments.

  • hackernews.submitted(username, [pageNumber = 1,] callback(err, json)) — Stories submitted by a user.

  • hackernews.commented(username, [pageNumber = 1,] callback(err, json)) — Comments by a user.

  • hackernews.profile(username, callback(err, json)) — Profile of a user.

Authenticated calls require login(), which returns a new, authenticated API object to its callback.

  • hackernews.login(username, password, callback(err, userAPI)) — Login as a user. Passes a new authenticated API object to the callback, with the above methods as well as:

  • hackernews.upvote(id, callback(err, json)) — Upvote an item.

  • hackernews.downvote(id, callback(err, json)) — Downvote an item.

  • hackernews.comment(id, text, callback(err, json)) — Comment on a post.

CLI hackernews or hn

$ npm install -g hackernews
$ hackernews
$ hn # same thing
$ hn 4 # page 4
npm loves you