« NewsExtractor/SiteSpecificExtractor/newtalk_tw.pm
↑ Summary
NewsExtractor/SiteSpecificExtractor/www_twreporter_org.pm »
| 1 | package NewsExtractor::SiteSpecificExtractor::news_ttv_com_tw; | ||||||||||
| 2 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | extends 'NewsExtractor::GenericExtractor'; | |||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use Importer 'NewsExtractor::TextUtil' => qw(u reformat_dateline); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | sub dateline { | ||||||||
|
Subroutine
dateline: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 9 | 0 | my ($self) = @_; | |||||||||
| 10 | 0 | ▶ | my $el = $self->dom->at("li.date.time") or return; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 11 | 0 | my $t = $el->all_text; | |||||||||
| 12 | 0 | reformat_dateline( $t, '+08:00' ); | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 0 | ▶ | sub journalist { | ||||||||
|
Subroutine
journalist: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 16 | 0 | my ($self) = @_; | |||||||||
| 17 | |||||||||||
| 18 | 0 | my $x; | |||||||||
| 19 | 0 | my $t = $self->content_text; | |||||||||
| 20 | 0 | my @regexps = ( | |||||||||
| 21 | qr{(記者\s*([^/]+?)\s*/.+?報導)}, | ||||||||||
| 22 | qr{(責任編輯/\p{Letter}+)\z}, | ||||||||||
| 23 | ); | ||||||||||
| 24 | |||||||||||
| 25 | 0 | for my $re (@regexps) { | |||||||||
| 26 | 0 | ($x) = $t =~ /$re/; | |||||||||
| 27 | 0 | ▶ | last if $x; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 0 | return $x; | |||||||||
| 31 | } | ||||||||||
| 32 | |||||||||||
| 33 | 1 | 1; | |||||||||