Created
January 19, 2012 15:31
-
-
Save dennispaagman/1640611 to your computer and use it in GitHub Desktop.
Twitter example script
This file contains hidden or 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
# encoding: UTF-8 | |
require 'twitter' | |
Twitter.configure do |config| | |
config.consumer_key = '......' | |
config.consumer_secret = '......' | |
config.oauth_token = '......' | |
config.oauth_token_secret = '......' | |
end | |
institues.each do |institute| | |
begin | |
twitter = Twitter.user(institute[:twitter]) | |
# Save your data here | |
rescue Twitter::NotFound => the_error | |
next | |
rescue Exception => e | |
puts "continuing scraping at #{e.ratelimit_reset}" | |
sleep e.retry_after | |
retry | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment