- system(q(wget),'-nd','-nH','-w','2','--random-wait','-P',qq($options{dir}/$dir_name),@current_urls) == 0 or warn "$!";
+ for my $url (@current_urls) {
+ # sleep for around 2 seconds
+ usleep((0.5+rand)*2*1000000);
+ $mech->get($url);
+ my $cleaned_url = $url;
+ $cleaned_url =~ s{http://}{}g;
+ $cleaned_url =~ s/[^\w]//g;
+ eval {
+ $mech->save_content($options{dir}.'/'.$dir_name.'/'.$cleaned_url);
+ print "retreived $url\n";
+ };
+ if ($@) {
+ warn $@;
+ }
+ }
+ #system(q(wget),'-nd','-nH','-w','2','--random-wait','-P',qq($options{dir}/$dir_name),@current_urls) == 0 or warn "$!";