line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package NewsExtractor::SiteSpecificExtractor::www_allnews_tw; |
2
|
1
|
|
|
1
|
|
9
|
use utf8; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
10
|
|
3
|
1
|
|
|
1
|
|
37
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
4
|
|
|
|
|
|
|
extends 'NewsExtractor::SiteSpecificExtractor'; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
487
|
use Importer 'NewsExtractor::TextUtil' => 'normalize_whitespace'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub dom { |
9
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
10
|
0
|
|
|
|
|
|
return $self->tx->res->dom; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub headline { |
14
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
15
|
0
|
|
|
|
|
|
my $el = $self->dom->find('meta[property="og:title"]')->first; |
16
|
0
|
|
|
|
|
|
return $el->attr('content'); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub dateline { |
20
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
21
|
0
|
|
|
|
|
|
my $el = $self->dom->find('h2.newsTitle ~ div.desc > div:nth-child(1) > span:nth-child(1)')->first; |
22
|
0
|
|
|
|
|
|
return $el->text(); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub content_text { |
26
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
27
|
0
|
|
|
|
|
|
my $el = $self->dom->find('meta[property="og:description"]')->first; |
28
|
0
|
|
|
|
|
|
return normalize_whitespace( $el->attr('content') ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub journalist { |
32
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
33
|
0
|
|
|
|
|
|
my ($txt) = $self->content_text =~ m/\A【(本報記者.+?報導)】/; |
34
|
0
|
|
|
|
|
|
return $txt; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |