Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env ruby
- require 'rubygems'
- require 'twitter'
- require 'cgi'
- username = ''
- password = ''
- def create_client(username, password)
- httpauth = Twitter::HTTPAuth.new(username, password)
- client = Twitter::Base.new(httpauth)
- return client
- end
- def get_users(client, type)
- page = 1
- open(type, "w") do |f|
- while true
- case type
- when "friends" then users = client.friends(:page => page)
- when "followers" then users = client.followers(:page => page)
- end
- break unless users.size > 0
- users.each do |user|
- f.puts(CGI.unescapeHTML("#{user.screen_name},#{user.name},#{user.url},#{(user.description)}"))
- end
- page = page + 1
- end
- end
- end
- if $0 == __FILE__
- client = create_client(username, password)
- get_users(client, "friends")
- get_users(client, "followers")
- end
Add Comment
Please, Sign In to add comment