line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Mixi::Scraper::Plugin::ShowFriend;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
989
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
5
|
use WWW::Mixi::Scraper::Plugin;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
6
|
use WWW::Mixi::Scraper::Utils qw( _uri );
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
104
|
|
7
|
1
|
|
|
1
|
|
7
|
use utf8;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
validator {qw( id is_number )};
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub scrape {
|
12
|
0
|
|
|
0
|
1
|
|
my ($self, $html) = @_;
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
return {
|
15
|
0
|
|
|
|
|
|
profile => $self->_scrape_profile($html),
|
16
|
|
|
|
|
|
|
outline => $self->_scrape_outline($html),
|
17
|
|
|
|
|
|
|
};
|
18
|
|
|
|
|
|
|
}
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _scrape_profile {
|
21
|
0
|
|
|
0
|
|
|
my ($self, $html) = @_;
|
22
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
my %scraper;
|
24
|
|
|
|
|
|
|
$scraper{items} = scraper {
|
25
|
0
|
|
|
0
|
|
|
process 'th',
|
26
|
|
|
|
|
|
|
key => 'TEXT';
|
27
|
0
|
|
|
|
|
|
process 'td',
|
28
|
|
|
|
|
|
|
value => $self->html_or_text;
|
29
|
0
|
|
|
|
|
|
result qw( key value );
|
30
|
0
|
|
|
|
|
|
};
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$scraper{profile} = scraper {
|
33
|
0
|
|
|
0
|
|
|
process 'div.profileListTable>div>table>tr',
|
34
|
|
|
|
|
|
|
'items[]' => $scraper{items};
|
35
|
0
|
|
|
|
|
|
result qw( items );
|
36
|
0
|
|
|
|
|
|
};
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $stash = $self->post_process($scraper{profile}->scrape(\$html));
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $profile = {};
|
41
|
0
|
|
|
|
|
|
foreach my $item ( @{ $stash } ) {
|
|
0
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
next unless $item->{key};
|
43
|
0
|
|
|
|
|
|
$profile->{$item->{key}} = $item->{value};
|
44
|
|
|
|
|
|
|
}
|
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return $profile;
|
47
|
|
|
|
|
|
|
}
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _scrape_outline {
|
50
|
0
|
|
|
0
|
|
|
my ($self, $html) = @_;
|
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my %scraper;
|
53
|
|
|
|
|
|
|
$scraper{outline} = scraper {
|
54
|
0
|
|
|
0
|
|
|
process 'div#myArea>div.profilePhoto>div.contents>p.name',
|
55
|
|
|
|
|
|
|
'string' => 'TEXT';
|
56
|
0
|
|
|
|
|
|
process 'div#myArea>div.profilePhoto>div.contents>p.name>span.loginTime',
|
57
|
|
|
|
|
|
|
'description' => 'TEXT';
|
58
|
0
|
|
|
|
|
|
process 'div#myArea>div.profilePhoto>div.contents>p.photo>a>img',
|
59
|
|
|
|
|
|
|
image => '@src';
|
60
|
0
|
|
|
|
|
|
process 'div.personalNavigation>ul>li.profile>a',
|
61
|
|
|
|
|
|
|
link => '@href';
|
62
|
0
|
|
|
|
|
|
result qw( image string description link );
|
63
|
0
|
|
|
|
|
|
};
|
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $stash = $self->post_process($scraper{outline}->scrape(\$html))->[0];
|
66
|
|
|
|
|
|
|
|
67
|
0
|
|
0
|
|
|
|
my $string = delete $stash->{string} || '';
|
68
|
0
|
0
|
|
|
|
|
if ( $string =~ s/さん\((\d+)\)\s.+// ) {
|
69
|
0
|
|
|
|
|
|
$stash->{name} = $string;
|
70
|
0
|
|
|
|
|
|
$stash->{count} = $1;
|
71
|
|
|
|
|
|
|
}
|
72
|
0
|
0
|
|
|
|
|
if ( $stash->{description} ) {
|
73
|
0
|
|
|
|
|
|
$stash->{description} =~ s/^(//;
|
74
|
0
|
|
|
|
|
|
$stash->{description} =~ s/)$//;
|
75
|
|
|
|
|
|
|
}
|
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
return $stash;
|
78
|
|
|
|
|
|
|
}
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1;
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__
|