From 5e1f8b1a29f7299b3cee5fc18df557b79dcc39ce Mon Sep 17 00:00:00 2001 From: qxzg Date: Tue, 18 Apr 2023 11:53:23 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E4=BC=98=E5=8C=96=E9=97=AE=E5=8D=B7?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.py b/main.py index bd165d9..555877b 100644 --- a/main.py +++ b/main.py @@ -79,7 +79,9 @@ def get_questionnaire_list(): questionnaire_count = req['html'].count('') soup = BeautifulSoup(req['html'], features='lxml').find_all('td') + n = 0 + valid_mark = 0 for j in range(questionnaire_count): questionnaire_data = {} n = n + 1 @@ -94,6 +96,7 @@ def get_questionnaire_list(): if link_data.string == "已过期" or link_data.string == "查看详情" or link_data.string is None: continue else: + valid_mark = 1 questionnaire_remain = questionnaire_remain + 1 link_info = link_data.a['onclick'][18:-2].split(',') questionnaire_data['alreadyId'] = link_info[0] @@ -101,6 +104,9 @@ def get_questionnaire_list(): questionnaire_data['questionnaireId'] = link_info[2] questionnaire_list.append(questionnaire_data) + if not valid_mark: + print("本页已无未填写的问卷") + return def do_questionnaire(questionnaire_data: dict): payload = \ @@ -146,7 +152,7 @@ def do_questionnaire(questionnaire_data: dict): get_questionnaire_list() # print(questionnaire_list) if questionnaire_remain == 0: - input("你都填完了啊,没我什么事了,我走了") + input("你都填完了啊,没我什么事了,润了润了") exit() print("您还有%d个问卷未填(已排除已过期的问卷),请按回车键确认:" % questionnaire_remain) n = 1