WebFinger and XFN me links

Walking through the Hammer Stack is now easier with these two ruby gems: redfinger and xfn_stone.

The email address has won the contest to be the universal identifier for a person. So lets start with mine: don.park@gmail.com.

irb(main):001:0> require 'redfinger' => true irb(main):002:0> f=Redfinger.finger('don.park@gmail.com') => #Redfinger::Finger subject="acct:don.park@gmail.com" /typo:code

Now we have a handle on the starting URL for XFN discovery

irb(main):006:0> f.xfn.first.href => "http://www.google.com/profiles/don.park" /typo:code

Use XfnStone to get links to 'me' pages and 'contact' pages. The 'me' pages are useful for further discovery about what services the user is subscribed to. The 'contact' pages are useful for building a list of friends of the user.

irb(main):008:0> require 'xfn_stone' => true irb(main):009:0> person = XfnStone::Person.new(f.xfn.first.href) => #XfnStone::Person:0xa0c04f4 ... (the person object outputs a ton of extraneous info. this needs to be fixed) /typo:code

Here are the services that I have connected to my google profile page.

irb(main):017:0> pp person.mine.map{|e| e.attributes["href"]} ["http://youtube.com/user/donpdonp", "http://www.flickr.com/photos/donpdonp", "http://delicious.com/donpdonp", "http://donpark.org/", "http://github.com/donpdonp", "http://www.goodreads.com/user/show/244982", "http://www.slideshare.net/donpdonp", "http://digg.com/users/donpdonp/", "http://upcoming.yahoo.com/user/40450/", "http://www.last.fm/user/donpdonp/"] => nil /typo:code

Lets jump over to my goodreads account. It lists one 'me' page that is a list of friends.

person = XfnStone::Person.new(person.mine[5].attributes["href"]) irb(main):041:0> pp person.mine.map{|e| e.attributes["href"]} ["/friend/user/244982"] => nil

/typo:code

xfn_stone todo: normalize partial URLs. Loading that page manually.

irb(main):046:0>person = XfnStone::Person.new("http://www.goodreads.com/friend/user/244982") irb(main):047:0> person.friends => #Hpricot::Elements[]

/typo:code

oh no, no friends! what happened? the XFN attributes contact and acquaintance are interchangeable but xfn_stone looks for contact.

a href="/user/show/1270981-morganpdx" rel="acquaintance" Morganpdx /a /typo:code

Twitter used to be a good example for an XFN friends list. A twitter user's page used to have a 'me' link to their friends list. Each link to a friend had a 'contact' attribute. Another 'me' link to the next page of friends also used to be on that page so a long list of friends could be loaded incrementally. This has since gone away.

What is the Hammer way to get a contacts list? PortableContacts needs looking into...

tags: