
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
@jamsch/hacker-news-client
Advanced tools
A simple API wrapper for Hacker News with Typescript typings that supports browsers & Node.js.
npm install @jamsch/hacker-news-client
import Client from '@jamsch/hacker-news-client';
// Fetch the top 500 story IDs
const topStories = await Client.getTopStories();
// Latest stories, by any type
const newStories = await Client.getNewStories();
// Latest "Ask HN" stories
const askStories = await Client.getAskStories();
// Latest "Show HN" stories
const showStories = await Client.getShowStories();
// Latest "Jobs" stories
const jobStories = await Client.getJobStories();
// Fetch a single story
const story = await Client.getItem(topStories[0]));
// Fetch the user's info
const user = await Client.getUser(story.by);
// Fetch the first 5 stories in parallel.
// Note: this makes one request per item provided, and the order of the results is not guaranteed.
const topFiveStories = await Client.getItems(topStories.slice(0,5));
import Client, { Story, Ask, Comment, Job, Poll, PollOpt } from '@jamsch/hacker-news-client';
// Fetch an Item
const item = await Client.getItem(1); // "Item" type
console.log(item); // Item (Story | Comment | Ask | Job | Poll | PollOpt)
// Check what kind of item it is
if (Client.is(item, 'story')) {
console.log(item); // Story
} else if (Client.is(item, 'ask')) {
console.log(item); // Ask
}
// If you know the item ID belongs to a specific item type:
const storyId = 123;
const storyItem = await Client.getItem<Story>(storyId);
console.log(storyItem); // Story
const storyIds = [1,2,3,4];
const topFiveStories = await Client.getItems<Story>(storyIds);
console.log(topFiveStories); // Story[]
// Alternatively, use a switch statement to figure out the type
switch (item.type) {
case 'story': {
console.log('Ask | Story:', item); // Ask | Story
if ('text' in item) {
console.log('Ask:', item); // Ask
}
if ('url' in item) {
console.log('Story:', item); // Story
}
break;
}
case 'comment':
console.log('Comment:', item); // Comment
break;
case 'job':
console.log('Job:', item); // Job
break;
case 'poll':
console.log('Poll:', item); // Poll
break;
case 'pollopt':
console.log('Polopt', item); // PolOpt
break;
}
<script src="{path_to_package}/umd/hacker-news-client.production.min.js"></script>
<script>
HackerNewsClient.getTopStories().then(topStories => {
console.log(topStories);
});
</script>
FAQs
A universal API client for Hacker News with Typescript typings
The npm package @jamsch/hacker-news-client receives a total of 0 weekly downloads. As such, @jamsch/hacker-news-client popularity was classified as not popular.
We found that @jamsch/hacker-news-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.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.