Yahoo hosted another of their Open Hack events in London this weekend. I took the opportunity to play around with YQL, the Google Social Graph API and the XFN microformat and built a Greasemonkey script that recognises when you're on a social network profile and finds other social network profiles belonging to the same person.
If you want to try it out, just follow these simple steps:
- Get Firefox and Greasemonkey.
- Visit this page to install the plugin: georgebrock.com/openhack2009/xfndiscovery.user.js
- Go to a profile page (like a Twitter page, or even this blog) and you'll see a “more user profiles” link in the rop right corner of the page
If you're more interested in how it works, you can find the source code on GitHub.
It starts by looking for links that use
rel="me" (XFN's way of saying "this link points to another page about the same person as this page"). If it find any it uses YQL (and a clever bit of XPath magic from Brian Suda) to find more
rel="me" links on those page and so on until it runs out of profile links. To make sure nothing's been missed it'll bundle together all of the URLs that it's found and pass them to the Google Social Graph API. If the SG API finds any new unique URLs they are parsed with YQL too. The combination of YQL and the SG API means that the script gets good coverage for most people, whether or not they have deliberately made use of
One fun thing about building this hack was finding my own profiles on sites that I'd forgotten about (it turns out I have a soup.io account).