Skip to content

Instantly share code, notes, and snippets.

@amscotti
Created April 27, 2013 16:12
Show Gist options
  • Select an option

  • Save amscotti/5473624 to your computer and use it in GitHub Desktop.

Select an option

Save amscotti/5473624 to your computer and use it in GitHub Desktop.
require "rubygems"
require "twitter"
require 'geokit'
username = "amscotti"
friends_list = Twitter.friends(username)
friends_list.users.each do |friend|
puts "----------------------------"
unless friend.location.nil? || friend.location.strip.empty?
puts "#{friend.name} AKA #{friend.screen_name} is from #{friend.location}"
geo = Geokit::Geocoders::YahooGeocoder.geocode(friend.location)
puts geo.success ? "#{geo.lat}, #{geo.lng}" : "Unable to find Geo for #{friend.location}"
else
puts "#{friend.name} AKA #{friend.screen_name} idk where they are from..."
puts "No listed location"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment