line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
use utf8; |
2
|
1
|
|
|
1
|
|
6
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
3
|
1
|
|
|
1
|
|
26
|
extends 'NewsExtractor::SiteSpecificExtractor'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Importer 'NewsExtractor::TextUtil' => 'html2text'; |
6
|
1
|
|
|
1
|
|
254
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
|
|
|
|
|
|
my ($self) = @_; |
8
|
|
|
|
|
|
|
my $el = $self->dom->at('head > title'); |
9
|
0
|
|
|
0
|
0
|
|
return $el->all_text; |
10
|
0
|
|
|
|
|
|
} |
11
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my ($self) = @_; |
13
|
|
|
|
|
|
|
my $el = $self->dom->at('div.tt27') or return undef; |
14
|
|
|
|
|
|
|
my $txt = $el->all_text; |
15
|
0
|
|
|
0
|
0
|
|
$txt =~ s/\s+報導\z//; |
16
|
0
|
0
|
|
|
|
|
return $txt; |
17
|
0
|
|
|
|
|
|
} |
18
|
0
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
my ($self) = @_; |
20
|
|
|
|
|
|
|
my $content = $self->content_text or return undef; |
21
|
|
|
|
|
|
|
my ($o) = $content =~ m{。 [(\(] (\p{Letter}+?) 報導 [)\)] \n\n}x; |
22
|
|
|
|
|
|
|
unless ($o) { |
23
|
0
|
|
|
0
|
0
|
|
($o) = $content =~ m{。 [(\(] 中廣記者 (\p{Letter}+?) [)\)] \z}x; |
24
|
0
|
0
|
|
|
|
|
} |
25
|
0
|
|
|
|
|
|
return $o; |
26
|
0
|
0
|
|
|
|
|
} |
27
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my ($self) = @_; |
29
|
0
|
|
|
|
|
|
my $el; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
for $el ($self->dom->find('script, div.ft')->each) { |
32
|
|
|
|
|
|
|
$el->remove(); |
33
|
0
|
|
|
0
|
0
|
|
} |
34
|
0
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$el = $self->dom->at('#some-class-name') or return undef; |
36
|
0
|
|
|
|
|
|
return html2text( $el->to_string ); |
37
|
0
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |