From f768d5f261cdbd828aa2552aa53fe082ed2048dd Mon Sep 17 00:00:00 2001 From: lqjack Date: Sun, 12 Jan 2025 12:47:04 +0800 Subject: [PATCH] =?UTF-8?q?fix=20qruuid=20=20=E4=BA=8C=E7=BB=B4=E7=A0=81?= =?UTF-8?q?=E5=A4=B1=E6=95=88=EF=BC=8C=E7=82=B9=E5=87=BB=E5=88=B7=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- itchat/components/login.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/itchat/components/login.py b/itchat/components/login.py index c1fb0391..77ae7c29 100644 --- a/itchat/components/login.py +++ b/itchat/components/login.py @@ -105,6 +105,21 @@ def get_QRuuid(self): if data and data.group(1) == '200': self.uuid = data.group(2) return self.uuid + else: + current_time_millis = int(round(time.time() * 1000)) + url = 'https://login.wx.qq.com/jslogin' + params = { + 'appid' : 'wx782c26e4c19acffb', + 'fun' : 'new', + 'redirect_uri' : 'https://wx.qq.com/cgi-bin/mmwebwx-bin/webwxnewloginpage?mod=desktop', + '_' : current_time_millis, + 'lang' : 'zh_CN' } + r = self.s.get(url, params=params, headers=headers) + regx = r'window.QRLogin.code = (\d+); window.QRLogin.uuid = "(\S+?)";' + data = re.search(regx, r.text) + if data and data.group(1) == '200': + self.uuid = data.group(2) + return self.uuid def get_QR(self, uuid=None, enableCmdQR=False, picDir=None, qrCallback=None): uuid = uuid or self.uuid