Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
A wrapper for the new Hacker News API.
Add this line to your application's Gemfile:
gem 'hackernews_ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hackernews_ruby
Instantiate a client like so:
client = HackernewsRuby::Client.new
Items have the following fields:
Field | Description |
---|---|
id | The item's unique id. Required. |
deleted | true if the item is deleted. |
type | The type of item. One of "job", "story", "comment", "poll", or "pollopt". |
by | The username of the item's author. |
time | Creation date of the item, in Unix Time. |
text | The comment, Ask HN, or poll text. HTML. |
dead | true if the item is dead. |
parent | The item's parent. For comments, either another comment or the relevant story. For pollopts, the relevant poll. |
kids | The ids of the item's comments, in ranked display order. |
url | The URL of the story. |
score | The story's score, or the votes for a pollopt. |
title | The title of the story or poll. |
parts | A list of related pollopts, in display order. |
To get an item simply do:
client.get_item(834129)
This will get any item available on the API by ID such as stories, comments, polls and jobs.
Say you wanted the title of a story:
story = client.get_item(8863) #story_id
story.title
=> "My YC app: Dropbox - Throw away your USB drive"
Users have the following fields:
Field | Description |
---|---|
id | The user's unique username. Case-sensitive. Required. |
delay | Delay in minutes between a comment's creation and its visibility to other users. |
created | Creation date of the user, in Unix Time. |
karma | The user's karma. |
about | The user's optional self-description. HTML. |
submitted | List of the user's stories, polls and comments. |
Say you wanted to fetch a particular user:
user = client.get_user('jl') #userid is case sensitive
user.about
=> "This is a test"
To fetch the top 100 stories:
stories = client.top_stories
This will return an array of ID's. To get each story after that, just use the get_item method like this:
stories = client.top_stories
stories.each do |story|
resp = client.get_item(story)
puts resp.title
puts resp.score
puts resp.url
end
To get the most updated Profiles & Itemss you can call:
updates = client.updated
updates.items
=> [1212, 1214]
updates.profiles
=> [5653, 25456]
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that hackernews_ruby 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.