line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Mixi::Scraper::Plugin::ViewMessage;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
642
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
4
|
use WWW::Mixi::Scraper::Plugin;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
validator {qw(
|
8
|
|
|
|
|
|
|
id is_anything
|
9
|
|
|
|
|
|
|
box is_anything
|
10
|
|
|
|
|
|
|
)};
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub scrape {
|
13
|
0
|
|
|
0
|
1
|
|
my ($self, $html) = @_;
|
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
my %scraper;
|
16
|
|
|
|
|
|
|
$scraper{message} = scraper {
|
17
|
0
|
|
|
0
|
|
|
process 'div#messageDetail>div.thumb>a',
|
18
|
|
|
|
|
|
|
'link' => '@href';
|
19
|
0
|
|
|
|
|
|
process 'div#messageDetail>div.thumb>a>img',
|
20
|
|
|
|
|
|
|
'image' => '@src',
|
21
|
|
|
|
|
|
|
'name' => '@alt';
|
22
|
0
|
|
|
|
|
|
process 'div#messageDetail>div.messageDetailHead>h3',
|
23
|
|
|
|
|
|
|
'subject' => 'TEXT';
|
24
|
0
|
|
|
|
|
|
process 'div#messageDetail>div.messageDetailHead>dl>dd',
|
25
|
|
|
|
|
|
|
'heads[]' => 'TEXT';
|
26
|
0
|
|
|
|
|
|
process 'div#message_body',
|
27
|
|
|
|
|
|
|
'description' => $self->html_or_text;
|
28
|
0
|
|
|
|
|
|
result qw( subject name link image description heads );
|
29
|
0
|
|
|
|
|
|
};
|
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $stash = $scraper{message}->scrape(\$html);
|
32
|
0
|
|
|
|
|
|
my $time = $stash->{heads}->[0];
|
33
|
0
|
|
|
|
|
|
$time =~ s/^.*(\d{4})\D+(\d{2})\D+(\d{2})\D+(\d{2})\D+(\d{2}).*$/$1\-$2\-$3 $4:$5/;
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
$stash->{time} = $time;
|
36
|
0
|
|
|
|
|
|
delete $stash->{heads};
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return $self->post_process( $stash )->[0];
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1;
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__
|