Skip to content

Instantly share code, notes, and snippets.

@stefl
Created May 19, 2010 19:07
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 stefl/406701 to your computer and use it in GitHub Desktop.
Save stefl/406701 to your computer and use it in GitHub Desktop.
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