line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::new_ctv_com_tw; |
2
|
1
|
|
|
1
|
|
7
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
36
|
use Moo; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::GenericExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
371
|
use Importer 'NewsExtractor::TextUtil' => qw(u); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub headline { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
0
|
|
|
|
|
|
my $headline = $self->dom->at('meta[property="og:title"][content]')->attr('content'); |
11
|
0
|
|
|
|
|
|
$headline =~ s/│中視新聞 [0-9]{8}\z//; |
12
|
0
|
|
|
|
|
|
return $headline; |
13
|
|
|
|
|
|
|
}; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub dateline { |
16
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
17
|
0
|
|
|
|
|
|
my $dateline = $self->dom->at("div.author")->text =~ s /\A中視新聞 \| //r; |
18
|
0
|
|
|
|
|
|
my @t = split /[^0-9]+/, $dateline; |
19
|
0
|
|
|
|
|
|
return u( sprintf('%04d-%02d-%02dT%02d:%02d:%02d+08:00', $t[0], $t[1], $t[2], $t[3], $t[4], $t[5]) ); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
1; |