tobyaw: (Default)
posted by [personal profile] tobyaw at 03:03pm on 01/05/2009 under , , ,

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
location: KY16 8JY

Links

June

SunMonTueWedThuFriSat
        1
 
2
 
3
 
4
 
5
 
6 7
 
8
 
9 10
 
11
 
12
 
13
 
14
 
15
 
16
 
17
 
18
 
19
 
20
 
21
 
22
 
23
 
24
 
25
 
26
 
27
 
28
 
29
 
30