#!/usr/bin/perl -w # update_blogroll.pl # 03 Sep 2004 # # Convert bloglines.com OPML into xhtml blogroll # see http://jclark.org/weblog/WebDev/ThisSite/onaroll.html for details use LWP; use XML::LibXML; use XML::LibXSLT; # Config info - this could easily be changed to # cmdline params using GetOpt::Long my $bloglinesID = 'jclark'; my $xslfile = '/Users/jclark/xslt/blogroll.xsl'; my $ftpuri = 'ftp://jclark.org/blosxom_plugins/state/file/blogroll'; #ftp credentials my $user = 'username'; my $pass = 'PaSsWoRd'; #fetch OPML from bloglines my $ua = LWP::UserAgent->new; my $url = "http://www.bloglines.com/export?id=$bloglinesID"; my $resp = $ua->get($url); #parse and transform my $parser = XML::LibXML->new(); my $xslt = XML::LibXSLT->new(); my $opml = $parser->parse_string($resp->content); my $ssdoc = $parser->parse_file($xslfile); my $ss = $xslt->parse_stylesheet($ssdoc); my $blogroll = $ss->transform($opml); #ftp blogroll xhtml to the website open FTP, "|curl --upload-file - --user $user:$pass --url $ftpuri"; print FTP $ss->output_string($blogroll); close FTP;