I couldn't make
wget to complete this work. The status of the servers with public access here (upload|download) is as before - everybody can (up|down) everything. So the .mp3 download is time-consuming process if done 'by hand' and thus it's already automated:
use strict;
use LWP::Simple;
use WWW::Mechanize;
my $url = shift || die "no URL given!\n";
my $ext = '.mp3';
my ($name) = $url =~ /.+\/(.+?)\W+$/;
my $mech = WWW::Mechanize->new();
my %links = ();
$mech->get($url);
$name =~ s/(?:\W+\d*)+/-/g;
$name =~ s/\W*$//g;
my @links = $mech->links();
for (@links) {
$_->url() =~ /.+$ext$/
or next;
print $_->url(), $/;
$links{$_->url()} = 1;
}
for (sort keys %links) {
$.++;
my $filename = "$name.$.$ext";
{
my $newname;
while (-e $filename) {
$filename = "$name.$.-". ++$newname .$ext;
}
}
getstore($_, $filename);
print '[',scalar localtime,']'," $filename downloaded.\n";
}
__END__
>downloader some_URL
[Fri Sep 16 19:29:47 2005] ABBA-The-Definitive-Collection-Disc.1-1.mp3
+ downloaded.
[Fri Sep 16 19:30:56 2005] ABBA-The-Definitive-Collection-Disc.2-1.mp3
+ downloaded.
[Fri Sep 16 19:31:47 2005] ABBA-The-Definitive-Collection-Disc.3-1.mp3
+ downloaded.
[Fri Sep 16 19:32:26 2005] ABBA-The-Definitive-Collection-Disc.4-1.mp3
+ downloaded.
[Fri Sep 16 19:33:28 2005] ABBA-The-Definitive-Collection-Disc.5-1.mp3
+ downloaded.
[Fri Sep 16 19:33:59 2005] ABBA-The-Definitive-Collection-Disc.6-1.mp3
+ downloaded.
[Fri Sep 16 19:34:31 2005] ABBA-The-Definitive-Collection-Disc.7-1.mp3
+ downloaded.
...