代码: 全选
tlcr: 0 庚寅年七月二十日 11:45:10 ~
● rr-RSS.perl
${color green}骨头的博客:${color yellow}
gentoo下的pppoe拨号
湿地博物馆
${color green}xiooli的博客:${color yellow}
诡异的 gtk 程序启动出错
迁移运行中的 Archlinux 系统至移动硬盘
tlcr: 0 庚寅年七月二十日 11:45:29 ~
● ds rr-RSS.perl
#!/usr/bin/perl
# vim : ft=perl
use 5.010;
use lib "$ENV{HOME}/应用/库/脚本";
use XML::RSS;
use scriptFunctions;
use utf8;
use encoding 'utf8';
sub getXML
{
my ($uri, $opts);
$uri = shift @_;
$opts = shift @_;
`curl $opts $uri 2>/dev/null`;
}
open CFG, '<', $scriptFunctions::configDir . 'rr-RSS.perl';
$rss = XML::RSS->new;
while (<CFG>)
{
# Syntax: name,uri,num,opts
next if /^#/;
chomp;
@cfg = split /,/, $_;
@cfg == 4 or @cfg == 3 or @cfg == 2 or die "配置文件错误\n";
$text = getXML $cfg[1], $cfg[3];
$rss->parse ($text);
say "\${color green}$cfg[0]:\${color yellow}";
my $num = 0;
while ($num < $cfg[2])
{
$num++;
$item = shift @{$rss->{'items'}};
#say "<a href=\"$item->{'link'}\">$item->{'title'}</a>";
say "$item->{'title'}";
}
}
tlcr: 0 庚寅年七月二十日 11:46:10 ~
●
代码: 全选
tlcr: 0 庚寅年七月二十日 11:46:10 ~
● dog ~/应用/配置/rr-RSS.perl
骨头的博客,http://luy.li/feed/,2
xiooli的博客,http://joolix.com/feed/,2
tlcr: 0 庚寅年七月二十日 11:46:49 ~
●