File Coverage

blib/lib/NewsExtractor/SiteSpecificExtractor/newtalk_tw.pm
Criterion Covered Total %
statement 9 16 56.2
branch 0 4 0.0
condition n/a
subroutine 3 4 75.0
pod 0 1 0.0
total 12 25 48.0


line stmt bran cond sub pod time code
1             use utf8;
2 1     1   7 use Moo;
  1         2  
  1         5  
3 1     1   27 extends 'NewsExtractor::GenericExtractor';
  1         2  
  1         4  
4              
5             use Importer 'NewsExtractor::TextUtil' => 'u';
6 1     1   269  
  1         7  
  1         7  
7             my ($self) = @_;
8             my ($el, $dateline);
9 0     0 0   if ($el = $self->dom->at('meta[property="article:published_time"]')) {
10 0           $dateline = $el->attr('content');
11 0 0         } elsif ($el = $self->dom->at('div.contentBox div.content_date')) {
    0          
12 0           my @t = $el->all_text =~ m/([0-9]+)/g;
13             $dateline = u(sprintf('%04d-%02d-%02dT%02d:%02d:%02d+08:00',
14 0           $t[0], $t[1], $t[2], $t[3], $t[4], 59));
15 0           }
16             return $dateline;
17             }
18 0            
19             1;