Created
May 19, 2010 19:07
-
-
Save stefl/406701 to your computer and use it in GitHub Desktop.
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
usernames = "mrmactout | |
angusmactout | |
elsbethmactout | |
sgtmacfuzz | |
mrsmactoffy | |
professordunkopf | |
ferociousness1983 | |
littleness1983 | |
hungryness1983".split("\n") | |
require 'rubygems' | |
require 'twitter' | |
list_slug = "<my list slug>" | |
user = "<my username>" | |
password = "<my password>" | |
throttle = 10 # seconds to wait inbetween calls to twitter | |
puts "Adding #{usernames.size} users to #{list_slug}" | |
httpauth = Twitter::HTTPAuth.new(user, password) | |
client = Twitter::Base.new(httpauth) | |
usernames.sort! | |
usernames.reverse! | |
usernames.each do |username| | |
begin | |
client.list_add_member(user,list_slug, username) | |
sleep(throttle) | |
rescue Twitter::General | |
puts "General error for #{username}" | |
rescue Twitter::Unavailable | |
sleep(throttle) | |
client.list_add_member(user, list_slug, username) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment