Novel::Robot::Parser 小说站点解析引擎
晋江:Jjwxc
豆豆:Dddbbb
努努:Nunu
书农:Shunong
爱尚:Asxs
落秋:Luoqiu
顶点:Dingdian
初始化解析模块
my $url = 'http://www.jjwxc.net/onebook.php?novelid=2456'; #直接指定站点 my $parser = Novel::Robot::Parser->new( site => 'Jjwxc' ); #通过url自动检测站点 my $parser = Novel::Robot::Parser->new( site => $url ); $parser->get_index_ref($url);
my $index_ref = $parser->get_index_ref($index_url, %opt);
my $index_ref = $parser->parse_index($index_html_ref);
$parser->update_chapter_id($index_ref);
$parser->update_chapter_num($index_ref);
my $chapter_url = 'http://www.jjwxc.net/onebook.php?novelid=2456&chapterid=2'; my $chapter_ref = $parser->get_chapter_ref($chapter_url, 2);
my $chapter_ref = $parser->parse_chapter($chapter_html_ref);
my $writer_url = 'http://www.jjwxc.net/oneauthor.php?authorid=3243'; my $writer_ref = $parser->get_writer_ref($writer_url);
my $writer_ref = $parser->parse_writer($writer_html_ref);
my $query_type = '作者'; my $query_value = '顾漫'; my $query_ref = $parser->get_query_ref($query_type, $query_value);
#查询类型: $type #查询关键字:$keyword my ($query_url, $post_data) = $parser->make_query_request( $type, $keyword );
my $query_ref = $parser->parse_query($query_html_ref);
my $query_urls_ref = $parser->parse_query_result_urls($query_html_ref);
my $inner_html = $parser->get_inner_html($element);
$parser->format_abs_url($index_ref->{chapter_info}, $index_ref->{index_url}); $parser->format_abs_url($index_ref->{more_book_info}, $index_ref->{index_url}); $parser->format_abs_url($query_urls_ref, $query_url);
To install Novel::Robot::Parser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Novel::Robot::Parser
CPAN shell
perl -MCPAN -e shell install Novel::Robot::Parser
For more information on module installation, please visit the detailed CPAN module installation guide.