Created
April 27, 2010 15:16
-
-
Save ashaw/380855 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env ruby | |
# find first followers | |
require 'rubygems' | |
require 'twitter' | |
begin | |
USERNAME = ARGV[0].to_s | |
if ARGV.blank? | |
raise "please provide a username" | |
end | |
end | |
user = Twitter.user(USERNAME).id | |
puts "getting first followers for #{USERNAME} (id #{user}).." | |
# followers is an array of follower ids from most recent to oldest. | |
# reverse it to get first to last | |
followers = Twitter.follower_ids(user).reverse! | |
first_followers = followers[0..24] | |
#get first 25 follower usernames | |
screen_names = [] | |
first_followers.each do |follower| | |
uname = Twitter.user(follower).screen_name | |
screen_names << uname | |
end | |
p screen_names |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment