Last active
March 9, 2016 18:45
-
-
Save neidiom/673af6ead1cb3dce2b20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'httparty' | |
require 'json' | |
reddit_api_url = "http://www.reddit.com/r/funny/new.json?sort=new&limit=5" | |
resp = HTTParty.get(reddit_api_url) | |
data = JSON.parse(resp.body) | |
data['data']['children'].each do |sub| | |
puts "Title: #{sub['data']['title']}\n" << "Link: https://www.reddit.com#{sub['data']['permalink']}\n" << "URL: #{sub['data']['url']}\n\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment