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