line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::www_ksnews_com_tw; |
2
|
1
|
|
|
1
|
|
9
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
21
|
|
3
|
1
|
|
|
1
|
|
315
|
use Moo; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
9
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::GenericExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
387
|
use Importer 'NewsExtractor::TextUtil' => qw( normalize_whitespace ); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
10
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub headline { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
0
|
|
|
|
|
|
my $el = $self->dom->at("div.contents_page h1.title_"); |
11
|
0
|
|
|
|
|
|
return $el->text; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub dateline { |
15
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
16
|
0
|
|
|
|
|
|
my $el = $self->dom->at(".date"); |
17
|
0
|
|
|
|
|
|
return $el->text; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub journalist { |
21
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
22
|
0
|
|
|
|
|
|
my $text = $self->content_text; |
23
|
0
|
|
|
|
|
|
my ($name) = $text =~ m{\b (?:\V+[╱/])? 記者(.+?) [//]? 報導\b}x; |
24
|
0
|
|
|
|
|
|
return $name; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub content_text { |
28
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
29
|
0
|
|
|
|
|
|
my $el = $self->dom->at(".edit > section"); |
30
|
0
|
|
|
|
|
|
my $text = $el->all_text; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $headline = $self->headline; |
33
|
0
|
|
|
|
|
|
$text =~ s/\A\s+$headline\s+//s; |
34
|
0
|
|
|
|
|
|
$text = normalize_whitespace($text); |
35
|
0
|
|
|
|
|
|
return $text; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
1; |