| 1 | package NewsExtractor::SiteSpecificExtractor::www_hkcnews_com; | ||||||||||||||||||||||||||||||||||||||||||
| 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::GenericExtractor'; | |||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 0 | ▶ | around headline => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 0 | my $orig = shift; | |||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | my $self = $_[0]; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | my $headline = $orig->(@_); | |||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my $journalist = $self->journalist(); | |||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | $headline =~ s/\s\|\s${journalist}$//; | |||||||||||||||||||||||||||||||||||||||||
| 12 | 0 | return $headline; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 1 | }; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub journalist { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
journalist: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | my $el = $self->dom->at('.article-info'); | |||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | my ($n) = $el->all_text =~ m{^(?:Author|撰文): (?:(?:特約)?記者)?(.+?) \|}; | |||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | return $n; | |||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub dateline { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dateline: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | my $el = $self->dom->at('.article-info'); | |||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | my ($dd,$mm,$yy) = $el->all_text =~ m{(?:發佈日期|Publish Date):\s([0-9]{2})\.([0-9]{2})\.([0-9]{2})\b}; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | return undef unless ($dd && $mm && $yy); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$dd and $mm and $yy
$dd and $mm
MC/DC0%0/3
$dd and $mm and $yy
$dd
$mm
$yy
Truth table0%0/4
A and B and C
A= $ddB= $mmC= $yy
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return "20${yy}-${mm}-${dd}T23:59:59+08:00"; | |||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||