You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
539 B
Perl

use LWP::Simple;
require HTML::Parser;
require HTML::LinkExtor;
$html = get("http://www.google.com");
$link_extor = HTML::LinkExtor->new(\&handle_links);
$link_extor->parse($html);
sub handle_links
{
($tag, %links) = @_;
if ($tag = 'a href' && $links{href} ne '') {
$url = $links{href};
$file = $url;
$file =~ s/http:\/\/www\.//;
$file =~ s/http:\/\///g;
$file =~ tr/\//-/;
print "Creating $file.\n";
mirror ($url, $file);
};
}