Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Hacker News scraper.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 hackernews.js
Octocat-spinner-32 package.json
README.md

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
Something went wrong with that request. Please try again.