📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

hn-api

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hn-api

Node wrapper for the Hacker News API

0.1.5
latest
Source
npm
Version published
Weekly downloads
5
25%
Maintainers
1
Weekly downloads
 
Created
Source

Hacker News API - Node Wrapper

npm install hn-api

var hn = require("hn-api");

Get Item

hn.item(8422599, function (err, item) {
  if (!err) {
    console.log(item.by); // kevin
    console.log(item.id); // 8422599
    console.log(item.kids); // array
    console.log(item.score); // 1677
    console.log(item.time); // 1412703525
    console.log(item.title); // Hacker News API
    console.log(item.url); // http://blog.ycombinator.com/hacker-news-api
  }
});

Get User

hn.user('pg', function (err, user) {
  if (!err) {
    console.log(user.created); // 1160418092
    console.log(user.delay); // 2
    console.log(user.id); // pg
    console.log(user.karma); // 155040
    console.log(user.submitted); // [ 7494555, ... ]
    console.log(user.about); // Bug fixer.
  }
});

Get Top Stories

hn.topStories(function(err, stories){
  if (!err) {
    console.log(stories); // array
  }
});

Get Max Item

hn.maxItem(function(err, max){
  if(!err) {
    console.log('max ', max); // id
  }
})

Would love to get some more help on this project to make it awesome! Please contribute.

Keywords

hacker

FAQs

Package last updated on 17 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts