Created
December 6, 2012 16:19
-
-
Save metade/4225727 to your computer and use it in GitHub Desktop.
Fetch images from instagram for a particular tag
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
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