Skip to content

Instantly share code, notes, and snippets.

@djfpaagman
Created January 19, 2012 15:31
Show Gist options
  • Save djfpaagman/1640611 to your computer and use it in GitHub Desktop.
Save djfpaagman/1640611 to your computer and use it in GitHub Desktop.
Twitter example script
# 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