Previous Entry Share Next Entry
Which of your LJ friends are on DW?
Balgove
tobyaw

Don’t know whether there is an easier way to do this. This script will read a user’s LJ friends list, and check to see whether DW accounts with the same names exist.

#!/usr/bin/ruby

require 'open-uri'

friends = Array.new

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

friends.sort.uniq.each do |friend|
  puts friend if open("http://users.dreamwidth.org/#{friend}").read !~ /^<h1>Unknown User/
end

?

Log in

No account? Create an account