1. 话痨少年首页
  2. 面试宝典

[Python] 一键自动清除 QQ 互联授权

[Python] 一键自动清除 QQ 互联授权
相信大家有时候会想把 QQ互联授权全部清理一遍,但是呢,官网并不提供批量清除,只能手动一个一个点。
像我就有12页的QQ互联授权…..要是一个一个点,怕是半个小时都完不了事,所以有人就写了一个在Python 批量清除授权的脚本,亲测好用。
[Python] 一键自动清除 QQ 互联授权
 

使用教程

登陆 connect.qq.com 获取 uinskey 的 cookie 拷贝填充到代码
并运行可直接清除全部的 QQ 互联授权。
 

#!/usr/bin/env python3
# License: Public Domain
import requests
session = requests.session()
session.cookies.set("uin", "your uin id from connect.qq.com cookie")
session.cookies.set("skey", "your skey from connect.qq.com cookie")
def fetch_auth_list(start, limit):
    response = session.get(
        "https://cgi.connect.qq.com/authmng/get_auth_app_list",
        headers={
            "Referer": "https://connect.qq.com/manage.html",
        },
        params={
            "sort": "time",
            "apptype": "all",
            "token": 5381,
            "order": "desc",
            "start": start,
            "limit": limit,
        },
    )
    return response.json()
def delete_connect(app_id):
    response = session.post(
        "https://cgi.connect.qq.com/authmng/del_app_auth",
        headers={
            "Referer": "https://cgi.connect.qq.com/proxy.html?callback=1&id=1"
        },
        data={
            "appid": app_id,
        },
    )
    payload = response.json()
    print("AppID: %s, Message: %s" % (app_id, payload["msg"]))
def main():
    total = fetch_auth_list(0, 0)["result"]["total"]
    app_ids = set()
    for index in range(0, total, 20):
        apps = fetch_auth_list(index, 20)["result"]["data"]
        app_ids |= set(app["appid"] for app in apps)
    for app_id in sorted(app_ids):
        delete_connect(app_id)
if __name__ == "__main__":
    main()

 
 
代码作者:Septembers
 

原创文章,作者:双木,如若转载,请注明出处:https://www.09l.me/750.html

发表评论

登录后才能评论

联系我们

邮件:[email protected]