Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
hn-api-client
Advanced tools
Readme
A isomorphic api client for Hacker News API
yarn i hn-api-client
or
npm i hn-api-client
const hnApiClient = require('hn-api-client')
await hnApiClient.getItem(8863);
/*{
by: 'dhouston',
descendants: 71,
id: 8863,
kids: [...],
title: 'My YC app: Dropbox - Throw away your USB drive',
type: 'story',
...
}*/
await hnApiClient.getUser('Malfunction92');
/*{
created: 1451669897,
id: 'Malfunction92',
karma: 34,
submitted: [ 10867439, 10822491, ... ]
}*/
await hnApiClient.getMaxItemID();
/*18920326*/
await hnApiClient.getTopStories();
/*[
{by: 'dankohn1', id: 18912321, kids: [18920127, 18919744, ...], score: 179, ... },
{by: 'vbezhenar', id: 18919543, kids: [18920212, 18919663, ...], score: 22, ... },
...
]*/
/* To get only ids of stories: */
await hnApiClient.getTopStories({onlyIds: true});
/*[
18912321,
18919543]
*/
You can use the following similar methods
await hnApi.getNewStories()
await hnApi.getBestStories()
await hnApi.getAskStories()
await hnApi.getShowStories()
await hnApi.getJobStories()
await hnApiClient.getUpdates();
/* {
items: [18919919, 18916487, 18920263, ...],
users: ["blopeur", "sascha_sl", "doppp", ...]
*/
FAQs
A isomorphic client for Hacker News API
The npm package hn-api-client receives a total of 0 weekly downloads. As such, hn-api-client popularity was classified as not popular.
We found that hn-api-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.