| 1 | 1 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 0 | ▶ | sub Webqq::Client::_get_group_list_info{ | ||||||||
|
Subroutine
_get_group_list_info: not called CC=5 SCAR=34.0
| |||||||||||
| 3 | 0 | my $self = shift; | |||||||||
| 4 | 0 | my $ua = $self->{ua}; | |||||||||
| 5 | 0 | my $api_url = 'http://s.web2.qq.com/api/get_group_name_list_mask2'; | |||||||||
| 6 | 0 | ▶ | my @headers = $self->{type} eq 'webqq'? (Referer => 'http://s.web2.qq.com/proxy.html?v=20110412001&callback=1&id=3') | ||||||||
|
Branch: 1 branch
| |||||||||||
| 7 | : (Referer => 'http://s.web2.qq.com/proxy.html?v=20130916001&callback=1&id=1') | ||||||||||
| 8 | ; | ||||||||||
| 9 | my %r = ( | ||||||||||
| 10 | hash => hash($self->{qq_param}{ptwebqq},$self->{qq_param}{qq}), | ||||||||||
| 11 | vfwebqq => $self->{qq_param}{vfwebqq}, | ||||||||||
| 12 | 0 | ); | |||||||||
| 13 | |||||||||||
| 14 | 0 | my $post_content = [ | |||||||||
| 15 | r => JSON->new->encode(\%r), | ||||||||||
| 16 | ]; | ||||||||||
| 17 | |||||||||||
| 18 | #if($self->{debug}){ | ||||||||||
| 19 | # require URI; | ||||||||||
| 20 | # my $uri = URI->new('http:'); | ||||||||||
| 21 | # $uri->query_form($post_content); | ||||||||||
| 22 | # print $api_url,"\n"; | ||||||||||
| 23 | # print $uri->query(),"\n"; | ||||||||||
| 24 | #} | ||||||||||
| 25 | |||||||||||
| 26 | 0 | my $response = $ua->post( | |||||||||
| 27 | $api_url, | ||||||||||
| 28 | $post_content, | ||||||||||
| 29 | @headers, | ||||||||||
| 30 | ); | ||||||||||
| 31 | 0 | ▶ | if($response->is_success){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 0 | ▶ | print $response->content(),"\n" if $self->{debug}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | 0 | my $json = JSON->new->utf8->decode( $response->content() ); | |||||||||
| 34 | 0 | ▶ | return undef unless exists $json->{result}{gnamelist}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 0 | return $json->{result}; | |||||||||
| 36 | } | ||||||||||
| 37 | 0 | else{return undef} | |||||||||
| 38 | } | ||||||||||
| 39 | 1 | 1; | |||||||||