清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
use utf8; binmode(STDIN, ':encoding(utf8)'); binmode(STDOUT, ':encoding(utf8)'); binmode(STDERR, ':encoding(utf8)'); use LWP::UserAgent; use LWP::Simple; $|=1; my $agent = 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062'; my $ua= LWP::UserAgent->new(agent => $agent); my %index = ('10','科幻科普','12','奇幻灵异','11','武侠仙侠','20','侦探推理','13','都市言情','14','当代现代','16','历史军事','17','政治经济','21','人物传记','18','哲学宗教','15','古典诗词'); while(my ($i,$f) = each(%index)) { mkdir $f; for my $pn(1..18) { my $response = $ua->get("http://blah.me/category/$i?p=$pn"); print "http://blah.me/category/$i?p=$pn\n"; if ($response->is_success) { my $content = $response->decoded_content; if ($content =~ /未找到/) { last; } my @ret = ($content =~ m/Epub" href="(\/download\/ebook\/\d+\/epub)"\s+data-book-type="epub"\s+data-book-id="\d+"\s+data-book-title="(.*?)"/gso); my %ret = @ret; while(my ($u,$n) = each(%ret)) { print $u.': '.$n; print "\n"; my $filename = "$f/$n.epub"; if (! -e $filename) { getstore("http://blah.me".$u, $filename); } } } else { print "$i $f $pn failed\n"; } } }