Пример #1
0
    def qzone_friendship(self, number):
        # 获取成为好友的天数,以及与这个好友共同的好友个数和群聊个数
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qzone_qq_com['p_skey'])

        # 获取参数qzonetoken
        urllib3.disable_warnings()
        target_url = 'https://user.qzone.qq.com/' + self.qq_number
        html = get_html(target_url, self.cookies_merge_dict_in_qzone_qq_com)
        qzonetoken = re.findall(r'{ try{return "(.+?)";', html.text)
        qzonetoken = qzonetoken[0]

        # 获取我在意谁数据
        target_url = 'https://user.qzone.qq.com/proxy/domain/r.qzone.qq.com/cgi-bin/friendship/cgi_friendship?activeuin=' + self.qq_number + '&passiveuin=' + str(
            number) + '&situation=1&isCalendar=1&g_tk=' + str(
                bkn) + '&qzonetoken=' + str(qzonetoken) + '&g_tk=' + str(bkn)
        urllib3.disable_warnings()
        html = get_html(target_url, self.cookies_merge_dict_in_qzone_qq_com)

        # 处理返回数据
        result_data = (html.text).replace('_Callback(', '')
        result_data = result_data[:len(result_data) - 2]
        # 将返回数据转化为python对象
        result_data = loads(result_data)

        print(result_data)
Пример #2
0
    def get_quit_of_group(self):
        # 获取最近30天内退出的群
        # 需要提交的数据
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qun_qq_com['skey'])
        submit_data = {'bkn': str(bkn)}

        # 设置请求头,模拟人工
        header = {
            'Accept': 'application/json, text/javascript, */*; q=0.01',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
            'Content-Type': 'text/plain',
            'origin': 'https://huifu.qq.com',
            'referer': 'https://huifu.qq.com/recovery/index.html?frag=0'
        }

        # 屏蔽https证书警告
        urllib3.disable_warnings()
        # 网页访问,post方式
        html = post('https://huifu.qq.com/cgi-bin/gr_grouplist',
                    data=submit_data,
                    cookies=self.cookies_merge_dict_in_qun_qq_com,
                    headers=header,
                    verify=False)

        # 将返回数据解析为python对象
        result = loads(html.text)

        return result
Пример #3
0
    def i_care_about_who(self):
        # qq空间亲密度 我在意谁

        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qzone_qq_com['p_skey'])

        # # 获取参数qzonetoken
        # urllib3.disable_warnings()
        # target_url = 'https://user.qzone.qq.com/' + self.qq_number
        # html = get_html(target_url, self.cookies_merge_dict_in_qzone_qq_com)
        # qzonetoken = re.findall(r'{ try{return "(.+?)";', html.text)
        # qzonetoken = qzonetoken[0]

        # 获取我在意谁数据
        #target_url = 'https://rc.qzone.qq.com/proxy/domain/r.qzone.qq.com/cgi-bin/tfriend/friend_ship_manager.cgi?uin=' + self.qq_number + '&do=1&rd=0.9680629025032721&fupdate=1&clean=1&g_tk=' + str(bkn) + '&qzonetoken=' + str(qzonetoken) + '&g_tk=' + str(bkn)
        target_url = 'https://user.qzone.qq.com/proxy/domain/r.qzone.qq.com/cgi-bin/tfriend/friend_ship_manager.cgi?uin={}&do=1&rd=0.6629930546880991&fupdate=1&clean=1&g_tk={}&g_tk={}'.format(
            self.qq_number, bkn, bkn)
        urllib3.disable_warnings()
        html = get_html(target_url, self.cookies_merge_dict_in_qzone_qq_com)

        # 处理返回数据
        result_data = (html.text).replace('_Callback(', '')
        result_data = result_data[:len(result_data) - 2]
        # 将返回数据转化为python对象
        result_data = loads(result_data)
        result_data = result_data['data']['items_list']

        return result_data
Пример #4
0
    def get_members_in_group(self, group_number):

        # 获取某个群的群成员
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qun_qq_com['skey'])
        url = 'http://qinfo.clt.qq.com/cgi-bin/qun_info/get_members_info_v1?friends=1&name=1&gc=' + str(
            group_number) + '&bkn=' + str(bkn) + '&src=qinfo_v3'
        html = get_html(url, self.cookies_merge_dict_in_qun_qq_com)
        group_member = loads(html.text)
        return group_member
Пример #5
0
    def get_group(self):

        # 获取所有群基本信息
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qun_qq_com['skey'])
        submit_data = {'bkn': bkn}
        html = post_html('https://qun.qq.com/cgi-bin/qun_mgr/get_group_list',
                         self.cookies_merge_dict_in_qun_qq_com, submit_data)
        group_info = loads(html.text)
        return group_info['join']
Пример #6
0
    def get_info_in_qq_friend(self, qq_number):

        # 获取某个qq好友的详细信息

        # 需要提交的数据
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qun_qq_com['skey'])
        submit_data = {
            'keyword': str(qq_number),
            'ldw': str(bkn),
            'num': '20',
            'page': '0',
            'sessionid': '0',
            'agerg': '0',
            'sex': '0',
            'firston': '0',
            'video': '0',
            'country': '1',
            'province': '65535',
            'city': '0',
            'district': '0',
            'hcountry': '1',
            'hprovince': '0',
            'hcity': '0',
            'hdistrict': '0',
            'online': '0'
        }

        # 需要提交的cookies
        # cookies = {'uin':self.cookies_merge_dict_in_qun_qq_com['uin'], 'skey':self.cookies_merge_dict_in_qun_qq_com['skey'], 'ptisp':self.cookies_merge_dict_in_qun_qq_com['ptisp'], 'RK':self.cookies_merge_dict_in_qun_qq_com['RK'], 'ptcz':self.cookies_merge_dict_in_qun_qq_com['ptcz']}

        # 设置请求头,模拟人工
        header = {
            'Accept': 'application/json, text/javascript, */*; q=0.01',
            'Origin': 'http://find.qq.com',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
            'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
            'Referer': 'http://find.qq.com/',
        }

        # 屏蔽https证书警告
        urllib3.disable_warnings()
        # 网页访问,post方式
        html = post('http://cgi.find.qq.com/qqfind/buddy/search_v3',
                    data=submit_data,
                    cookies=self.cookies_merge_dict_in_qun_qq_com,
                    headers=header,
                    verify=False)

        # 将好友信息解析为python对象
        friend_info = loads(html.text)
        # print(friend_info)
        return friend_info['result']['buddy']['info_list'][0]
Пример #7
0
    def get_all_friends_in_qq(self):

        # 获取所有qq好友基本信息
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qun_qq_com['skey'])
        submit_data = {'bkn': bkn}
        html = post_html('https://qun.qq.com/cgi-bin/qun_mgr/get_friend_list',
                         self.cookies_merge_dict_in_qun_qq_com, submit_data)
        friend_info = loads(html.text)
        # print(friend_info)
        return friend_info['result']
Пример #8
0
    def get_delete_friend_in_360day(self):

        # 获取最近一年删除的好友名单
        # 需要提交的数据
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qun_qq_com['skey'])
        qq_number = str(self.qq_number)
        skey = str(self.cookies_merge_dict_in_qun_qq_com['skey'])
        url = 'https://proxy.vip.qq.com/cgi-bin/srfentry.fcgi?bkn=' + str(
            bkn
        ) + '&ts=&g_tk=' + str(
            bkn
        ) + '&data={"11053":{"iAppId":1,"iKeyType":1,"sClientIp":"","sSessionKey":"' + skey + '","sUin":"' + qq_number + '"}}'

        # 设置请求头,模拟人工
        header = {
            'Accept': 'application/json, text/javascript, */*; q=0.01',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
            'Accept-Encoding': 'gzip, deflate',
            'Referer': 'https://huifu.qq.com/recovery/index.html?frag=1',
            'Origin': 'https://huifu.qq.com',
            'Connection': 'close'
        }

        # 屏蔽https证书警告
        urllib3.disable_warnings()
        # 网页访问,post方式
        html = get(url,
                   cookies=self.cookies_merge_dict_in_qun_qq_com,
                   headers=header,
                   verify=False)

        # 将返回数据解析为python对象
        result = loads(html.text)
        # print(result)

        # 364天内没有删除的好友
        delFriendList = result['11053']['data']['delFriendList']
        if (len(delFriendList) == 0):
            return []

        # 364天内有删除的好友
        qq_number_list = delFriendList['364']['vecUin']

        # 返回364天内的被删除的好友名单
        return qq_number_list
Пример #9
0
    def is_vip_svip(self):
        # 判断此次登录的qq是否为vip或者svip
        # 需要提交的数据
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_qun_qq_com['skey'])
        qq_number = str(self.qq_number)
        skey = str(self.cookies_merge_dict_in_qun_qq_com['skey'])
        url = 'https://proxy.vip.qq.com/cgi-bin/srfentry.fcgi?bkn=' + str(
            bkn
        ) + '&ts=&g_tk=' + str(
            bkn
        ) + '&data={"11053":{"iAppId":1,"iKeyType":1,"sClientIp":"","sSessionKey":"' + skey + '","sUin":"' + qq_number + '"}}'

        # 设置请求头,模拟人工
        header = {
            'Accept': 'application/json, text/javascript, */*; q=0.01',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
            'Accept-Encoding': 'gzip, deflate',
            'Referer': 'https://huifu.qq.com/recovery/index.html?frag=1',
            'Origin': 'https://huifu.qq.com',
            'Connection': 'close'
        }

        # 屏蔽https证书警告
        urllib3.disable_warnings()
        # 网页访问,post方式
        html = get(url,
                   cookies=self.cookies_merge_dict_in_qun_qq_com,
                   headers=header,
                   verify=False)

        # 将返回数据解析为python对象
        result = loads(html.text)
        isSvip = result['11053']['data']['isSvip']
        isVip = result['11053']['data']['isVip']
        return {'isSvip': isSvip, 'isVip': isVip}
Пример #10
0
    def get_detail_information(self):
        # 获取该账户的详细资料

        # 存储返回数据
        result = {}

        # 获取基本信息
        # bkn由参数skey通过另一个加密函数得到
        bkn = hash33_bkn(self.cookies_merge_dict_in_id_qq_com['skey'])
        url = 'https://id.qq.com/cgi-bin/summary?ldw=' + str(bkn)

        # 设置请求头,模拟人工
        header = {
            'Accept': '*/*',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
            'Accept-Encoding': 'gzip, deflate, br',
            'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
            'Referer': 'https://id.qq.com/home/home.html?ver=10049&',
            'Connection': 'keep-alive'
        }

        # 屏蔽https证书警告
        urllib3.disable_warnings()
        # 网页访问,get方式
        html = get(url,
                   cookies=self.cookies_merge_dict_in_id_qq_com,
                   headers=header,
                   verify=False)
        # 指定返回数据编码格式
        html.encoding = 'utf-8'
        # 将返回数据解析为python对象,并存入result
        result.update(loads(html.text))

        # 获取在线天数
        skey = str(self.cookies_merge_dict_in_id_qq_com['skey'])
        g_tk = str(get_csrf_token(skey))
        url = 'https://cgi.vip.qq.com/querygrow/get?r=0.8102122812749504&g_tk=' + g_tk
        # 设置请求头,模拟人工
        header = {
            'Accept': '*/*',
            'User-Agent':
            'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
            'Accept-Encoding': 'gzip, deflate, br',
            'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
            'Referer': 'https://id.qq.com/level/mylevel.html?ver=10043&',
            'Connection': 'keep-alive'
        }
        # 屏蔽https证书警告
        urllib3.disable_warnings()
        # 网页访问,get方式
        html = get(url,
                   cookies=self.cookies_merge_dict_in_id_qq_com,
                   headers=header,
                   verify=False)
        # 指定返回数据编码格式
        html.encoding = 'utf-8'
        # 将返回数据解析为python对象,并存入result
        result.update(loads(html.text))

        # 获取更加详细的资料
        while (True):
            url = 'https://id.qq.com/cgi-bin/userinfo?ldw=' + str(bkn)
            # 设置请求头,模拟人工
            header = {
                'Accept': '*/*',
                'User-Agent':
                'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36',
                'Accept-Encoding': 'gzip, deflate, br',
                'accept-language': 'en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7',
                'Referer': 'https://id.qq.com/myself/myself.html?ver=10045&',
                'Connection': 'keep-alive'
            }
            # 屏蔽https证书警告
            urllib3.disable_warnings()
            # 网页访问,get方式
            html = get(url,
                       cookies=self.cookies_merge_dict_in_id_qq_com,
                       headers=header,
                       verify=False)
            # 指定返回数据编码格式
            html.encoding = 'utf-8'

            # 该网站有时候会返回空数据,所以要判断一下,如果是空则重新发包获取
            if (html.text != ''):
                # 将返回数据解析为python对象,并存入result
                result.update(loads(html.text))

                # 跳出循环
                break

        # 数据获取完毕,筛选出我们想返回的结果
        data = {}
        data.update({'bind_email': result['bind_email']})
        data.update({'nickname': result['nick']})
        data.update({'age': result['age']})
        data.update({
            'birthday':
            str(result['bir_y']) + '/' + str(result['bir_m']) + '/' +
            str(result['bir_d'])
        })
        data.update({'last_contact_friend_count': result['chat_count']})
        data.update({'friend_count': result['friend_count']})
        data.update({'group_count': result['group_count']})
        data.update({'remark_friend_count': result['remark_count']})
        data.update({'odd_friend_count': result['odd_count']})
        data.update({'qq_level': result['level']})
        data.update({
            'qq_level_rank':
            str(result['level_rank']) + '/' + str(result['friend_count'])
        })
        data.update({'qq_age': result['qq_age']})
        data.update({'mobile_qq_online_hour': result['iMobileQQOnlineTime']})
        data.update({'no_hide_online_hour': result['iNoHideOnlineTime']})
        data.update({'total_active_day': result['iTotalActiveDay']})
        qq_signature = result['ln'].replace(' ', ' ')
        # data.update({'qq_signature': qq_signature})

        return data