Skip to content

Instantly share code, notes, and snippets.

@zephiransas
Forked from yusuke/common_followers.rb
Created May 2, 2012 13:54
Show Gist options
  • Save zephiransas/2576676 to your computer and use it in GitHub Desktop.
Save zephiransas/2576676 to your computer and use it in GitHub Desktop.
print user ids of common followers
require "net/http"
def get_ids(screen_name)
url = "http://api.twitter.com/1/followers/ids.json?screen_name=" + screen_name
ids_response = Net::HTTP.get_response(URI.parse(url)).body
/\[(.*)\]/.match(ids_response)[1].split(",").map { |x| x.to_i }.sort
end
id1_followers = get_ids(ARGV.shift)
id2_followers = get_ids(ARGV.shift)
id1_followers & id2_followers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment