#!/usr/bin/perl
use HTTP::Tiny;
use Data::Dumper;
my $browser=HTTP::Tiny->new();
my $response=$browser->get("http://mirrors.ustc.edu.cn/CRAN/src/contrib/");
my $content=$response->{"content"};
my @lines=split/\n/,$content;
foreach my $line(@lines){
if($line=~m/href="([\d\w\.]+)"/){
my $packname=$1;
my $down_url="http://mirrors.ustc.edu.cn/CRAN/src/contrib/$packname";
system("wget -c $down_url -O ./$packname");
print $packname." downloaded\n";
}
}
时间: 2024-10-11 16:53:21