Skip to content

Instantly share code, notes, and snippets.

@danhixon
Created March 25, 2010 19:48
Show Gist options
  • Save danhixon/344024 to your computer and use it in GitHub Desktop.
Save danhixon/344024 to your computer and use it in GitHub Desktop.
require "rubygems"
require 'twitter'
require "highline/import"
username = ask("Username: ")
password = ask("Enter your password: ") { |q| q.echo = '*' }
httpauth = Twitter::HTTPAuth.new(username, password)
client = Twitter::Base.new(httpauth)
list = ask("List Name (e.g. danhixon/redPear): ")
list = list.split("/")
members = client.list_members(list[0], list[1])
friend_ids = client.friend_ids(username)
members["users"].each do |individual|
if !friend_ids.include?(individual["id"])
client.friendship_create(individual["id"], true)
puts "now following #{individual["name"]}"
else
puts "already following #{individual["name"]}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment