NewsExtractor/SiteSpecificExtractor/UDN.pm

filter: Statementstmt 31.4% 11 / 35 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 37.5% 3 / 8 Podpod 0.0% 0 / 4 totaltotal 24.5% 14 / 57 CC 6 SCAR 19.5
CC
6
Cov
24%
dateline
12.0
journalist
12.0
headline
6.0
CRAP 7.0
« NewsExtractor/SiteSpecificExtractor/www_bcc_com_tw.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/newtalk_tw.pm »
1 package NewsExtractor::SiteSpecificExtractor::UDN;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 extends 'NewsExtractor::SiteSpecificExtractor';
5  
6 1 ▶use Importer 'NewsExtractor::TextUtil' => qw( html2text normalize_whitespace reformat_dateline );
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub headline {
Subroutine headline: not called CC=2 SCAR=17.9
Pod undocumented
9 0 my ($self) = @_;
10 0 ▶ my $el = $self->dom->at('#story_art_title, h1.story_art_title, h1.article-content__title') or return;
Branch: 1 branch
BranchTrueFalseTotal
my $el = $self->dom->at("#story_art_title, h1.story_art_title, h1.article-content__title") or return 0 0 0
11 0 my $txt = $el->all_text;
12 0 return normalize_whitespace($txt);
13 }
14  
15 0 ▶sub dateline {
Subroutine dateline: not called CC=3 SCAR=24.8
Pod undocumented
16 0 my ($self) = @_;
17 0 my $el;
18 0 ▶ if ($el = $self->dom->at(".shareBar__info--author > span:nth-child(1), .authors time.article-content__time")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el = $self->dom->at(".shareBar__info--author > span:nth-child(1), .authors time.article-content__time")) 0 0 0
19 0 my $txt = $el->all_text;
20 0 return normalize_whitespace($txt);
21 }
22  
23 # opinion.udn.com
24 0 ▶ if ($el = $self->dom->at('.story_bady_info > time[datetime]')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el = $self->dom->at(".story_bady_info > time[datetime]")) 0 0 0
25 0 return reformat_dateline($el->all_text, '+08:00');
26 }
27 }
28  
29 0 ▶sub journalist {
Subroutine journalist: not called CC=3 SCAR=24.8
Pod undocumented
30 0 my ($self) = @_;
31 0 my $el;
32 0 ▶ if ($el = $self->dom->at(".shareBar__info--author, .authors span.article-content__author")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el = $self->dom->at(".shareBar__info--author, .authors span.article-content__author")) 0 0 0
33 0 my $txt = $el->all_text;
34 0 $txt =~ s/\s+/ /g; # Sometimes there are newlines
35 0 return normalize_whitespace($txt);
36 }
37  
38 # opinion.udn.com
39 0 ▶ if ($el = $self->dom->at('.story_bady_info')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($el = $self->dom->at(".story_bady_info")) 0 0 0
40 0 ▶ return $el->find('a.author')->map(sub { normalize_whitespace( $_->text ) })->join(', ') . "";
Subroutine __ANON__: not called CC=1 SCAR=6.9
41 }
42 }
43  
44 0 ▶sub content_text {
Subroutine content_text: not called CC=1 SCAR=6.9
Pod undocumented
45 0 my ($self) = @_;
46 0 my $el = $self->dom->at("section.article-content__editor");
47 0 $el->find("script, style")->map("remove");
48 0 return html2text("$el");
49 }
50  
51 1 1;
« NewsExtractor/SiteSpecificExtractor/www_bcc_com_tw.pm ↑ Summary NewsExtractor/SiteSpecificExtractor/newtalk_tw.pm »