精华内容
下载资源
问答
  • qq好友列表获取,利用curl 模拟获取qq好友列表获取接口 代码如下: //模拟浏览器查找好友列表 $url = "http://cgi.find.qq.com/qqfind/buddy/search_v3"; $header = array( 'POST /qqfind/buddy/...

    qq好友列表获取,利用curl 模拟获取qq好友列表获取接口

    代码如下:

    
    
    //模拟浏览器查找好友列表
    
    $url = "http://cgi.find.qq.com/qqfind/buddy/search_v3";
    
    $header = array(
    
    'POST /qqfind/buddy/search_v3 HTTP/1.1
    
    Host: cgi.find.qq.com
    
    Connection: keep-alive
    
    Content-Length: 172
    
    Accept: application/json, text/javascript, */*; q=0.01
    
    Origin: http://find.qq.com
    
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36 LBBROWSER
    
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    
    Referer: http://find.qq.com/index.html?version=2&width=1200&height=610&search_target=0
    
    Accept-Encoding: gzip,deflate,sdch
    
    Accept-Language: zh-CN,zh;q=0.8
    
    Cookie: pvid=6624798504; province=BJ; RK=wgU7Gb0xOU; isVideo_DC=0; ptui_loginuin=1416125030; pt2gguin=o1416125030; uin=o1416125030; skey=@W2LDjGYAD; ptisp=cnc; ptcz=7516da239c7cfa4bae5b6e7c7e5577294ba11ffbd92355b9669fcbbb27d57a93; pgv_info=ssid=s4991867251; pgv_pvid=7864940460; o_cookie=1416125030; uid=27864008; itkn=2346846038'
    
    );
    
    $params = "num=20&page=0&sessionid=0&keyword=&agerg=0&sex=2&firston=1&video=0&country=0&province=0&city=0&district=0&hcountry=0&hprovince=0&hcity=0&hdistrict=0&online=1&ldw=1946652269";
    
    $ch = curl_init($url);
    
    curl_setopt($ch, curlOPT_RETURNTRANSFER,1);
    
    curl_setopt( $ch,CURLOPT_HEADER,$header );
    
    curl_setopt ( $ch, CURLOPT_POST, 1 );
    
    curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params );
    
    //curl_setopt($ch,curlOPT_proxy,$proxy);
    
    //curl_setopt($ch,curlOPT_proxyPORT,$proxyport);
    
    curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
    
    $result = curl_exec($ch);
    
     $tmp = json_decode($result);
    
     print_r($tmp);

    返回结果应该是上面这种的,但现在返回的是  {"retcode":100021}

    参数什么的我是从抓包工具里面取得。先从Cookie里获取skey的值

    然后
      

    var n = 5381;
                    for (int r = 0; r < keystr.Length; ++r)
                        n += (n << 5) + keystr[r];
                    keystr = (n & 2147483647).ToString();
    

    然后post参数中 ldw=keystr 。参考:http://qq.gam7.com/380.html

    
    
    {"retcode":0,"result":{"buddy":{"count":20,"page":1,"info_list":[{"face":0,"distance":0,"nick":"妞妞妞","age":29,"province":"黑龙江","gender":2,"uin":66263364,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=ia7bzXZDfGpZMO3GHWraGZw\u0026s=100\u0026t=1370483885","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"小米","age":29,"province":"黑龙江","gender":2,"uin":961813060,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=2icw0MaBiaW2QKickm9ngeQKg\u0026s=100\u0026t=597","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"开心果","age":70,"province":"黑龙江","gender":2,"uin":1249712708,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=WUaJzNAmH6gEBqcSMZ4GCg\u0026s=40\u0026t=1370934386","stat":1,"country":"中国","city":"大庆"},{"face":0,"distance":0,"nick":"冰雨精灵","age":31,"province":"黑龙江","gender":2,"uin":77929028,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=EYVXOGrTjVMbKTW7o0HGKA\u0026s=100\u0026t=1370497381","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"家的港湾","age":36,"province":"黑龙江","gender":2,"uin":1052777028,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=SgiagziaSuwic99QicdooZicOwA\u0026s=100\u0026t=1377724839","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"淡淡清香","age":0,"province":"","gender":2,"uin":571743044,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=f5oxHZ9RzIPm0d4U938IWQ\u0026s=100\u0026t=1413332362","stat":1,"country":"中国","city":""},{"face":0,"distance":0,"nick":"悟道","age":43,"province":"黑龙江","gender":2,"uin":2568559428,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=QK0BocvvHUDB1BGTmEib5ibA\u0026s=100\u0026t=1409039091","stat":1,"country":"中国","city":"大庆"},{"face":0,"distance":0,"nick":"麦兜悠悠","age":85,"province":"黑龙江","gender":2,"uin":343153476,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=khgaOSKibc6icibKOdrfZRwBQ\u0026s=100\u0026t=750","stat":1,"country":"中国","city":"鹤岗"},{"face":0,"distance":0,"nick":"簡約派 ⊙","age":1,"province":"黑龙江","gender":2,"uin":1035148100,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=SBoouVjP4sXvaIEVxjIJHg\u0026s=100\u0026t=1370366098","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"樱花海棠","age":23,"province":"黑龙江","gender":2,"uin":2446531396,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=fNnK82dQpIZgPZeewVPRzw\u0026s=100\u0026t=1375058729","stat":1,"country":"中国","city":"牡丹江"},{"face":0,"distance":0,"nick":"雨中玫瑰","age":35,"province":"黑龙江","gender":2,"uin":804199492,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=zGqLx05YDMIkrh7VdGQHGw\u0026s=100\u0026t=1387766892","stat":1,"country":"中国","city":"鸡西"},{"face":0,"distance":0,"nick":"乐意~","age":24,"province":"","gender":2,"uin":1425218628,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=B3v6JqDSsK9SHxjriaPribIg\u0026s=100\u0026t=1371342346","stat":1,"country":"中国","city":""},{"face":0,"distance":0,"nick":"仙人掌","age":33,"province":"黑龙江","gender":2,"uin":909974852,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=UcQMFd2DJ4bibIogTHjzibEg\u0026s=100\u0026t=1374091847","stat":1,"country":"中国","city":"双鸭山"},{"face":0,"distance":0,"nick":"锌","age":35,"province":"黑龙江","gender":2,"uin":1586437444,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=kFjbIamXeraYYibqTG0jYZA\u0026s=100\u0026t=1403443786","stat":1,"country":"中国","city":"七台河"},{"face":0,"distance":0,"nick":"红梅","age":45,"province":"黑龙江","gender":2,"uin":1335893316,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=6dMHD598H3G9NJlR3gB0aA\u0026s=100\u0026t=603","stat":1,"country":"中国","city":"黑河"},{"face":0,"distance":0,"nick":"桐","age":11,"province":"黑龙江","gender":2,"uin":2655723076,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=gqd1La99LLtMfXosqAMfoQ\u0026s=100\u0026t=1408448383","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"湘湘","age":21,"province":"黑龙江","gender":2,"uin":44572228,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=7jFaX9VFWDMficGBzicZicRRg\u0026s=100\u0026t=1370403071","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"黄淼","age":29,"province":"黑龙江","gender":2,"uin":215490116,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=ickJMMCXFoLtcurTIq3MW4A\u0026s=100\u0026t=1400130914","stat":1,"country":"中国","city":"佳木斯"},{"face":0,"distance":0,"nick":"宝贝","age":18,"province":"黑龙江","gender":2,"uin":2498829892,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=BjVkrGWVPjS6HtFbEKicoQg\u0026s=100\u0026t=1413082695","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"ever","age":0,"province":"","gender":2,"uin":16392004,"stat":1,"country":"中国","city":""}],"totalnum":6928777,"sessionid":1,"online":1,"endflag":0},"sret":0}}
    

    更多喜欢研究:qq好友列表获取 可加Q群:675172950交流:

    展开全文
  • qq好友列表获取数据并导出 - 用cur类l 模拟QQ好友列表获取 这里我们利用curl类去实现这个功能。 代码如下: //模拟浏览器查找好友列表 $url = "http://cgi.find.qq.com/qqfind/buddy/search_v3"; $...

    qq好友列表获取数据并导出 - 用cur类l 模拟QQ好友列表获取

    这里我们利用curl类去实现这个功能。

    代码如下:

    //模拟浏览器查找好友列表
    $url = "http://cgi.find.qq.com/qqfind/buddy/search_v3";
    $header = array(
    'POST /qqfind/buddy/search_v3 HTTP/1.1
    Host: cgi.find.qq.com
    Connection: keep-alive
    Content-Length: 172
    Accept: application/json, text/javascript, */*; q=0.01
    Origin: http://find.qq.com
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.66 Safari/537.36 LBBROWSER
    Content-Type: application/x-www-form-urlencoded; charset=UTF-8
    Referer: http://find.qq.com/index.html?version=2&width=1200&height=610&search_target=0
    Accept-Encoding: gzip,deflate,sdch
    Accept-Language: zh-CN,zh;q=0.8
    Cookie: pvid=6624798504; province=BJ; RK=wgU7Gb0xOU; isVideo_DC=0; ptui_loginuin=1416125030; pt2gguin=o1416125030; uin=o1416125030; skey=@W2LDjGYAD; ptisp=cnc; ptcz=7516da239c7cfa4bae5b6e7c7e5577294ba11ffbd92355b9669fcbbb27d57a93; pgv_info=ssid=s4991867251; pgv_pvid=7864940460; o_cookie=1416125030; uid=27864008; itkn=2346846038'
    );
    $params = "num=20&page=0&sessionid=0&keyword=&agerg=0&sex=2&firston=1&video=0&country=0&province=0&city=0&district=0&hcountry=0&hprovince=0&hcity=0&hdistrict=0&online=1&ldw=1946652269";
    $ch = curl_init($url);
    curl_setopt($ch, curlOPT_RETURNTRANSFER,1);
    curl_setopt( $ch,CURLOPT_HEADER,$header );
    curl_setopt ( $ch, CURLOPT_POST, 1 );
    curl_setopt ( $ch, CURLOPT_POSTFIELDS, $params );
    //curl_setopt($ch,curlOPT_proxy,$proxy);
    //curl_setopt($ch,curlOPT_proxyPORT,$proxyport);
    curl_setopt ($ch, CURLOPT_TIMEOUT, 120);
    $result = curl_exec($ch);
     $tmp = json_decode($result);
     print_r($tmp);

    返回:

    {"retcode":0,"result":{"buddy":{"count":20,"page":1,"info_list":[{"face":0,"distance":0,"nick":"妞妞妞","age":29,"province":"黑龙江","gender":2,"uin":66263364,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=ia7bzXZDfGpZMO3GHWraGZw\u0026s=100\u0026t=1370483885","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"小米","age":29,"province":"黑龙江","gender":2,"uin":961813060,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=2icw0MaBiaW2QKickm9ngeQKg\u0026s=100\u0026t=597","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"开心果","age":70,"province":"黑龙江","gender":2,"uin":1249712708,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=WUaJzNAmH6gEBqcSMZ4GCg\u0026s=40\u0026t=1370934386","stat":1,"country":"中国","city":"大庆"},{"face":0,"distance":0,"nick":"冰雨精灵","age":31,"province":"黑龙江","gender":2,"uin":77929028,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=EYVXOGrTjVMbKTW7o0HGKA\u0026s=100\u0026t=1370497381","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"家的港湾","age":36,"province":"黑龙江","gender":2,"uin":1052777028,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=SgiagziaSuwic99QicdooZicOwA\u0026s=100\u0026t=1377724839","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"淡淡清香","age":0,"province":"","gender":2,"uin":571743044,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=f5oxHZ9RzIPm0d4U938IWQ\u0026s=100\u0026t=1413332362","stat":1,"country":"中国","city":""},{"face":0,"distance":0,"nick":"悟道","age":43,"province":"黑龙江","gender":2,"uin":2568559428,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=QK0BocvvHUDB1BGTmEib5ibA\u0026s=100\u0026t=1409039091","stat":1,"country":"中国","city":"大庆"},{"face":0,"distance":0,"nick":"麦兜悠悠","age":85,"province":"黑龙江","gender":2,"uin":343153476,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=khgaOSKibc6icibKOdrfZRwBQ\u0026s=100\u0026t=750","stat":1,"country":"中国","city":"鹤岗"},{"face":0,"distance":0,"nick":"簡約派 ⊙","age":1,"province":"黑龙江","gender":2,"uin":1035148100,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=SBoouVjP4sXvaIEVxjIJHg\u0026s=100\u0026t=1370366098","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"樱花海棠","age":23,"province":"黑龙江","gender":2,"uin":2446531396,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=fNnK82dQpIZgPZeewVPRzw\u0026s=100\u0026t=1375058729","stat":1,"country":"中国","city":"牡丹江"},{"face":0,"distance":0,"nick":"雨中玫瑰","age":35,"province":"黑龙江","gender":2,"uin":804199492,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=zGqLx05YDMIkrh7VdGQHGw\u0026s=100\u0026t=1387766892","stat":1,"country":"中国","city":"鸡西"},{"face":0,"distance":0,"nick":"乐意~","age":24,"province":"","gender":2,"uin":1425218628,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=B3v6JqDSsK9SHxjriaPribIg\u0026s=100\u0026t=1371342346","stat":1,"country":"中国","city":""},{"face":0,"distance":0,"nick":"仙人掌","age":33,"province":"黑龙江","gender":2,"uin":909974852,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=UcQMFd2DJ4bibIogTHjzibEg\u0026s=100\u0026t=1374091847","stat":1,"country":"中国","city":"双鸭山"},{"face":0,"distance":0,"nick":"锌","age":35,"province":"黑龙江","gender":2,"uin":1586437444,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=kFjbIamXeraYYibqTG0jYZA\u0026s=100\u0026t=1403443786","stat":1,"country":"中国","city":"七台河"},{"face":0,"distance":0,"nick":"红梅","age":45,"province":"黑龙江","gender":2,"uin":1335893316,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=6dMHD598H3G9NJlR3gB0aA\u0026s=100\u0026t=603","stat":1,"country":"中国","city":"黑河"},{"face":0,"distance":0,"nick":"桐","age":11,"province":"黑龙江","gender":2,"uin":2655723076,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=gqd1La99LLtMfXosqAMfoQ\u0026s=100\u0026t=1408448383","stat":1,"country":"中国","city":"齐齐哈尔"},{"face":0,"distance":0,"nick":"湘湘","age":21,"province":"黑龙江","gender":2,"uin":44572228,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=7jFaX9VFWDMficGBzicZicRRg\u0026s=100\u0026t=1370403071","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"黄淼","age":29,"province":"黑龙江","gender":2,"uin":215490116,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=ickJMMCXFoLtcurTIq3MW4A\u0026s=100\u0026t=1400130914","stat":1,"country":"中国","city":"佳木斯"},{"face":0,"distance":0,"nick":"宝贝","age":18,"province":"黑龙江","gender":2,"uin":2498829892,"url":"http://q1.qlogo.cn/g?b=qq\u0026k=BjVkrGWVPjS6HtFbEKicoQg\u0026s=100\u0026t=1413082695","stat":1,"country":"中国","city":"哈尔滨"},{"face":0,"distance":0,"nick":"ever","age":0,"province":"","gender":2,"uin":16392004,"stat":1,"country":"中国","city":""}],"totalnum":6928777,"sessionid":1,"online":1,"endflag":0},"sret":0}}
    

    回结果应该是上面这种的,但现在返回的是  {"retcode":100021}

    参数什么的我是从抓包工具里面取得。

    先从Cookie里获取skey的值

    然后post参数中 ldw=keystr 

      var n = 5381;
                    for (int r = 0; r < keystr.Length; ++r)
                        n += (n << 5) + keystr[r];
                    keystr = (n & 2147483647).ToString();
    


    可以参考:qq好友列表获取软件

    展开全文
  • qq好友列表获取导出备份code实例。
  • qq好友列表获取之动态爬虫清洗爬取qq好友列表数据 - 获取qq好友ip、群、群成员列表。我们的好友列表要从 qzone 获取,现在打开 qzone 的链接https://h5.qzone.qq.com/mqzone/index并且登陆。 具体步骤: 1、分析...

    qq好友列表获取之动态爬虫清洗爬取qq好友列表数据 - 获取qq好友ip、群、群成员列表。我们的好友列表要从 qzone 获取,现在打开 qzone 的链接 https://h5.qzone.qq.com/mqzone/index 并且登陆。

    具体步骤:

    1、分析qzone请求
    2、分析参数来源
    3、仿照数据请求

    上次写的一个qzone登陆写的不详细这次决定写一个详细分析qzone js 获取好友列表

    分析qzone请求

    我们的好友列表要从 qzone 获取,现在打开 qzone 的链接 https://h5.qzone.qq.com/mqzone/index 并且登陆。

    你可能会说你在逗我,这特么哪里来的qq好友列表
    别急,好友列表肯定是有的不然你发表说说怎么@你的好友呢

    说到@好友都明白了吧,我们的好友列表接口就从这里开始拦截接口请求。
    先把打开我们发说说的那个框框,再把浏览器开启调试模式,清空网络请求拦截列表

    qq好友列表获取
    qq好友列表获取

    现在你应该在发说说的那个界面,点一下说说框下面的 @符号

    qq好友列表获取
    qq好友列表获取

    盯住网络请求那一块,找一下那个像是获取好友列表的,发现一共就6个请求,我一眼就看到了mfriend_list 接口意思很直白啊

    qq好友列表获取
    qq好友列表获取

    qq好友列表已经找到,接下来就是分析参数了,这个过程很痛苦

     

    分析参数来源

    首先点我刚刚说到的那一条请求记录 就是这样子的 我对自己的qq号打了码毕竟这个东西获取到可以直接用cookie登陆的

    qq好友列表获取
    qq好友列表获取

     

    这里可能有人会说,为什么不直接点击拦截列表上面有个可以定位js发出请求的位置,这样找分析请求参数不是更简单吗
    这边呢我只能说我之前也找过,但是找不到获取同行qq好友的软件,因为点击过去找到的是封装类的位置。

    这边参数呢不多 六个 需要分析的就两个
    qzonetoken c2176b5d6f0deff03d0dd0f59f26e51c2b408aa83419d416c737cc1b21d1e913c861ca780ad34ff4293ca5640b69
    g_tk:1760587213
    res_uin:***
    res_type:normal
    format:json
    timestamp 时间戳

    我们现在看一下这个 qzonetoken 使用全局搜索找一下看是不是写在静态页面中的

    qq好友列表获取
    qq好友列表获取

    继续搜索 window.shine0callback

    发现都是一个结果。。。。 后面我试着搜索一下html 里面 发现竟然真的有
    qq好友列表获取

    发现都是一个结果。。。。 后面我试着搜索一下html 里面 发现竟然真的有

    qq好友列表获取
    qq好友列表获取

    window.shine0callback = 自执行函数
    所以呢 qzonetoken 参数直接用 window.shine0callback 就好了

    继续全局搜索 g_tk

    qq好友列表获取

    这边呢有三个方法获取token
    1、userHelper.getPskeyToken()
    2、userHelper.getToken()
    3、user.getToken()

    我们先在控制台执行一下这些方法

    qq好友列表获取
    qq好友列表获取

    发现 user 能执行也和请求的参数对上了,不过我还是想找一下 userHelper 这个东西

    先把ajax.js 这个类给弄到本地来 搜索 userHelper

    qq好友列表获取
    qq好友列表获取

    既然写在里面的那copy到控制台就可以执行了。这个不同微信好友列表获取的方式。
    开始我把 userHelper copy进去发现少了一个getCookie,再把getCookie 也复制到控制台就好了

    qq好友列表获取

    这样子执行就能获取到 token 了

    res_uin qq号码,我在搜索静态html的时候无意间发现了可以从 FrontPage 对象中获取,当然也可以从 user 对象中获取
    res_type 固定normal
    format 固定json
    timestamp 时间戳拿一下系统时间戳就好。

    现在参数都分析完毕,qzone 的接口分析还是蛮简单的,不像某宝网站的程序

    仿照数据请求

    找到 paresHtml 函数 在这里先切换到默认窗口

    def paresHtml(self):
        self.driver.switch_to.default_content()

    获取 qzonetoken 这边直接执行window.shine0callback 就能获取

    qzonetoken = self.driver.execute_script('return window.shine0callback')

    获取 g_tk 上面说到user里面可以直接获取,那我们就偷个懒使用 user.getToken()

    g_tk = self.driver.execute_script('return user.getToken()')

    获取 res_uin 直接从user 里面 getUin()

    res_uin = self.driver.execute_script('return user.getUin()')

    获取时间戳 由于python 中的time.time()是秒,需要乘个1000

    import time
    timestamp = time.time() * 1000

    拼接url

    list = 'https://mobile.qzone.qq.com/friend/mfriend_list?' \
                   'qzonetoken=%s&g_tk=%s&res_uin=%s&res_type=normal&format=json&timestamp=%d' % ( qzonetoken, g_tk, res_uin, timestamp)

    本身我想偷懒的直接用 self.driver.get() 直接执行的 后来想想还是算了,没有一点技术含量的东西怎么好意思写呢
    最后决定使用js中的XMLHttpRequest 来模仿请求

     

      self.driver.execute_script('window.xhr = new XMLHttpRequest;')
        self.driver.execute_script('window.xhr.withCredentials=true;')
        self.driver.execute_script(
            'window.xhr.open(\'GET\',\'%s\',false)' % list)
        self.driver.execute_script('window.xhr.onload = function (e){window.xhrsuccess = window.xhr.responseText}')
        self.driver.execute_script('window.xhr.send()')
        print(self.driver.execute_script('return window.xhrsuccess'))

    请求完成后的结果是这个样子的

    qq好友列表
    qq好友列表

    下面是请求返回的结果

    {
        "code":0,
        "subcode":0,
        "message":"",
        "default":0,
        "data":{
            "gpnames":[//分组列表
                {
                    "gpid":0,//分组id
                    "gpname":"agp"//分组名称
                }
            ],
            "list":[//好友列表
                {
                  "groupid":0,//分组id
                  "isvip":1,//是否是vip 1 是 vip
                  "nick":"消费主张", //昵称
                  "remark":"消费主张",//备注
                  "searchField":"12315 消费主张 消费主张 xiaofeizhuzhang xfzz xiaofeizhuzhang xfzz",//关键字
                  "uin":12315,//qq号码
                  "viplevel":1 //qq等级
                }
            ],
            "mayknow":{
                 "allnum":0,
                  "list":null,
                  "page":1
            },
            "speciallist":null
         }
    }

    最后发一下模仿请求的源码 结合我上一篇文章的源码可以直接执行出结果,也可以获取qq好友ip

    import time
    
    def paresHtml(self):
        # 切换到默认窗口
        self.driver.switch_to.default_content()
        # 请求状态
        shine0callback = self.driver.execute_script('return window.shine0callback')
        # 一定要暂停一下不然 执行user的时候拿不到,因为懒加载
        time.sleep(1)
    
        g_tk = self.driver.execute_script('return window.user.getToken()')
        uin = self.driver.execute_script('return window.user.getUin()')
        timestamp = time.time() * 1000
    
        list = 'https://mobile.qzone.qq.com/friend/mfriend_list?' \
                'qzonetoken=%s&g_tk=%s&res_uin=%s&res_type=normal&format=json&timestamp=%d' % (
                    shine0callback, g_tk, uin, timestamp)
    
        # self.load_cookies()
        # self.driver.get(list)
    
        self.driver.execute_script('window.xhr = new XMLHttpRequest;')
    
        self.driver.execute_script(
                'window.xhr.open(\'GET\',\'%s\',false)' % list)
        self.driver.execute_script('window.xhr.onload = function (e){window.xhrsuccess = window.xhr.responseText}')
        self.driver.execute_script('window.xhr.send()')
        print(self.driver.execute_script('return window.xhrsuccess'))

    总结:

    1、qzone 里面的接口参数都差不多,总归来讲都能搜索出来
    2、qzone 压缩了js提高了分析的难度
    3、好友列表模拟请求时记得把cookie带过去否则t不认
    4、有时候登陆会登不上,拿到的好友列表数据是请先登录,删掉cookie重试即便就好

     

    更多:qq好友列表获取

    展开全文
  • 当开放API成为历史潮流不可...抓包发现:webQQ每次成功登陆后,接下来一般会去实现"QQ好友列表获取"和"QQ群成员列表获取"。而断线重连的时候,通常不需要。你每次登录webQQ,腾讯服务器便会自动分配给你和你的QQ好...

    当开放API成为历史潮流不可阻挡之时,腾讯亦只能与时俱进,但腾讯为了保持江湖的垄断地位,不会随意公开像QQ号这样的客户资源,于是乎,你能通过webQQ查询到的,也只能是用户或群的昵称,绝非QQ号码或群号。


    抓包发现:webQQ每次成功登陆后,接下来一般会去实现"QQ好友列表获取"和"QQ群成员列表获取"。而断线重连的时候,通常不需要。你每次登录webQQ,腾讯服务器便会自动分配给你和你的QQ好友一个临时的uin;分配给群的,便是gid和gcode。
    所谓“好友列表”便是好友的uin和昵称对应起来的信息列表。而所谓的“群列表”,则是临时的群名称和群gid、群gcode的对应列表。


    1.获取QQ好友信息表:

     

    POSThttp://s.web2.qq.com/api/get_user_friends2HTTP/1.1
    Referer:http://s.web2.qq.com/proxy.html
    POST数据:一个json数据结构:
    r={"h":"hello","vfwebqq":"【vfwebqq】"}
    如果成功,会返回一个json数据结构:
    {"retcode":0,"result":{"friends":[{"flag":0,"uin":3112962973,"categories":0}],"marknames":[],"categories":[{"index":1,"sort":1,"name":"朋友"},{"index":2,"sort":2,"name":"家人"},{"index":3,"sort":3,"name":"同学"}],"vipinfo":[{"vip_level":0,"u":3112962973,"is_vip":0}],"info":[{"face":0,"flag":524288,"nick":"Spark.Ho","uin":3112962973}]}}
    我们把返回的数据,存放在一个指定的txt文件中,供其后操作的调用。
    C++ (with libcurl)源程序
    string WebQQ_buddy()
    {
     // 提取QQ登录信息:
     char buf[1024];
     string vfwebqq;
     size_t found,found2;
     ifstream QQLoginfile("D:\\SparkHo\\QQLogin.txt"); 
     if(!QQLoginfile)
     {
      QQLoginfile.close();
      vfwebqq = "";
     }
     else
     {
      QQLoginfile.getline(buf,1024);
      string QQLogin = (string) buf;
      QQLoginfile.close();
      found  = QQLogin.find("vfwebqq");
      found2 = QQLogin.find(";",found+8,1);
      vfwebqq = QQLogin.substr(found+8,found2-found-8);
     }
     // 初始化libcurl
     CURLcode return_code;
     return_code = curl_global_init(CURL_GLOBAL_WIN32);
     if (CURLE_OK != return_code) return NULL;
     // 获取easy handle
     CURL *easy_handle = curl_easy_init();
     if (NULL == easy_handle)
     {  
      curl_global_cleanup();
      return “”;
     }
     string buffer;
     string post_url = "http://s.web2.qq.com/api/get_user_friends2";
     string referer_url = "http://s.web2.qq.com/proxy.html";
     string base = "{\"h\":\"hello\",\"vfwebqq\":\""+vfwebqq+"\"}";
     string urlencode = curl_easy_escape(easy_handle,base.c_str(),0);
     string fields = "r=" + urlencode;
      // 设置easy handle属性
     curl_easy_setopt(easy_handle, CURLOPT_URL, post_url.c_str());
     curl_easy_setopt(easy_handle, CURLOPT_REFERER, referer_url.c_str());
     curl_easy_setopt(easy_handle, CURLOPT_POST, 1);
     curl_easy_setopt(easy_handle, CURLOPT_POSTFIELDS, fields.c_str());
     curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, writer);
     curl_easy_setopt(easy_handle, CURLOPT_WRITEDATA, &buffer);
     //提交第一步保存的cookie 
        curl_easy_setopt(easy_handle, CURLOPT_COOKIEFILE,"D:\\SparkHo\\cookie_login.txt");
     // 执行数据请求
     curl_easy_perform(easy_handle); 
     // 释放资源
     curl_easy_cleanup(easy_handle);
     curl_global_cleanup();
     // 更新QQ好友列表信息:
     fstream QQBuddywrite("D:\\SparkHo\\QQBuddy.txt",ios::out|ios::trunc);
     QQBuddywrite<<buffer.c_str();
     QQBuddywrite.close();
    
     return buffer;
    }

     

    2.获取群信息表:

     

    POSThttp://s.web2.qq.com/api/get_group_name_list_mask2HTTP/1.1
    Referer:http://s.web2.qq.com/proxy.html
    POST数据:一个json数据结构:
    r={"vfwebqq":"【vfwebqq】"}
    如果成功,会返回一个json数据结构:
    {"retcode":0,"result":{"gmasklist":[],"gnamelist":[{"flag":17825793,"name":"Spark.Ho操盘","gid":2444491359,"code":2485575464}],"gmarklist":[]}}
    我们把返回的数据,存放在一个指定的txt文件中,供其后操作的调用。
    C++ (with libcurl)源程序
    string WebQQ_group()
    {
     // 提取QQ登录信息:
     char buf[1024];
     string vfwebqq;
     size_t found,found2;
     ifstream QQLoginfile("D:\\SparkHo\\QQLogin.txt"); 
     if(!QQLoginfile)
     {
      QQLoginfile.close();
      vfwebqq = "";
     }
     else
     {
      QQLoginfile.getline(buf,1024);
      string QQLogin = (string) buf;
      QQLoginfile.close();
      found  = QQLogin.find("vfwebqq");
      found2 = QQLogin.find(";",found+8,1);
      vfwebqq = QQLogin.substr(found+8,found2-found-8);
     }
     // 初始化libcurl
     CURLcode return_code;
     return_code = curl_global_init(CURL_GLOBAL_WIN32);
     if (CURLE_OK != return_code) return NULL;
     // 获取easy handle
     CURL *easy_handle = curl_easy_init();
     if (NULL == easy_handle)
     {  
      curl_global_cleanup();
      return “”;
     }
     string buffer;
     string post_url = "http://s.web2.qq.com/api/get_group_name_list_mask2";
     string referer_url = "http://s.web2.qq.com/proxy.html";
     string base = "{\"vfwebqq\":\""+vfwebqq+"\"}";
     string urlencode = curl_easy_escape(easy_handle,base.c_str(),0);
     string fields = "r=" + urlencode;
     // 设置easy handle属性
     curl_easy_setopt(easy_handle, CURLOPT_URL, post_url.c_str());
     curl_easy_setopt(easy_handle, CURLOPT_REFERER, referer_url.c_str());
     curl_easy_setopt(easy_handle, CURLOPT_POST, 1);
     curl_easy_setopt(easy_handle, CURLOPT_POSTFIELDS, fields.c_str());
     curl_easy_setopt(easy_handle, CURLOPT_WRITEFUNCTION, writer);
     curl_easy_setopt(easy_handle, CURLOPT_WRITEDATA, &buffer);
     //提交第一步保存的cookie 
        curl_easy_setopt(easy_handle, CURLOPT_COOKIEFILE,"D:\\SparkHo\\cookie_login.txt");
     // 执行数据请求
     curl_easy_perform(easy_handle); 
     // 释放资源
     curl_easy_cleanup(easy_handle);
     curl_global_cleanup();
     // 更新QQ群列表信息:
     fstream QQGroupwrite("D:\\SparkHo\\QQGroup.txt",ios::out|ios::trunc);
     QQGroupwrite<<buffer.c_str();
     QQGroupwrite.close();
         
     return buffer;
    }

    3.获取群成员信息表:

     

    GET http://s.web2.qq.com/api/get_group_info_ext2?gcode=【gcode】&vfwebqq=【vfwebqq】 HTTP/1.1
    Referer:http://s.web2.qq.com/proxy.html
    POST数据:一个json数据结构:
    r={"vfwebqq":"【vfwebqq】"}
    如果成功,会返回一个json数据结构:
    {"retcode":0,"result":{"stats":[{"client_type":1,"uin":1664604219,"stat":30},。。。,{"client_type":41,"uin":2393982134,"stat":10}],
    "minfo":[{"nick":"David","province":"","gender":"male","uin":2010255454,"country":"","city":""}, 。。。,{"nick":"﹏落败的唯美丶","province":"山东","gender":"female","uin":3386757496,"country":"中国","city":"青岛"}],
    "ginfo":{"face":0,"memo":"飞狐下载\nhttp://dl.dbank.com/c0pmgrt8wa\n\r\n通达信":"顺势而为","code":2485575464,"createtime":1260641721,"flag":17825793,"level":0,"name":"Spark.Ho操盘","gid":2444491359,"owner":3112962973,
    "members":[{"muin":2010255454,"mflag":132},,,,,{"muin":3386757496,"mflag":0}],"option":2},
    "cards":[{"muin":3112962973,"card":"Spark.Ho"},。。。,{"muin":2393982134,"card":"SP预警"}],
    "vipinfo":[{"vip_level":0,"u":4157281859,"is_vip":0},。。。,{"vip_level":0,"u":3489781961,"is_vip":0}]}}

    目前写了完整的软件。

    有想了解可加QQ好友列表获取   QQ群:675172950

    展开全文
  • QQ好友列表获取类:爬虫爬取QQ号,这个个爬虫是拿来练手的,可以爬取网络中的QQ号,然后存储到本地 import urllib.request import ssl import re import os from collections import deque #导入队列库 def ...
  • 在使用web qq的接口进行qq好友列表获取的时候,需要post一个参数:hash 在对其js文件进行分析之后,发现计算hash的函数位于: http://0.web.qstatic.com/webqqpic/pubapps/0/50/eqq.all.js 这个文件中: P = ...
  • qq好友列表获取导出,利用QQ协议实现qq好友数据备份,包含:qq好友、QQ分组、QQ群、qq群成员。 我们是在浏览器中的操作,接下来看看数据到底怎么获取的,我们通过Fiddler的查找功能,就可以查找到web请求和内容信息,...
  • 获取qq好友列表

    热门讨论 2013-06-04 12:38:57
    这是2012写的一份代码了,为获取qq好友代码 仅供技术交流,代码也没怎么整理,不过经过测试能够获取登录qq的所有好友。
  • C# QQ好友获取案例 可以获取本地qq的好友列表和信息 和webqq聊天
  • 获取本机QQ好友列表

    2021-05-01 12:49:08
    获取本机QQ好友功能,如多个QQ同时在线,可选择,并显示好友列表,右键实现基本功能菜单功能:1、运行后,如识别到多个QQ在本机登陆,可进行选择2、选择想要获取的QQ后,即可显示QQ列表,并显示好友(左侧还会有个...
  • 特别是针对手机端QQ好友列表获取。下面小编在开发手机qq好友列表获取软件的一些记录。 简单的原理: 第一步 先申请openapi  第二步 把一键登录模块集成到自己站上 第三步 模拟提交 登录到自己的站 会获得一段...
  • 获取QQ好友列表和群列表,别的地方下载来的,用VS2010打开项目 直接可以用
  • 解析获取QQ好友列表

    2012-05-19 19:00:52
    解析获取QQ好友列表,经过一周多的研究,终于用笨办法实现了,不用一个一个去粘了.
  • 在使用web qq的接口进行QQ好友列表获取的时候,需要post一个参数:hash 在对其js文件进行分析之后,发现计算hash的函数位于: http://0.web.qstatic.com/webqqpic/pubapps/0/50/eqq.all.js 这个文件中: P = ...
  • VB获取QQ好友列表

    2013-07-04 19:55:11
    通过协议来获取QQ好友,并且登录QQ空间,虽然只是初步,但可以自己改造成个性的程序
  • 使用Python模拟登录QQ邮箱获取QQ好友列表 最近因开发项目的需要有一个需求就是很多SNS网站都有的通过 Email地址 导入好友列表不过这次要导入的不是Email 列表而是QQ的好友列表 实现方式 通过google一搜实现的方式...
  • 获取QQ好友列表

    千次阅读 2015-12-29 11:57:24
    地址:http://s.web2.qq.com/api/get_user_friends2提交方式:PostPOST参数:r={"h":"hello","vfwebqq":"d820f5515bb0a6c64de6a885217adff3b5e70806304e5b18594ac
  • QQ好友状态获取用于查看你QQ好友中谁把你拉入陌生人。你QQ列表中有的人对方没有你会显单向好友,双方QQ好友列表中都存在 会显示双向好友,如果显示无法验证则需要您邀请对方 开通
  • 获取所有QQ好友列表以及好友信息

    万次阅读 热门讨论 2018-06-25 15:22:33
    记得将访问空间权限改为QQ好友 接口地址: https://h5.qzone.qq.com/proxy/domain/base.qzone.qq.com/cgi-bin/right/get_entryuinlist.cgi?uin=741047261&amp;amp;fupdate=1&amp;amp;action=1&...
  • QQ获取好友列表接口 -

    千次阅读 2019-03-07 11:46:18
    先思考,如果我要挖掘一个qq获取好友列表的接口,那么必须找到一个网页在哪里会调用读取用户的好友列表。 然后这里要你从好友列表里面选择,那么这里肯定会出现一个ajax异步读取,这个jajx请求的响应也许就是你的...
  • 获取QQ好友列表接口分析

    千次阅读 2018-12-13 13:01:07
    获取QQ好友列表接口分析地址:http://s.web2.qq.com/api/get_user_friends2 提交方式:Post POST参数: r={"h":"hello","vfwebqq":"d820f5515bb0a6c64de6a885217adff3b5e...
  • C#QQ登录,获取好友列表群列表,QQ消息群发源码【附完整源码】
  • 获取QQ好友列表,采用delphi编写。
  • js解密之QQ的bkn值,获取QQ群成员信息,获取QQ好友列表信息 Lan 2020-05-31 12:13 126 人阅读 0 条评论 QQ群网站:...
  • 完整源码下载 ...如果对你有用,请给个Star,你的支持,是我最大的动力 ...获取QQ好友列表 接口地址: https://h5.qzone.qq.com/proxy/domain/base.qzone.qq.com/cgi-bin/right/get_entryuinlist.c...

空空如也

空空如也

1 2 3 4 5 ... 16
收藏数 313
精华内容 125
关键字:

qq好友列表获取