Skip to content

Instantly share code, notes, and snippets.

@metade
Created December 6, 2012 16:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metade/4225727 to your computer and use it in GitHub Desktop.
Save metade/4225727 to your computer and use it in GitHub Desktop.
Fetch images from instagram for a particular tag
require 'instagram'
require 'pp'
Instagram.configure do |config|
config.client_id = 'your-client-id-goes-here'
config.proxy = ENV['http_proxy'] if ENV['http_proxy']
end
p Instagram.tag '6musictshirtday'
max_tag_id = ''
while !max_tag_id.nil?
results = Instagram.tag_recent_media("6musictshirtday", :max_tag_id => max_tag_id)
max_tag_id = results['pagination']['next_max_tag_id']
images = results['data'].map { |result| result['images']['standard_resolution']['url'] }
images.each do |image|
system('curl', '-O', image)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment