File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/news_ebc_net_tw.pm
Criterion Covered Total %
statement 9 23 39.1
branch 0 6 0.0
condition n/a
subroutine 3 7 42.8
pod 0 2 0.0
total 12 38 31.5


line stmt bran cond sub pod time code
1             use utf8;
2 1     1   7 use Moo;
  1         2  
  1         5  
3 1     1   26 extends 'NewsExtractor::GenericExtractor';
  1         2  
  1         6  
4              
5             use Importer 'NewsExtractor::TextUtil' => 'reformat_dateline';
6 1     1   251  
  1         2  
  1         5  
7             my ($self) = @_;
8              
9 0     0     # Remove the in-article ad.
10             $self->dom->find("div.raw-style > content-ad > p")->grep(
11             sub {
12             ($_->child_nodes->size > 2)
13             && ($_->children("a")->size >= 2)
14 0 0   0     }
15             )->map('remove');
16              
17 0           my $text = $self->SUPER::_build_content_text();
18              
19 0           $text =~ s/\n\n【往下看更多】.+\z//s;
20              
21 0           return $text;
22             }
23 0            
24             my ($self) = @_;
25             my $guess = $self->dom->at('.fncnews-content > .info > span.small-gray-text') or return;
26             my $text = $guess->all_text;
27 0     0 0   my ($name) = $text =~ m/(?:東森新聞(?:\s*責任編輯)?)\s+(.+)$/;
28 0 0         return $name;
29 0           }
30 0            
31 0           my ($self) = @_;
32             my $el = $self->dom->at(".fncnews-content > .info > span.small-gray-text") or return;
33             return reformat_dateline($el->all_text(), '+08:00');
34             }
35 0     0 0    
36 0 0         1;