line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Mixi::Scraper::Plugin::ListMessage;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
744
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
4
|
use WWW::Mixi::Scraper::Plugin;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
validator {qw( page is_number box is_anything )};
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub scrape {
|
10
|
0
|
|
|
0
|
1
|
|
my ($self, $html) = @_;
|
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my %scraper;
|
13
|
|
|
|
|
|
|
$scraper{messages} = scraper {
|
14
|
0
|
|
|
0
|
|
|
process 'td.subject',
|
15
|
|
|
|
|
|
|
string => 'TEXT';
|
16
|
0
|
|
|
|
|
|
process 'td.subject>a',
|
17
|
|
|
|
|
|
|
link => '@href';
|
18
|
0
|
|
|
|
|
|
process 'td.status>img',
|
19
|
|
|
|
|
|
|
envelope => '@src';
|
20
|
0
|
|
|
|
|
|
process 'td.date',
|
21
|
|
|
|
|
|
|
date => 'TEXT';
|
22
|
0
|
|
|
|
|
|
process 'td.sender',
|
23
|
|
|
|
|
|
|
sender => 'TEXT';
|
24
|
0
|
|
|
|
|
|
result qw( string envelope link date sender );
|
25
|
0
|
|
|
|
|
|
};
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$scraper{list} = scraper {
|
28
|
0
|
|
|
0
|
|
|
process 'div.messageListBody>table.tableBody>tr',
|
29
|
|
|
|
|
|
|
'messages[]' => $scraper{messages};
|
30
|
0
|
|
|
|
|
|
result qw( messages );
|
31
|
0
|
|
|
|
|
|
};
|
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $stash = $self->post_process( $scraper{list}->scrape(\$html) );
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my @messages;
|
36
|
0
|
|
|
|
|
|
for my $msg (@{ $stash }) {
|
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
$msg->{sender} =~ s/^\s+//;
|
38
|
0
|
|
|
|
|
|
$msg->{sender} =~ s/\s+$//;
|
39
|
0
|
|
|
|
|
|
push @messages, {
|
40
|
|
|
|
|
|
|
subject => $msg->{string},
|
41
|
|
|
|
|
|
|
name => $msg->{sender},
|
42
|
|
|
|
|
|
|
link => $msg->{link},
|
43
|
|
|
|
|
|
|
envelope => $msg->{envelope},
|
44
|
|
|
|
|
|
|
time => $msg->{date}, #???
|
45
|
|
|
|
|
|
|
};
|
46
|
|
|
|
|
|
|
}
|
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return $self->post_process( \@messages );
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1;
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__
|