Socket
Socket
Sign inDemoInstall

hackernews-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

hackernews-api

Javascript wrapper for accessing the official Hacker News API v0


Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

HackerNews-API

Overview

HackerNews-API is a Node.js wrapper for accessing v0 of the official Hacker News API.

Installation

Install with npm:

npm install hacknews-api

Usage

> var hackernews = require('hackernews-api');
> var hn = hackernews.hn;
> hn.getItem(8863);
{
  by : "dhouston",
  descendants : 71,
  id : 8863,
  kids : [ 8952, 9224, 8917, 8884, 8887, 8943, 8869, 8958, 9005, 9671, 8940, 9067, 8908, 9055, 8865, 8881, 8872, 8873, 8955, 10403, 8903, 8928, 9125, 8998, 8901, 8902, 8907, 8894, 8878, 8870, 8980, 8934, 8876 ],
  score : 111,
  time : 1175714200,
  title : "My YC app: Dropbox - Throw away your USB drive",
  type : "story",
  url : "http://www.getdropbox.com/u/2/screencast.html"
}

API

All functionality is contained in the hn object, which contains the following:

getItem Accepts: A string or number representing an item ID. Returns: An object containing the item properties if the item exists, null otherwise.

getUser

  • Accepts: A string or number representing an item ID.
  • Returns: An object containing the item properties if the item exists, null otherwise.

getMaxItem

  • Returns: The largest item ID (number).

getTopStories

  • Returns: An array containing the ID's of up to the 500 top stories.

getNewStories

  • Returns: An array containing the ID's of up to the 500 latest stories.

getAskStories

  • Returns: An array containing the ID's of up to the 200 latest Ask HN stories.

getShowStories

  • Returns: An array containing the ID's of up to the 200 latest Show HN stories.

getJobStories

  • Returns: An array containing the ID's of up to the 200 latest jobs stories.

getUpdates

  • Returns: An object containing the the following attributes:
    • items: The ID's of the latest items changed.
    • profiles: The names of the latest profiles changed.

Keywords

FAQs

Package last updated on 07 Jun 2015

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc