| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
3
|
use JSON; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
5
|
|
|
2
|
1
|
|
|
1
|
|
75
|
use Encode; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
454
|
|
|
3
|
|
|
|
|
|
|
sub Webqq::Client::_get_stranger_info { |
|
4
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
5
|
0
|
|
|
|
|
|
my $tuin = shift; |
|
6
|
0
|
0
|
|
|
|
|
return undef if $self->{type} ne 'webqq'; |
|
7
|
0
|
|
|
|
|
|
my $ua = $self->{ua}; |
|
8
|
0
|
|
|
|
|
|
my $cache_data = $self->{cache_for_stranger}->retrieve($tuin); |
|
9
|
0
|
0
|
|
|
|
|
return $cache_data if defined $cache_data; |
|
10
|
0
|
|
|
|
|
|
my $api_url = 'http://s.web2.qq.com/api/get_stranger_info2'; |
|
11
|
0
|
|
|
|
|
|
my @headers = ( |
|
12
|
|
|
|
|
|
|
Referer => 'http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=3', |
|
13
|
|
|
|
|
|
|
'Content-Type'=>'utf-8', |
|
14
|
|
|
|
|
|
|
); |
|
15
|
0
|
|
|
|
|
|
my @query_string = ( |
|
16
|
|
|
|
|
|
|
tuin => $tuin, |
|
17
|
|
|
|
|
|
|
verifysession => undef, |
|
18
|
|
|
|
|
|
|
gid => 0, |
|
19
|
|
|
|
|
|
|
code => undef, |
|
20
|
|
|
|
|
|
|
vfwebqq => $self->{qq_param}{vfwebqq}, |
|
21
|
|
|
|
|
|
|
t => time, |
|
22
|
|
|
|
|
|
|
); |
|
23
|
|
|
|
|
|
|
|
|
24
|
0
|
|
|
|
|
|
my @query_string_pairs; |
|
25
|
0
|
|
|
|
|
|
push @query_string_pairs , shift(@query_string) . "=" . shift(@query_string) while(@query_string); |
|
26
|
0
|
|
|
|
|
|
my $response = $ua->get($api_url.'?'.join("&",@query_string_pairs),@headers); |
|
27
|
|
|
|
|
|
|
|
|
28
|
0
|
0
|
|
|
|
|
if($response->is_success){ |
|
|
0
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
print $response->content(),"\n" if $self->{debug}; |
|
30
|
0
|
|
|
|
|
|
my $json = JSON->new->utf8->decode($response->content()); |
|
31
|
0
|
0
|
|
|
|
|
return undef if $json->{retcode}!=0; |
|
32
|
0
|
|
|
|
|
|
$json->{result}{nick} = encode("utf8",$json->{result}{nick}); |
|
33
|
0
|
|
|
|
|
|
$self->{cache_for_stranger}->store($tuin,$json->{result},300); |
|
34
|
0
|
|
|
|
|
|
return $json->{result}; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
else{return undef} |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
1; |