Novel::Robot::Browser
get/post url, return unicode content, auto detect CJK charset
自动化获取网页内容,并解码为unicode,主要是自动检测网页的中文字符集
my $browser = Novel::Robot::Browser->new();
my $url = 'http://www.jjwxc.net/onebook.php?novelid=2456'; my $content_get_ref = $browser->request_url($url);
my $form_url = 'http://www.jjwxc.net/search.php'; my $post_data = { 'key1' => 'value1', 'key2' => 'value2', }; my $content_post_ref = $browser->request_url($form_url, $post_data);
my $src_arr = [ 'http://www.ustc.edu.cn', 'http://202.38.64.10' ]; my $res = $browser->request_urls( $src_arr, no_auto_request_url => 0, select_url_sub => sub { my ($src_arr) = @_; # ... }, data_sub => sub { my ($html_ref) = @_; # ... }, #request_sub => sub { #my ($r) = @_; # ... #return $data; #}, show_progress_bar => 1, );
my $src_arr = [ 'http://www.ustc.edu.cn', 'http://202.38.64.10' ]; my ($info, $url_list) = $browser->request_urls_iter( $url, info_sub => sub { my ($html_ref) = @_; # ... }, data_list_sub => sub { my ($html_ref) = @_; # ... }, stop_sub => sub { my ($info, $data_list) = @_; # ... }, url_list_sub => sub { my ($html_ref) = @_; # ... }, select_url_sub => sub { my ($url_list) = @_; # ... }, );
To install Novel::Robot::Browser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Novel::Robot::Browser
CPAN shell
perl -MCPAN -e shell install Novel::Robot::Browser
For more information on module installation, please visit the detailed CPAN module installation guide.