More Like This From Others
Ben Hammersley's LazyWeb challenge to build a "More Like This From Others" is a fantastic use of TrackBack and RSS.
Additional Update: David Raynes has released a plugin to insert your MLTFO data into your Movable Type weblog.
Update: I've released a new version (0.2) of the MLFTO implementation. The new version outputs the list of entries in RSS, and the core of the code has been moved into a module, MLTFO.pm, which should make it easier to integrate into scripts/MT.
Here's an implementation in Perl, mltfo.pl (released under the Artistic License). It requires LWP::UserAgent, XML::RSS, and HTML::Parser. (It is also indebted to the comments on Ben's entry, above, for ideas on discovering the RSS file given a permalink.)
It works per Ben's original spec:
So, what I want is a little app that takes the trackback. Follows it back to the originating site, find the RDF snippet, takes the index.rdf, and gives back all the entries within the index.rdf that are on the same subject as the trackback one.
Given either a URL or an entry ID (see below), mltfo.pl first builds a list of TrackBack pings for that entry. It then follows those pings back to the site from which they were sent and finds the TrackBack embedded RDF. From this RDF it looks for the MT category name in dc:subject. It then searches for the site's RSS file, trying first to use auto-discovery, then starting back at the base URI and looking for index.rdf at each path segment (for example, http://www.foo.com/index.rdf, http://www.foo.com/bar/index.rdf, etc). It then fetches the RSS feed and scans that for items in the same category as the original item.
Run it like this:
$ perl mltfo.pl --url http://www.benhammersley.com/archives/1017.xml
if you have an RSS feed with all of the TrackBack pings for a post (like Movable Type automatically produces), or
$ perl mltfo.pl --id 3371
Or, if you want to use the MLTFO.pm module:
use MLTFO; my $url = 'http://www.benhammersley.com/archives/003371.html'; my $mltfo = MLTFO->new( URL => $url ) or die MLTFO->errstr; print $mltfo->results_as_rss;
where 3371 is a Movable Type entry ID. (In this case, you'll need to run it from the directory where mt.cfg lives--this is for people who use Movable Type and can run the script from the machine where MT is installed.)



5 Comments
Oh, you rock. No, really. Rockity Rockity Rock. Much Rock Here.
Now, this whole thing is 'social software' in action!
Ben T. when I grow up, I want to be just like you.
Damn, that's fancy. Can your pingback do *that*? Heh. Nice work, folks.
Oh, Ben, this is so cool, so very very cool. I want to learn about Perl just so I can see exactly what you’ve done. So cool. Thank you!
i don't get it. where do you find out who has linked to you? google?