From e572965019aa400d13ca2eb7cc6f5c226da45778 Mon Sep 17 00:00:00 2001 From: Lkhsss Date: Thu, 6 Oct 2022 22:45:28 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=BD=91=E6=98=93=E4=BA=91=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E4=BA=8C=E7=BB=B4=E7=A0=81=E7=99=BB=E5=BD=95=E6=97=B6?= =?UTF-8?q?=E5=BE=AA=E7=8E=AF=E4=B8=8D=E5=88=B0sleep=E5=87=BD=E6=95=B0?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E4=BC=9A=E5=9C=A8=E4=B8=80=E5=AE=9A?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=86=85=E4=B8=8D=E6=96=AD=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=EF=BC=8C=E7=BD=91=E6=98=93=E4=BA=91=E4=BC=9A=E7=BD=A2=E5=B7=A5?= =?UTF-8?q?qwq=20=E4=BD=BF=E7=94=A8qrcode=E7=9A=84print=5Fascii=E5=87=BD?= =?UTF-8?q?=E6=95=B0=EF=BC=8C=E7=9B=B4=E6=8E=A5=E5=9C=A8=E7=BB=88=E7=AB=AF?= =?UTF-8?q?=E4=B8=AD=E6=89=93=E5=8D=B0=E4=BA=8C=E7=BB=B4=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=96=B9=E4=BE=BF=E4=BD=BF=E7=94=A8github=20action?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DecryptLogin/modules/core/music163.py | 31 ++++++++++++++++----------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/DecryptLogin/modules/core/music163.py b/DecryptLogin/modules/core/music163.py index 04e1776..f9d7075 100644 --- a/DecryptLogin/modules/core/music163.py +++ b/DecryptLogin/modules/core/music163.py @@ -138,7 +138,7 @@ def loginbysms(self, username, password, ctcode=86): elif response_json['code'] in [400, 502]: raise RuntimeError('Account -> %s, fail to login, username or password error' % username) # 网络太拥挤 - elif response_json['code'] in [-462] and account_type == 'phone': + elif response_json['code'] in [-462] and self.judgeaccounttype() == 'phone': return self.loginbysms(username, password) # 其他错误 else: @@ -191,9 +191,11 @@ def login(self, username='', password='', crack_captcha_func=None, **kwargs): qr = qrcode.QRCode(version=1, error_correction=qrcode.constants.ERROR_CORRECT_L, box_size=10, border=2) qr.add_data(scan_url) qr.make(fit=True) - img = qr.make_image(fill_color='black', back_color='white') - img.save(os.path.join(self.cur_path, 'qrcode.jpg')) - showImage(os.path.join(self.cur_path, 'qrcode.jpg')) + #img = qr.make_image(fill_color='black', back_color='white') + #img.save(os.path.join(self.cur_path, 'qrcode.jpg')) + #showImage(os.path.join(self.cur_path, 'qrcode.jpg')) + + qr.print_ascii(out=None, tty=False, invert=False) # 检测二维码状态 data = { 'csrf_token': '', @@ -203,15 +205,20 @@ def login(self, username='', password='', crack_captcha_func=None, **kwargs): data = self.cracker.get(data) while True: response = self.session.post(self.checklogin_url, data=data) - if response.json()['code'] in [803]: - break - elif response.json()['code'] in [801, 802]: - continue - else: - raise RuntimeError(response.json()) - time.sleep(0.5) + try: + if response.json()['code'] in [803]: + break + elif response.json()['code'] in [801, 802]: + continue + else: + raise RuntimeError(response.json()) + except: + raise RuntimeError("未知错误") + finally: + time.sleep(1)# sleep()在次循环中中无法到达,导致网易返回频繁操作的信息。(Lkhsss: 修复) + # 登录成功 - removeImage(os.path.join(self.cur_path, 'qrcode.jpg')) + # removeImage(os.path.join(self.cur_path, 'qrcode.jpg')) csrf = self.session.cookies.get('__csrf') data = self.cracker.get({'csrf_token': csrf}) response = self.session.post(self.account_url.format(csrf), data=data) From 963ea59a547232acf0a6b2a7cf23f6cdd2cdd88e Mon Sep 17 00:00:00 2001 From: Lkhsss Date: Thu, 6 Oct 2022 22:51:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DecryptLogin/modules/core/music163.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DecryptLogin/modules/core/music163.py b/DecryptLogin/modules/core/music163.py index f9d7075..9005a71 100644 --- a/DecryptLogin/modules/core/music163.py +++ b/DecryptLogin/modules/core/music163.py @@ -195,7 +195,7 @@ def login(self, username='', password='', crack_captcha_func=None, **kwargs): #img.save(os.path.join(self.cur_path, 'qrcode.jpg')) #showImage(os.path.join(self.cur_path, 'qrcode.jpg')) - qr.print_ascii(out=None, tty=False, invert=False) + qr.print_ascii(out=None, tty=False, invert=False) # 使用print_ascii函数在终端打印二维码,实现github action 扫码 # 检测二维码状态 data = { 'csrf_token': '',