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