line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::www_rti_org_tw; |
2
|
1
|
|
|
1
|
|
9
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
35
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::SiteSpecificExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
342
|
use Importer 'NewsExtractor::TextUtil' => ('html2text', 'normalize_whitespace', 'reformat_dateline'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub headline { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
0
|
|
|
|
|
|
my $el = $self->dom->at('meta[property="og:title"]'); |
11
|
0
|
|
|
|
|
|
return normalize_whitespace( $el->attr("content") ); |
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; |