From ef8c3a047fec98b2ab9ec18550adb489ed71c59b Mon Sep 17 00:00:00 2001 From: linlin <1628708538@qq.com> Date: Wed, 6 Mar 2024 21:01:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=8E=E5=A4=A9=E8=AE=BA=E5=9D=9B=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=B8=80=E4=BA=9B=E5=B0=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mt.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mt.py b/mt.py index 8ea5aa4..6802d6e 100644 --- a/mt.py +++ b/mt.py @@ -78,15 +78,18 @@ def send_notification_message(title): def main(username,password): headers={'User-Agent': ua} - session.get('https://bbs.binmt.cc/member.php?mod=logging&action=login&infloat=yes&handlekey=login&inajax=1&ajaxtarget=fwin_content_login',headers=headers) + session.get('https://bbs.binmt.cc',headers=headers) chusihua = session.get('https://bbs.binmt.cc/member.php?mod=logging&action=login&infloat=yes&handlekey=login&inajax=1&ajaxtarget=fwin_content_login',headers=headers) #print(re.findall('loginhash=(.*?)">', chusihua.text)) - loginhash = re.findall('loginhash=(.*?)">', chusihua.text)[0] - formhash = re.findall('formhash" value="(.*?)".*? />', chusihua.text)[0] + try: + loginhash = re.findall('loginhash=(.*?)">', chusihua.text)[0] + formhash = re.findall('formhash" value="(.*?)".*? />', chusihua.text)[0] + except Exception as e: + print('loginhash、formhash获取失败') denurl = f'https://bbs.binmt.cc/member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash={loginhash}&inajax=1' data = {'formhash': formhash,'referer': 'https://bbs.binmt.cc/forum.php','loginfield': 'username','username': username,'password': password,'questionid': '0','answer': '',} denlu = session.post(headers=headers, url=denurl, data=data).text - #print(denlu) + if '欢迎您回来' in denlu: #获取分组、名字 fzmz = re.findall('欢迎您回来,(.*?),现在', denlu)[0] @@ -103,6 +106,7 @@ def main(username,password): huoqu(formhash) else: myprint('登录失败') + print(re.findall("CDATA(.*?)<", denlu)[0]) return True