Socket
Socket
Sign inDemoInstall

hn-api

Package Overview
Dependencies
47
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    hn-api

Node wrapper for the Hacker News API


Version published
Weekly downloads
1
decreased by-80%
Maintainers
1
Install size
3.72 MB
Created
Weekly downloads
 

Readme

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

FAQs

Last updated on 17 Oct 2014

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc