| 1 : |
tolimar |
6 |
#! /usr/bin/perl -w
|
| 2 : |
|
|
|
| 3 : |
tfheen |
3452 |
# Copyright (c) 2002 Tollef Fog Heen <tfheen@err.no>
|
| 4 : |
|
|
# All rights reserved.
|
| 5 : |
|
|
#
|
| 6 : |
|
|
# Redistribution and use in source and binary forms, with or without
|
| 7 : |
|
|
# modification, are permitted provided that the following conditions are
|
| 8 : |
|
|
# met:
|
| 9 : |
|
|
#
|
| 10 : |
|
|
# * Redistributions of source code must retain the above copyright
|
| 11 : |
|
|
# notice, this list of conditions and the following disclaimer.
|
| 12 : |
|
|
# * Redistributions in binary form must reproduce the above copyright
|
| 13 : |
|
|
# notice, this list of conditions and the following disclaimer in the
|
| 14 : |
|
|
# documentation and/or other materials provided with the distribution.
|
| 15 : |
|
|
#
|
| 16 : |
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
| 17 : |
|
|
# IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
| 18 : |
|
|
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
| 19 : |
|
|
# PARTicular purpose ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 20 : |
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 21 : |
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 22 : |
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 23 : |
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 24 : |
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 25 : |
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 26 : |
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| 27 : |
|
|
|
| 28 : |
tolimar |
6 |
use strict;
|
| 29 : |
|
|
|
| 30 : |
|
|
my $infile = $ARGV[0] || "http://packages.debian.org/unstable/main/newpkg";
|
| 31 : |
|
|
|
| 32 : |
|
|
my $content = `lynx -width=300 -dump $infile`;
|
| 33 : |
|
|
my (@packages,@output);
|
| 34 : |
|
|
|
| 35 : |
|
|
foreach my $line (split "\n",$content) {
|
| 36 : |
|
|
# $line =~ m/^\s*(\*|\d+\. http:)/;
|
| 37 : |
|
|
if ($line =~ m/^\s*\*/) { #)
|
| 38 : |
|
|
$line =~ s/^\s*\*\s*//;
|
| 39 : |
tolimar |
17 |
$line =~ s/\s*\(\d+ days? old\)//;
|
| 40 : |
tolimar |
6 |
push @packages, $line;
|
| 41 : |
|
|
} elsif ($line =~ m,^\s*(\d+)\. (http://.*),) {
|
| 42 : |
|
|
my $linkno = $1;
|
| 43 : |
|
|
my $url = $2;
|
| 44 : |
|
|
foreach my $l (@packages) {
|
| 45 : |
|
|
if ($l =~ s/^\[$linkno\]//) {
|
| 46 : |
|
|
$l =~ s/:/ --/;
|
| 47 : |
|
|
$l =~ s/ -- / \— /;
|
| 48 : |
tolimar |
49 |
push @output, "<li><a href=\"$url\">$l</a></li>";
|
| 49 : |
tolimar |
6 |
}
|
| 50 : |
|
|
}
|
| 51 : |
|
|
# print $line;
|
| 52 : |
|
|
|
| 53 : |
|
|
}
|
| 54 : |
|
|
|
| 55 : |
|
|
}
|
| 56 : |
|
|
print join "\n",@output;
|