Skip to content

Instantly share code, notes, and snippets.

@dvmonroe
Created June 6, 2015 23:48
Show Gist options
  • Save dvmonroe/a9854327728f7fc3b480 to your computer and use it in GitHub Desktop.
Save dvmonroe/a9854327728f7fc3b480 to your computer and use it in GitHub Desktop.
Grabbing tags from Instagram /locations api
require "openssl"
require "rest-client"
INSTA_PATH = 'https://api.instagram.com/v1/locations/'
LOCATION = "#{location id}"
CLIENT_ID = "#{your client id}"
def parse_response(params)
results = JSON.parse(params)
binding.pry
tags = []
results['data'].each do |x|
x['tags'].each do |t|
tags.push(t)
end
end
puts tags
end
begin
data = RestClient.get("#{INSTA_PATH}#{LOCATION}/media/recent?client_id=#{CLIENT_ID}")
return parse_response(data)
rescue StandardError, JSON::ParserError => e
puts "Error: #{e.message}"
raise e
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment