Skip to content

Instantly share code, notes, and snippets.

@drizzt
Created September 23, 2016 20:53
Show Gist options
  • Save drizzt/cf6ce23cb5421787892349b70d350830 to your computer and use it in GitHub Desktop.
Save drizzt/cf6ce23cb5421787892349b70d350830 to your computer and use it in GitHub Desktop.
require 'json'
require 'uri'
require 'net/http'
uri = URI('https://medium.com/@terremotocentroitalia/latest')
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
req = Net::HTTP::Get.new(uri, 'Accept' => 'application/json')
http.request(req)
end
j = JSON.load(res.body[16..-1])
j['payload']['references']['Post'].each_value do |x|
puts x['title']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment