-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetrss.pl
39 lines (29 loc) · 898 Bytes
/
getrss.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/perl
use strict;
use warnings;
use LWP::Simple;
use XML::RSS;
use Time::Local;
my $feed_url = 'http://hpv.cc/~maty/pukiwiki1/index.php?cmd=rss&ver=1.0';
my $input = get($feed_url);
my $rss = XML::RSS->new;
# feed parse
$rss->parse($input);
# 1day ago
my $onedayago = time() - 86400;
for (@{$rss->{items}}) {
# rss unixtime
my $rss_time = timelocal(substr($_->{dc}->{date}, 17, 2 ),
substr($_->{dc}->{date}, 14, 2 ),
substr($_->{dc}->{date}, 11, 2 ),
substr($_->{dc}->{date}, 8, 2 ),
substr($_->{dc}->{date}, 5, 2 )-1,
substr($_->{dc}->{date}, 0, 4 )-1900);
# new post only
if($rss_time >= $onedayago ){
print "$_->{title}\n";
print "$_->{link}\n";
}
}
__END__
rss を取得し,1日以内の更新のtitle/url を表示