标签:
#!perl -w use LWP; use Encode; my $browser = LWP::UserAgent->new(); #$ie->gotoURL(‘http://pingfandeshijie.com‘); #$ie->WaitforDone(); #$ie->getAllLiks(); $ci = 1; #$url = ‘http://www.pingfandeshijie.com/di-er-bu-01.html‘; for($ci = 1; $ci < 55; $ci ++){ if($ci < 10){ $ci2 = ‘0‘. $ci; }else{ $ci2 = $ci; } $url = ‘http://www.pingfandeshijie.com/di-san-bu-‘.$ci2.‘.html‘; $page = $browser->get($url); #$page = encode(‘gbk‘,decode(‘utf8‘,$page->content)); $page = decode(‘utf8‘,$page->content); my ($t,$t1,$t2) = split(/<div style="clear:both"><\/div>/,$page); #$page =~ s/.*?<div style="clear:both"><\/div>//; #$page =~ s/<div style="clear:both"><\/div>.*?//; #print encode(‘gbk‘,$page); print "第". $ci . "章<p>".encode(‘gbk‘,$t1). "\n"; }
标签:
原文地址:http://my.oschina.net/xiechaoyong/blog/383829