/usr/share/doc/libxml-atom-simplefeed-perl/examples/slackware-news is in libxml-atom-simplefeed-perl 0.902-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 40 41 42 43 44 45 46 47 48 49 | #!/usr/bin/env perl
use strict;
use warnings;
use URI ();
use XML::LibXML ();
use Web::Scraper::LibXML qw( scraper process );
use lib 'lib';
use XML::Atom::SimpleFeed;
sub SOURCE_URI () { 'http://slackware.com/' }
sub trim($) { my $_ = shift; s!\A\s+!!; s!\s+\z!!; $_ }
my $p = XML::LibXML->new;
my $posts = scraper {
process 'center > table[width="100%"]', 'posts[]' => scraper {
process 'table[cellpadding="14"] td[bgcolor="#fefefe"]', body => sub {
my $c = $_->as_XML;
$c =~ s/ / /g;
$c =~ s/\s+/ /g;
$c = $p->parse_string( trim $c );
trim join '', map $_->toString, $c->documentElement->childNodes;
};
process 'td > b', title => 'TEXT';
process 'td > center > font[size="-1"] > b', date => 'TEXT';
};
};
my $res = $posts->scrape( URI->new( SOURCE_URI ) );
my $f = XML::Atom::SimpleFeed->new(
title => 'Slackware.com',
id => 'urn:uuid:ce386280-61e7-11da-9fcb-dd680b0526e0',
icon => 'http://www.slackware.com/favicon.ico',
link => SOURCE_URI,
author => 'The Slackware Team',
);
$f->add_entry(
title => trim $_->{title},
content => trim $_->{body},
id => 'tag:plasmasturm.org,2005:Slackware-News-' . trim $_->{date},
updated => trim( $_->{date} ) . 'T12:00:00Z',
) for @{ $res->{posts} };
$f->print;
|