Skip to content

Instantly share code, notes, and snippets.

@yusukebe
Created February 5, 2009 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yusukebe/58616 to your computer and use it in GitHub Desktop.
Save yusukebe/58616 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use URI;
use Web::Scraper;
use XML::OPML;
my $q = CGI->new;
my $username = $q->param('user') || "yusukebe";
my $s = scraper {
process "li.friend > h3", "friends[]" => 'TEXT';
result 'friends';
};
my $friends = $s->scrape( URI->new("http://mitter.jp/$username/friend_list") );
my $opml = new XML::OPML( version => "1.1" );
$opml->head( title => "$username friends feeds", );
for my $friend (@$friends) {
$opml->add_outline(
title => $friend,
type => 'atom',
xmlUrl => 'http://mitter.jp/' . $username . '.atom',
);
}
print $q->header( -type => 'text/xml', -charset => 'utf-8' );
print $opml->as_string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment