line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::www_nownews_com; |
2
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
3
|
1
|
|
|
1
|
|
33
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::SiteSpecificExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
312
|
use Importer 'NewsExtractor::TextUtil' => qw( reformat_dateline html2text ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub headline { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
0
|
|
|
|
|
|
return $self->dom->at('h3.newsTitle')->text; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub content_text { |
14
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
15
|
0
|
0
|
|
|
|
|
my $el = $self->dom->at('div.newsMsg') or return; |
16
|
0
|
|
|
|
|
|
return html2text( $el->to_string ); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub dateline { |
20
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
21
|
0
|
|
|
|
|
|
return reformat_dateline( $self->dom->at('div.newsInfo')->all_text(), '+08:00' ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub journalist { |
25
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
26
|
0
|
|
|
|
|
|
my ($x) = $self->dom->at('div.newsInfo')->all_text =~ m{^記者(.+)/\S+報導-}; |
27
|
0
|
|
|
|
|
|
return $x; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |