Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Add Comment
Please, Sign In to add comment