« NewsExtractor/SiteSpecificExtractor/www_twreporter_org.pm
↑ Summary
NewsExtractor/SiteSpecificExtractor/news_ebc_net_tw.pm »
| 1 | package NewsExtractor::SiteSpecificExtractor::news_pts_org_tw; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 5 | 1 | extends 'NewsExtractor::JSONLDExtractor'; | |||||||||||||||||||||||||||
| 6 | 1 | with 'NewsExtractor::Role::ContentTextExtractor'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use HTML::ExtractContent; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Importer 'NewsExtractor::TextUtil' => ('html2text', 'reformat_dateline'); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use Importer 'Ref::Util' => ('is_hashref'); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | sub journalist { | ||||||||||||||||||||||||||
|
Subroutine
journalist: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 14 | 0 | my $name; | |||||||||||||||||||||||||||
| 15 | 0 | my $author = $self->schema_ld->{author}; | |||||||||||||||||||||||||||
| 16 | 0 | ▶ | if (is_hashref($author) && exists($author->{"name"})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
is_hashref($author) and exists $author->{"name"}
MC/DC0%0/2
is_hashref($author) and exists $author->{"name"}
is_hashref($author)
exists $author->{"name"}
Truth table0%0/3
A and B
A= is_hashref($author)B= exists $author->{"name"}
| |||||||||||||||||||||||||||||
| 17 | 0 | $name = $author->{"name"}; | |||||||||||||||||||||||||||
| 18 | } else { | ||||||||||||||||||||||||||||
| 19 | 0 | $name = $author; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | 0 | return $name; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | around dateline => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 25 | 0 | my $orig = shift; | |||||||||||||||||||||||||||
| 26 | 0 | my $ret = $orig->(@_); | |||||||||||||||||||||||||||
| 27 | 0 | return reformat_dateline($ret, '+08:00'); | |||||||||||||||||||||||||||
| 28 | 1 | }; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | around '_build_content_text', sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 31 | 0 | my $orig = shift; | |||||||||||||||||||||||||||
| 32 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if (my $el = $self->dom->at('article.post-article')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | my $extractor = HTML::ExtractContent->new; | |||||||||||||||||||||||||||
| 36 | 0 | my $html = $extractor->extract("$el")->as_html; | |||||||||||||||||||||||||||
| 37 | 0 | my $text = html2text( $html ); | |||||||||||||||||||||||||||
| 38 | 0 | return $text; | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | return $orig->($self); | |||||||||||||||||||||||||||
| 42 | 1 | }; | |||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 1 | 1; | |||||||||||||||||||||||||||