Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 29 lines (24 sloc) 0.79 kb
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
#!/usr/bin/perl
#
# Scrape "Red Hat Enterprise Linux ES (v. 3) General Advisories"
#
use URI;
use Web::Scraper;

my $errata_line = scraper {
    process "//td[1]/img", type => '@alt';
    process "//td[2]", severity => 'TEXT';
    process "//td[3]", advisory => 'TEXT';
    process "//td[4]", synopsis => 'TEXT';
    process "a", url => '@href';
};

my $errata = scraper {
    process "table.list tr", "list[]" => $errata_line;
    result 'list';
};

my $res = $errata->scrape(
    URI->new("https://rhn.redhat.com/errata/rhel3es-errata.html") );

my @column = qw/type severity advisory synopsis url/;
printf STDOUT "|%s|%s|%s|%s|%s|\n", @column, "\n";

for my $line ( @{$res} ) {
    printf STDOUT "|%s|%s|%s|%s|%s|\n", map { $line->{$_} || '-' } @column;
}
Something went wrong with that request. Please try again.