Skip to content

Instantly share code, notes, and snippets.

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