hackernews

0.0.7 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i hackernews

Weekly Downloads

2

Version

0.0.7

License

MIT

Last publish

Collaborators

  • tcr