From bb806224a3ca87b1a5bf82e214c7ece4c8be0a81 Mon Sep 17 00:00:00 2001 From: Sitoi <133397418@qq.com> Date: Fri, 9 Feb 2024 09:53:46 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E5=8A=9F=E8=83=BD(dailycheckin/iqi?= =?UTF-8?q?yi/main.py)=EF=BC=9A=E6=B7=BB=E5=8A=A0=E6=AF=8F=E6=97=A5?= =?UTF-8?q?=E6=91=87=E4=B8=80=E6=91=87=E6=8A=BD=E5=A5=96=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=20=20=20=E2=AC=86=EF=B8=8F=20=E6=9B=B4=E6=96=B0(dailycheckin/?= =?UTF-8?q?=5F=5Fversion=5F=5F.py)=EF=BC=9A=E6=8F=90=E5=8D=87=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E5=88=B024.2.9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dailycheckin/__version__.py | 2 +- dailycheckin/iqiyi/main.py | 47 ++++++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/dailycheckin/__version__.py b/dailycheckin/__version__.py index 1e0838188..36d60c759 100755 --- a/dailycheckin/__version__.py +++ b/dailycheckin/__version__.py @@ -1 +1 @@ -__version__ = "24.2.6" +__version__ = "24.2.9" diff --git a/dailycheckin/iqiyi/main.py b/dailycheckin/iqiyi/main.py index cbfcf7617..e0b402c76 100755 --- a/dailycheckin/iqiyi/main.py +++ b/dailycheckin/iqiyi/main.py @@ -54,11 +54,11 @@ def user_information(p00001): if res["code"] == "A00000": try: res_data = res.get("data", {}) - level = res_data.get("level", 0) # VIP 等级 - growthvalue = res_data.get("growthvalue", 0) # 当前 VIP 成长值 - distance = res_data.get("distance", 0) # 升级需要成长值 - deadline = res_data.get("deadline", "非 VIP 用户") # VIP 到期时间 - today_growth_value = res_data.get("todayGrowthValue", 0) # 今日成长值 + level = res_data.get("level", 0) + growthvalue = res_data.get("growthvalue", 0) + distance = res_data.get("distance", 0) + deadline = res_data.get("deadline", "非 VIP 用户") + today_growth_value = res_data.get("todayGrowthValue", 0) msg = [ {"name": "VIP 等级", "value": level}, {"name": "当前成长", "value": growthvalue}, @@ -70,7 +70,6 @@ def user_information(p00001): msg = [ {"name": "账号信息", "value": str(e)}, ] - print(msg) else: msg = [ {"name": "账号信息", "value": res.get("msg")}, @@ -82,7 +81,6 @@ def sign(self, p00001, p00003): VIP 签到 """ qyid = uuid4().hex[:16] - print(qyid) time_stamp = int(time.time() * 1000) data = f"agentType=1|agentversion=1|appKey=basic_pcw|authCookie={p00001}|qyid={qyid}|task_code=natural_month_sign|timestamp={time_stamp}|typeCode=point|userId={p00003}|UKobMjDMsDoScuWOfp6F" sign = md5(data.encode(encoding="utf-8")).hexdigest() @@ -108,7 +106,9 @@ def sign(self, p00001, p00003): msg = [{"name": "签到天数", "value": _msg}] else: try: - msg = [{"name": "签到天数", "value": res["data"]["data"]["signDays"]}] + msg = [ + {"name": "签到天数", "value": res["data"]["data"]["signDays"]} + ] except Exception as e: msg = [{"name": "签到天数", "value": str(e)}] else: @@ -182,6 +182,29 @@ def get_task_rewards(p00001, task_list): msg = {"name": "任务奖励", "value": f"+{growth_task}成长值"} return msg + def lottery(self, p00001, award_list=[]): + url = "https://act.vip.iqiyi.com/shake-api/lottery" + params = { + "P00001": p00001, + "lotteryType": "0", + "actCode": "0k9GkUcjqqj4tne8", + } + res = requests.get(url, params=params).json() + msgs = [] + if res.get("code") == "A00000": + award_info = res.get("data", {}).get("title") + award_list.append(award_info) + time.sleep(3) + return self.lottery(p00001=p00001, award_list=award_list) + elif res.get("msg") == "抽奖次数用完": + if award_list: + msgs = [{"name": "每天摇一摇", "value": "、".join(award_list)}] + else: + msgs = [{"name": "每天摇一摇", "value": res.get("msg")}] + else: + msgs = [{"name": "每天摇一摇", "value": res.get("msg")}] + return msgs + @staticmethod def draw(draw_type, p00001, p00003): """ @@ -351,11 +374,12 @@ def main(self): 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) - chance = self.draw(0, p00001=p00001, p00003=p00003)["chance"] + chance = self.draw(draw_type=0, p00001=p00001, p00003=p00003)["chance"] + lottery_msgs = self.lottery(p00001=p00001, award_list=[]) if chance: draw_msg = "" - for i in range(chance): - ret = self.draw(1, p00001=p00001, p00003=p00003) + for _ in range(chance): + ret = self.draw(draw_type=1, p00001=p00001, p00003=p00003) draw_msg += ret["msg"] + ";" if ret["status"] else "" else: draw_msg = "抽奖机会不足" @@ -388,6 +412,7 @@ def main(self): {"name": "抽奖奖励", "value": draw_msg}, ] + [watch_msg] + + lottery_msgs + level_right_msg ) msg = "\n".join([f"{one.get('name')}: {one.get('value')}" for one in msg])