line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
4
|
use JSON; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
2
|
|
|
|
|
|
|
sub Webqq::Client::_get_recent_info { |
3
|
0
|
|
|
0
|
|
|
my $self = shift; |
4
|
0
|
|
|
|
|
|
my $ua = $self->{ua}; |
5
|
0
|
0
|
|
|
|
|
return undef if $self->{type} ne 'smartqq'; |
6
|
0
|
|
|
|
|
|
my $api_url = 'http://d.web2.qq.com/channel/get_recent_list2'; |
7
|
0
|
|
|
|
|
|
my @headers = ( |
8
|
|
|
|
|
|
|
Referer => 'http://d.web2.qq.com/proxy.html?v=20130916001&callback=1&id=2', |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
|
|
|
my %r = ( |
12
|
|
|
|
|
|
|
vfwebqq => $self->{qq_param}{vfwebqq}, |
13
|
|
|
|
|
|
|
clientid => $self->{qq_param}{clientid}, |
14
|
|
|
|
|
|
|
psessionid => $self->{qq_param}{psessionid}, |
15
|
|
|
|
|
|
|
); |
16
|
0
|
|
|
|
|
|
my $response = $ua->post($api_url,[r=>JSON->new->utf8->encode(\%r)],@headers); |
17
|
0
|
0
|
|
|
|
|
if($response->is_success){ |
18
|
0
|
0
|
|
|
|
|
print $response->content(),"\n" if $self->{debug}; |
19
|
0
|
|
|
|
|
|
my $json = JSON->new->utf8->decode($response->content()); |
20
|
0
|
0
|
|
|
|
|
return undef if $json->{retcode}!=0 ; |
21
|
0
|
|
|
|
|
|
my %type = (0 => 'friend',1 => 'group', 2 => 'discuss'); |
22
|
0
|
|
|
|
|
|
my @recent; |
23
|
0
|
|
|
|
|
|
for(@{$json->{result}}){ |
|
0
|
|
|
|
|
|
|
24
|
0
|
0
|
|
|
|
|
next unless exists $type{$_->{type}}; |
25
|
0
|
|
|
|
|
|
$_->{type} = $type{$_->{type}}; |
26
|
0
|
|
|
|
|
|
push @recent,$_; |
27
|
|
|
|
|
|
|
} |
28
|
0
|
0
|
|
|
|
|
return @recent>0?\@recent:undef; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
1; |