
Security News
Astral Launches pyx: A Python-Native Package Registry
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
A Reddit API Wrapper built in Ruby to play with my own Gem. It really only helps you grab subreddit information and user information.
It's utilizing Reddit's free API resources. That means you don't need any authorization to make requests. You can't make a lot of requests, but if you cache them using Redis, you could probably use this on a small toy app for yourself. It's a good way to quickly grab Reddit subreddits, comments, articles, and user profiles for your application.
add this to your Gemfile:
gem 'wreddit'
run bundle install
in your app
This gem takes advantage of Redis caching which should help reduce the amount of error requests received by Reddit's Native API. You can't really make adjustments to the
caching because caching is going to happen automatically. In order to use Redis, you MUST be running a redis-server to handle the hash maps of URLs and response objects.
As of v.1.0.2 we are using the Wreddit class.
wreddit = Wreddit.new #wreddit will be a standard variable for future examples
@reddit_user = wreddit.user('username').parse
user -> checks for a username on Reddit.com. If the user doesn't exist, their API handles that.
subreddit -> checks for subreddit. If left empty, it'll default to /r/all.
parse -> will parse the response in JSON format by default. If you'd like to parse XML or HTTP, you can do that like this:
...parse('xml') or parse('html') or parse('json')
In this example, we'd be grabbing the subreddit and its comments in a specific thread
@reddit_comments = wreddit.subreddit('learnprogramming').comments('specific_article_id').parse
If you just quickly want to get the links, titles, or descriptions for articles/comments, I made some snappy methods. You don't have to parse them. For now, it assumes that you want an array from the JSON object. Getting top links to articles in subreddit
@reddit_links = wreddit.subreddit('learnprogramming').links
Getting top titles of articles in subreddit
@reddit_titles = wreddit.subreddit('learnprogramming').titles
Getting top descriptions of articles in subreddit
@reddit_descriptions = wreddit.subreddit('learnprogramming').descriptions
You cannot assume that any of these methods together will provide some response. Logically, some of these will render nil arrays. However, you'd be surprised by some things you can do. Like: In this example, we'd be grabbing the subreddit, its comments in a specific thread
@stuff = wreddit.user('myusername').links #provides valid links to user submitted threads
@stuff = wreddit.user('myusername').descriptions #provides valid descriptions to commments
But you would NOT be able to write something like:
@invalid_response = wreddit.user('myusername').subreddit('learnprogramming').parse
The API will response with 404.
Email me with any questions at seanjhulse@gmail.com
FAQs
Unknown package
We found that wreddit 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
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.