Created
July 22, 2009 13:30
-
-
Save jasonmadigan/152002 to your computer and use it in GitHub Desktop.
Finds Twitter users from your Delicious network
This file contains 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 | |
# (Potentially) finds Twitter users from your Delicious network | |
require 'rubygems' | |
require 'json' # sudo gem install json | |
require 'open-uri' | |
DELICIOUS_USERNAME = 'USERNAME' | |
DELICIOUS_API_BASE = 'http://feeds.delicious.com/v2/json/networkmembers/' | |
TWITTER_API_BASE = 'http://twitter.com/users/show/' | |
SHUTUP_AND_GIVE_ME_URLS = true | |
delicious_friends = JSON.parse(open("#{DELICIOUS_API_BASE}#{DELICIOUS_USERNAME}").read) | |
users = [] | |
delicious_friends.each do |friend| | |
users << friend['user'] | |
end | |
users.each do |user| | |
begin | |
res = open("http://feeds.delicious.com/v2/json/networkmembers/#{user}").read | |
rescue OpenURI::HTTPError | |
unless SHUTUP_AND_GIVE_ME_URLS | |
puts "This jerk doesn't seem to be on twitter: #{user}" | |
end | |
users.delete(user) | |
end | |
end | |
users.each do |user| | |
if SHUTUP_AND_GIVE_ME_URLS | |
puts "http://www.twitter.com/#{user}" | |
else | |
puts "#{user} may be on Twitter: http://www.twitter.com/#{user}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment