Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jasonmadigan/152002 to your computer and use it in GitHub Desktop.
Save jasonmadigan/152002 to your computer and use it in GitHub Desktop.
Finds Twitter users from your Delicious network
#!/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