File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/www_twreporter_org.pm
Criterion Covered Total %
statement 9 18 50.0
branch 0 4 0.0
condition n/a
subroutine 3 5 60.0
pod 0 2 0.0
total 12 29 41.3


line stmt bran cond sub pod time code
1             package NewsExtractor::SiteSpecificExtractor::www_twreporter_org;
2 1     1   9 use utf8;
  1         2  
  1         13  
3 1     1   38 use Moo;
  1         3  
  1         8  
4             extends 'NewsExtractor::GenericExtractor';
5              
6 1     1   440 use Importer 'NewsExtractor::TextUtil' => 'u';
  1         3  
  1         9  
7              
8             sub dateline {
9 0     0 0   my ($self) = @_;
10 0 0         my $el = $self->dom->at('meta[itemprop=dateModified][content]') or return;
11              
12 0           my $dateline;
13 0 0         if (my ($y,$m,$d) = $el->attr('content') =~ m/([0-9]{4})\.([0-9]{1,2})\.([0-9]{1,2})/) {
14 0           $dateline = u(sprintf('%04d-%02d-%02d', $1, $2, $3));
15             }
16              
17 0           return $dateline;
18             }
19              
20             sub journalist {
21 0     0 0   my ($self) = @_;
22 0           my $txt = $self->dom->find('span[class^="metadata__AuthorName"]')->map('all_text')->uniq()->join('、');
23 0           return u($txt);
24             }
25              
26             1;