Created
February 5, 2009 08:36
-
-
Save yusukebe/58616 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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