Skip to content

Instantly share code, notes, and snippets.

@syohex
Created June 29, 2012 14:58
Show Gist options
  • Save syohex/3018449 to your computer and use it in GitHub Desktop.
Save syohex/3018449 to your computer and use it in GitHub Desktop.
リハビリ用
#!perl
use strict;
use warnings;
use Furl;
use XML::RSS::LibXML;
use Encode;
my $rss_url = shift or die "Usage: $0 rss_url";
my $ua = Furl->new();
my $res = $ua->get($rss_url);
unless ($res->is_success) {
die "Can't download $rss_url";
}
my $parser = XML::RSS::LibXML->new;
eval {
$parser->parse($res->content);
};
if ($@) {
die "Can't parse RSS!!";
}
my $index = 1;
for my $item ( @{ $parser->{items} } ) {
printf "[%2d] :%s\n", $index++, Encode::encode_utf8($item->{title});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment