line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::www_rti_org_tw; |
2
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
57
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
72
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::SiteSpecificExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
367
|
use Importer 'NewsExtractor::TextUtil' => ('html2text', 'normalize_whitespace', 'reformat_dateline'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub headline { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
0
|
|
|
|
|
|
my $el = $self->dom->at('.news-detail-box > hgroup:nth-child(1) > h1:nth-child(1)'); |
11
|
0
|
|
|
|
|
|
return normalize_whitespace( $el->all_text ); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub dateline { |
15
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
16
|
0
|
|
|
|
|
|
my $el = $self->dom->at('.date'); |
17
|
0
|
|
|
|
|
|
my $txt = normalize_whitespace( $el->all_text ); |
18
|
0
|
|
|
|
|
|
$txt =~ s/^時間://; |
19
|
0
|
|
|
|
|
|
return reformat_dateline($txt, '+08:00'); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub journalist { |
23
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
24
|
0
|
|
|
|
|
|
my $el = $self->dom->at('li.source:nth-child(3)'); |
25
|
0
|
|
|
|
|
|
return $el->all_text; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub content_text { |
29
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
30
|
0
|
|
|
|
|
|
my $el = $self->dom->at('.news-detail-box > article:nth-child(4)'); |
31
|
0
|
|
|
|
|
|
return html2text( $el->to_string ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |