| 1 | package NewsExtractor::SiteSpecificExtractor::news_ebc_net_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 | 1 | extends 'NewsExtractor::GenericExtractor'; | |||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Importer 'NewsExtractor::TextUtil' => 'reformat_dateline'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | sub _build_content_text { | ||||||||
|
Subroutine
_build_content_text: not called CC=1 SCAR=6.9
| |||||||||||
| 9 | 0 | my ($self) = @_; | |||||||||
| 10 | |||||||||||
| 11 | # Remove the in-article ad. | ||||||||||
| 12 | $self->dom->find("div.raw-style > content-ad > p")->grep( | ||||||||||
| 13 | 0 | ▶ | sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 14 | 0 | ▶ | ($_->child_nodes->size > 2) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | && ($_->children("a")->size >= 2) | ||||||||||
| 16 | } | ||||||||||
| 17 | 0 | )->map('remove'); | |||||||||
| 18 | |||||||||||
| 19 | 0 | my $text = $self->SUPER::_build_content_text(); | |||||||||
| 20 | |||||||||||
| 21 | 0 | $text =~ s/\n\n【往下看更多】.+\z//s; | |||||||||
| 22 | |||||||||||
| 23 | 0 | return $text; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub journalist { | ||||||||
|
Subroutine
journalist: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 27 | 0 | my ($self) = @_; | |||||||||
| 28 | 0 | ▶ | my $guess = $self->dom->at('.fncnews-content > .info > span.small-gray-text') or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | my $text = $guess->all_text; | |||||||||
| 30 | 0 | my ($name) = $text =~ m/(?:東森新聞(?:\s*責任編輯)?)\s+(.+)$/; | |||||||||
| 31 | 0 | return $name; | |||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 0 | ▶ | sub dateline { | ||||||||
|
Subroutine
dateline: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 35 | 0 | my ($self) = @_; | |||||||||
| 36 | 0 | ▶ | my $el = $self->dom->at(".fncnews-content > .info > span.small-gray-text") or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 37 | 0 | return reformat_dateline($el->all_text(), '+08:00'); | |||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 1 | 1; | |||||||||