| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
29
|
use JSON; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
2
|
1
|
|
|
1
|
|
81
|
use Webqq::Client::Util qw(code2state); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
305
|
|
|
3
|
|
|
|
|
|
|
sub Webqq::Client::_get_friend_info{ |
|
4
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
5
|
0
|
|
|
|
|
|
my $uin = shift; |
|
6
|
0
|
|
|
|
|
|
my $api_url = 'http://s.web2.qq.com/api/get_friend_info2'; |
|
7
|
0
|
|
|
|
|
|
my $ua = $self->{ua}; |
|
8
|
0
|
0
|
|
|
|
|
my @headers = $self->{type} eq 'webqq'? (Referer=>'http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=3') |
|
9
|
|
|
|
|
|
|
: (Referer=>'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1') |
|
10
|
|
|
|
|
|
|
; |
|
11
|
0
|
|
|
|
|
|
my @query_string = ( |
|
12
|
|
|
|
|
|
|
tuin => $uin, |
|
13
|
|
|
|
|
|
|
vfwebqq => $self->{qq_param}{vfwebqq}, |
|
14
|
|
|
|
|
|
|
clientid => $self->{qq_param}{clientid}, |
|
15
|
|
|
|
|
|
|
psessionid => $self->{qq_param}{psessionid}, |
|
16
|
|
|
|
|
|
|
t => time, |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if($self->{type} eq 'webqq'){ |
|
20
|
0
|
|
|
|
|
|
@query_string = ( |
|
21
|
|
|
|
|
|
|
tuin => $uin, |
|
22
|
|
|
|
|
|
|
verifysession => undef, |
|
23
|
|
|
|
|
|
|
code => undef, |
|
24
|
|
|
|
|
|
|
vfwebqq => $self->{qq_param}{vfwebqq}, |
|
25
|
|
|
|
|
|
|
t => time, |
|
26
|
|
|
|
|
|
|
); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
0
|
|
|
|
|
|
my @query_string_pairs; |
|
29
|
0
|
|
|
|
|
|
push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string); |
|
30
|
0
|
|
|
|
|
|
my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers); |
|
31
|
0
|
0
|
|
|
|
|
if($response->is_success){ |
|
|
0
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
print $response->content(),"\n" if $self->{debug}; |
|
33
|
0
|
|
|
|
|
|
my $json = JSON->new->utf8->decode( $response->content() ); |
|
34
|
0
|
0
|
|
|
|
|
return undef if $json->{retcode} !=0; |
|
35
|
0
|
|
|
|
|
|
my $user_info = $json->{result}; |
|
36
|
0
|
|
|
|
|
|
for my $key (keys %{ $user_info }){ |
|
|
0
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if($key eq 'birthday'){ |
|
|
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$user_info->{$key} = |
|
39
|
0
|
|
|
|
|
|
encode("utf8", join("-",@{ $user_info->{birthday}}{qw(year month day)} ) ); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
elsif($key eq 'stat'){ |
|
42
|
0
|
|
|
|
|
|
$user_info{state} = code2state($user_info->{'stat'}); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
else{ |
|
45
|
0
|
|
|
|
|
|
$user_info->{$key} = encode("utf8",$user_info->{$key}); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
0
|
|
|
|
|
|
delete $user_info->{'stat'}; |
|
49
|
0
|
|
|
|
|
|
return $user_info; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
else{return undef} |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
1; |