Log in

No account? Create an account
Previous Entry Share Next Entry
Finding LiveJournal friends on App.net
Frogmarch 2002 - Whitby
It struck me that it would be useful to be able to see if any of one’s LiveJournal friends are on App.net, so I wrote a script to do it. Probably not very efficient, but it works.

This depends on people using the same username across different sites, however, so bear in mind that while it may identify a username on App.net that matches one of your LJ friends, it might not be the same person.

Being Ruby, I’d imagine it works on most platforms.

#!/usr/bin/env ruby

require 'net/http'
require 'net/https'
require 'open-uri'

friends = Array.new

ARGV.each do |user|
  open("http://www.livejournal.com/misc/fdata.bml?user=#{user}").readlines.each do |line|
    friends.push line.slice(2..-1).strip if line.match /^>/

http = Net::HTTP.new('alpha.app.net', 443)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do |connection|
  friends.sort.uniq.each do |friend|
    puts friend if connection.head("/#{friend}").code.to_i.eql? 200