Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A Ruby wrapper for the Hacker News API.
gem install hn_api
or add gem 'hn_api'
to your Gemfile
and bundle
.
Currently, the Hacker News API is read-only and does not require an API key. The API is based at https://hacker-news.firebaseio.com, and is currently on version v0
.
# For now, this one line is all you need to configure
@client = HN::Client.new
# In the event of a version change, you can set the `api_url` like so
@client.configure do |config|
config.api_url = 'https://hacker-news.firebaseio.com/v1/'
end
# And you can always reset to the defaults
@client.reset
Descriptions and examples of the supported actions are below. For a more detailed explanation of available endpoints and an exhaustive list of the properties each response returns, check out the official Hacker News API documentation.
Fetches an item (story, comment, poll, etc.) by id. Returns a Hashie::Mash
.
story = @client.item(8422599)
story.title # Hacker News API
story.url # http://blog.ycombinator.com/hacker-news-api
comment_ids = story.kids
first_comment = @client.item(comment_ids.first)
first_comment.text # Oh man you guys, patio11 has generated...
Fetches a user by unique case-sensitive username. Returns a Hashie::Mash
.
me = @client.user('co_pl_te')
me.karma # 4186
me.about.split(?\n).first # Everything to everyone.
me.submitted # an array of my submitted items' ids (stories, comments, etc.)
The following endpoints are updated in real-time and will allow you to observe changes in front page ranking, new items, and new profiles.
Fetches the current top 100 story ids. Returns an Array
.
@client.top_stories
Fetches the current largest item id. Returns a String
.
@client.max_item
Fetches item and profile changes. Returns a Hashie::Mash
.
updates = @client.updates
updates.items # an array of updated item ids
updates.profiles # an array of updated profile ids
Copyright (c) 2014 Rahul Horé. See LICENSE.txt for further details.
FAQs
Unknown package
We found that hn_api 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.