From 3fa73d14bd035a1a4e680416786b5dc681c72400 Mon Sep 17 00:00:00 2001 From: shitao <133397418@qq.com> Date: Tue, 27 Feb 2024 09:21:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D(main.py)?= =?UTF-8?q?=EF=BC=9A=E6=9B=B4=E6=94=B9=E4=BA=86=E4=BB=8Eres["data"]["tasks?= =?UTF-8?q?"]["daily"]=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8C=E7=8E=B0=E5=9C=A8=E4=BD=BF=E7=94=A8?= =?UTF-8?q?get=E6=96=B9=E6=B3=95=20=20=20=E2=9C=A8=20=E5=8A=9F=E8=83=BD(ma?= =?UTF-8?q?in.py)=EF=BC=9A=E5=9C=A8=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=A4=B1=E8=B4=A5=E6=97=B6=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E6=89=93=E5=8D=B0=EF=BC=8C=E5=B9=B6=E8=AE=BE=E7=BD=AE=E4=BA=86?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E7=9A=84=E6=98=B5=E7=A7=B0=E5=92=8C=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=90=8D=20=20=20=E2=99=BB=EF=B8=8F=20=E9=87=8D?= =?UTF-8?q?=E6=9E=84(main.py)=EF=BC=9A=E5=AF=B9main=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E4=BA=86=E9=87=8D=E6=9E=84=EF=BC=8C=E5=B0=86?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=9D=97=E7=A7=BB=E5=88=B0=E4=BA=86=E6=9B=B4?= =?UTF-8?q?=E5=90=88=E9=80=82=E7=9A=84=E4=BD=8D=E7=BD=AE=20=20=20=E2=9C=A8?= =?UTF-8?q?=20=E5=8A=9F=E8=83=BD(main.py)=EF=BC=9A=E5=AF=B9=E4=BA=8E?= =?UTF-8?q?=E9=9D=9EVIP=E7=94=A8=E6=88=B7=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E4=BA=86=E7=89=B9=E5=AE=9A=E7=9A=84=E8=A7=86=E9=A2=91=E6=97=B6?= =?UTF-8?q?=E9=95=BF=E5=92=8C=E7=AD=89=E7=BA=A7=E6=9D=83=E5=88=A9=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/iqiyi/main.py | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/dailycheckin/iqiyi/main.py b/dailycheckin/iqiyi/main.py index 904356a..2309503 100755 --- a/dailycheckin/iqiyi/main.py +++ b/dailycheckin/iqiyi/main.py @@ -125,7 +125,7 @@ class IQIYI(CheckIn): task_list = [] res = requests.get(url=url, params=params).json() if res["code"] == "A00000": - for item in res["data"]["tasks"]["daily"]: + for item in res["data"].get("tasks", {}).get("daily", []): task_list.append( { "taskTitle": item["taskTitle"], @@ -398,13 +398,31 @@ class IQIYI(CheckIn): def main(self): p00001, p00002, p00003, dfp = self.parse_cookie(self.check_item.get("cookie")) + try: + user_info = json.loads(unquote(p00002, encoding="utf-8")) + user_name = user_info.get("user_name") + user_name = user_name.replace(user_name[3:7], "****") + nickname = user_info.get("nickname") + except Exception as e: + print(f"获取账号信息失败,错误信息: {e}") + nickname = "未获取到,请检查 Cookie 中 P00002 字段" + user_name = "未获取到,请检查 Cookie 中 P00002 字段" sign_msg = self.sign(p00001=p00001, p00003=p00003) - watch_msg = self.start_watch(p00001=p00001, p00003=p00003, dfp=dfp) - level_right_msg = self.level_right(p00001=p00001) + _user_msg = self.user_information(p00001=p00001) + lotto_lottery_msg = self.lotto_lottery(p00001=p00001) + if _user_msg[4].get("value") != "非 VIP 用户": + watch_msg = self.start_watch(p00001=p00001, p00003=p00003, dfp=dfp) + level_right_msg = self.level_right(p00001=p00001) + else: + watch_msg = {"name": "视频时长", "value": "非 VIP 用户"} + level_right_msg = [ + { + "name": "V7 免费升级星钻", + "value": "非 VIP 用户", + } + ] chance = self.draw(draw_type=0, p00001=p00001, p00003=p00003)["chance"] lottery_msgs = self.lottery(p00001=p00001, award_list=[]) - lotto_lottery_msg = self.lotto_lottery(p00001=p00001) - if chance: draw_msg = "" for _ in range(chance): @@ -417,15 +435,7 @@ class IQIYI(CheckIn): task_list = self.query_user_task(p00001=p00001) self.join_task(p00001=p00001, task_list=task_list) task_msg = self.get_task_rewards(p00001=p00001, task_list=task_list) - try: - user_info = json.loads(unquote(p00002, encoding="utf-8")) - user_name = user_info.get("user_name") - user_name = user_name.replace(user_name[3:7], "****") - nickname = user_info.get("nickname") - except Exception as e: - print(f"获取账号信息失败,错误信息: {e}") - nickname = "未获取到,请检查 Cookie 中 P00002 字段" - user_name = "未获取到,请检查 Cookie 中 P00002 字段" + user_msg = self.user_information(p00001=p00001) msg = (