| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::news_ebc_net_tw; |
|
2
|
1
|
|
|
1
|
|
9
|
use utf8; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
3
|
1
|
|
|
1
|
|
42
|
use Moo; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::GenericExtractor'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
370
|
use Importer 'NewsExtractor::TextUtil' => 'reformat_dateline'; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub _build_content_text { |
|
9
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Remove the in-article ad. |
|
12
|
|
|
|
|
|
|
$self->dom->find("#contentb p > a[href^='https://bit.ly/']")->grep( |
|
13
|
|
|
|
|
|
|
sub { |
|
14
|
0
|
0
|
|
0
|
|
|
($_->parent->children->size == 1) |
|
15
|
|
|
|
|
|
|
&& ($_->text =~ m/^★/) |
|
16
|
0
|
|
|
|
|
|
})->map('remove'); |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Remove recommendations at the end of the article body. |
|
19
|
0
|
|
|
|
|
|
$self->dom->at("#contentb div.raw-style > span:nth-child(1)")->following_nodes()->map('remove'); |
|
20
|
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return $self->SUPER::_build_content_text(); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub journalist { |
|
25
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
26
|
0
|
0
|
|
|
|
|
my $guess = $self->dom->at('.fncnews-content > .info > span.small-gray-text') or return; |
|
27
|
0
|
|
|
|
|
|
my $text = $guess->all_text; |
|
28
|
0
|
|
|
|
|
|
my ($name) = $text =~ m/(?:東森新聞(?:\s*責任編輯)?)\s+(.+)$/; |
|
29
|
0
|
|
|
|
|
|
return $name; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub dateline { |
|
33
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
34
|
0
|
0
|
|
|
|
|
my $el = $self->dom->at(".fncnews-content > .info > span.small-gray-text") or return; |
|
35
|
0
|
|
|
|
|
|
return reformat_dateline($el->all_text(), '+08:00'); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |