| 1 | # ABSTRACT: default | ||
| 2 | package Novel::Robot::Parser::default; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use utf8; | ||
| 6 | use base 'Novel::Robot::Parser'; | ||
| 7 | |||
| 8 | #sub scrape_novel { { | ||
| 9 | #book => { path=> '//div[@class="mytitle"]' }, | ||
| 10 | |||
| 11 | ##writer => { path=> '//div[@class="author"]/a'}, | ||
| 12 | #writer => { regex => '最新章节\((.+?)\)', }, | ||
| 13 | #} } | ||
| 14 | |||
| 15 | #sub parse_novel { | ||
| 16 | #my ( $self, $h, $r ) = @_; | ||
| 17 | #$ref->{writer}= ... | ||
| 18 | #$ref->{book}= ... | ||
| 19 | #return $r; | ||
| 20 | #} | ||
| 21 | |||
| 22 | #sub scrape_item_list { | ||
| 23 | #{ path=> '//dl[@class="chapterlist"]//dd//a'} | ||
| 24 | #} | ||
| 25 | |||
| 26 | #sub scrape_novel_item { { | ||
| 27 | #title => { path => '//h1', }, | ||
| 28 | |||
| 29 | ##content=>{ path => '//div[@id="content"]', extract => 'HTML' }, | ||
| 30 | ##content => { regex=> '<DIV id=content name="content">.*?<P>(.+?)</P>' }, | ||
| 31 | #content=>{ path => '//div[@id="TXT"]', extract => 'HTML', sub => sub { | ||
| 32 | #my ($c) = @_; | ||
| 33 | #$c=~s#<div class="bottem">.*$##s; | ||
| 34 | #return $c; | ||
| 35 | #}, | ||
| 36 | #}, | ||
| 37 | #} } | ||
| 38 | |||
| 39 | #sub parse_novel_item { | ||
| 40 | #my ( $self, $html_ref, $ref ) = @_; | ||
| 41 | |||
| 42 | #$ref->{content}=~s/^.*?正文,敬请欣赏!//s; | ||
| 43 | #return $ref; | ||
| 44 | #} ## end sub parse_novel_item | ||
| 45 | |||
| 46 | 1; |