File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/www_rvn_com_tw.pm
Criterion Covered Total %
statement 15 17 88.2
branch n/a
condition n/a
subroutine 5 6 83.3
pod n/a
total 20 23 86.9


line stmt bran cond sub pod time code
1             use utf8;
2 1     1   6  
  1         3  
  1         6  
3             use Moo;
4 1     1   27 extends 'NewsExtractor::SiteSpecificExtractor';
  1         2  
  1         6  
5             use Types::Standard qw(InstanceOf);
6 1     1   283  
  1         2  
  1         7  
7             has extractor => (
8             required => 0,
9             is => 'lazy',
10             isa => InstanceOf["NewsExtractor::CSSExtractor"],
11             builder => 1,
12             handles => [qw( headline dateline journalist content_text )],
13             );
14              
15             use NewsExtractor::CSSRuleSet;
16 1     1   493 use NewsExtractor::CSSExtractor;
  1         2  
  1         19  
17 1     1   4  
  1         2  
  1         233  
18             my ($self) = @_;
19             return NewsExtractor::CSSExtractor->new(
20 0     0     css_selector => NewsExtractor::CSSRuleSet->new(
21 0           headline => 'td[height=30][align=CENTER] b font',
22             dateline => 'tr > td[align=left] > b > font[style="font-size:11pt;"]',
23             journalist => 'tr > td[align=left] > b > font[style="font-size:11pt;"]',
24             content_text => 'td[colspan=2] > p > span[style="font-size:16px"]',
25             ),
26             tx => $self->tx,
27             )
28             }
29              
30             around 'dateline' => sub {
31             my $orig = shift;
32             my $ret = $orig->(@_);
33             $ret =~ s/^(.+\S)\s+(記者:.+)$/$1/;
34             return $ret;
35             };
36              
37             around 'journalist' => sub {
38             my $orig = shift;
39             my $ret = $orig->(@_);
40             $ret =~ s/^(.+\S)\s+(記者:.+)$/$2/;
41             return $ret;
42             };
43              
44             1;