Project

reddit_get

0.0
No release in over a year
A clean interface to handle reddit data without auth.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

RedditGet

This gem allows you to grab posts and comments from Reddit without any auth. It concurrently grabs multiple subbreddits at a time to utilize your machine as much as possible and increase throughput.

No setup and a clean interface makes this gem ideal when you just want to process public reddit data.

Zero dependencies.

The Redd gem seems to be abandoned so I created this gem to meet my needs.

Installation

gem 'reddit_get'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install reddit_get

Usage

You want to grab many subreddits

results = RedditGet::Subreddit.collect_all %w[gaming videos movies funny]
results # will hold RedditGet::Data which acts like a hash
results.gaming.each do |post|
  puts post['title']
end

You want to grab one subreddit

result = RedditGet::Subreddit.collect('gaming')

result.gaming.each do |post|
  puts post.title # all gaming posts titles
end
result['gaming'] # works too!

You want to grab comments as well

Note: This grabs X subreddits M posts and N comments per post. So it is making X*M*N HTTP requests.

results = RedditGet::Subreddit.collect_all %w[gaming videos movies funny], with_comments: true
results.gaming.each do |post|
  puts post.title
  post.comments.each do |comment|
    puts comment.body rescue nil
  end
end

# also works with single subreddit
RedditGet::Subreddit.collect 'gaming', with_comments: true

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/AlessandroMinali/reddit_get.

License

The gem is available as open source under the terms of the MIT License.