| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::www_ntdtv_com; |
|
2
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
3
|
1
|
|
|
1
|
|
34
|
use Moo; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::GenericExtractor'; |
|
5
|
1
|
|
|
1
|
|
367
|
use Importer 'NewsExtractor::TextUtil' => qw( normalize_whitespace ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub content_text { |
|
8
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
9
|
0
|
|
|
|
|
|
my $el = $self->dom->at("div[itemprop=articleBody]"); |
|
10
|
0
|
|
|
|
|
|
$el->find("div.print_link, div.single_ad")->map("remove"); |
|
11
|
0
|
|
|
|
|
|
my $last_child = $el->children->last; |
|
12
|
0
|
0
|
|
|
|
|
if ($last_child->all_text =~ /相關鏈接:/) { |
|
13
|
0
|
|
|
|
|
|
$last_child->remove; |
|
14
|
|
|
|
|
|
|
} |
|
15
|
0
|
|
|
|
|
|
my $txt = $el->all_text; |
|
16
|
0
|
|
|
|
|
|
$txt = normalize_whitespace($txt); |
|
17
|
0
|
|
|
|
|
|
return $txt; |
|
18
|
|
|
|
|
|
|
} |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub journalist { |
|
21
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
22
|
0
|
|
|
|
|
|
my ($name) = $self->content_text =~ m{ |
|
23
|
|
|
|
|
|
|
\n |
|
24
|
|
|
|
|
|
|
( |
|
25
|
|
|
|
|
|
|
新唐人亞太電視\p{Letter}+?報導 |
|
26
|
|
|
|
|
|
|
| ( 新唐人記者[\p{Letter}、]+報導 ) |
|
27
|
|
|
|
|
|
|
| ( 新唐人\p{Letter}+記者站綜合報導 ) |
|
28
|
|
|
|
|
|
|
| (\s* 記者\p{Letter}+報導/責任編輯:\p{Letter}+ \s*) |
|
29
|
|
|
|
|
|
|
| (\s* 責任編輯:\p{Letter}+ \s*) |
|
30
|
|
|
|
|
|
|
| (轉自\p{Letter}+/責任編輯:\p{Letter}+ \s*) |
|
31
|
|
|
|
|
|
|
| ( 採訪/\p{Letter}+ \s+ 編輯/\p{Letter}+ \s+ 後製/\p{Letter}+ ) |
|
32
|
|
|
|
|
|
|
) |
|
33
|
|
|
|
|
|
|
\z}xs; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$name =~ s/\A(//; |
|
36
|
0
|
|
|
|
|
|
$name =~ s/)\z//; |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $name; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |