From c2b1ecc5ce4f33d3cb52b2646b1917afd0431a59 Mon Sep 17 00:00:00 2001 From: yuxian Date: Wed, 23 Mar 2022 18:02:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=B8=8A=E6=B8=B8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- checksendNotify.py | 2 +- dailycheckin_scripts/ck_duokan.py | 44 +++++++++---- dailycheckin_scripts/ck_iqiyi.py | 104 +++++++++++++++++++++++++++--- utils.py | 2 +- 4 files changed, 128 insertions(+), 24 deletions(-) diff --git a/checksendNotify.py b/checksendNotify.py index a431547..68482f0 100644 --- a/checksendNotify.py +++ b/checksendNotify.py @@ -523,7 +523,7 @@ def send(title: str, content: str) -> None: hitokoto = push_config.get("HITOKOTO") text = one() if hitokoto else "" - content += "\n\n" + text + content += "\n" + text ts = [ threading.Thread(target=mode, args=(title, content), name=mode.__name__) diff --git a/dailycheckin_scripts/ck_duokan.py b/dailycheckin_scripts/ck_duokan.py index 09780f8..d6b7baf 100644 --- a/dailycheckin_scripts/ck_duokan.py +++ b/dailycheckin_scripts/ck_duokan.py @@ -245,6 +245,12 @@ class DuoKan: msg = {"name": "每日签到", "value": result.get("msg")} return msg + def delay(self, cookies, date): + url = "https://www.duokan.com/store/v0/award/coin/delay" + data = f"date={date}&{self.get_data(cookies=cookies)}&withid=1" + ret = requests.post(url=url, data=data, cookies=cookies, headers=self.headers).json() + return ret + def info(self, cookies): url = "https://www.duokan.com/store/v0/award/coin/list" data = f"sandbox=0&{self.get_data(cookies=cookies)}&withid=1" @@ -254,10 +260,14 @@ class DuoKan: if "尚未登录" not in result.get("msg"): coin = sum([one.get("coin") for one in result.get("data", {}).get("award")]) msg.append({"name": "当前书豆", "value": coin}) - msg += [ - {"name": f"{one.get('expire')} 到期", "value": f"{one.get('coin')} 书豆"} - for one in result.get("data", {}).get("award") - ] + for one in result.get("data", {}).get("award"): + if one.get("delay") == 1: + ret = self.delay(cookies, one.get("expire")) + msg.append( + {"name": f"{one.get('expire')} 到期", "value": f"{one.get('coin')} 书豆 | 延期:{ret.get('msg')}"} + ) + else: + msg.append({"name": f"{one.get('expire')} 到期", "value": f"{one.get('coin')} 书豆"}) return msg else: return [{"name": "账号异常", "value": "Cookie 失效"}] @@ -296,7 +306,7 @@ class DuoKan: num += 30 print("体验任务完成啦!豆子 +30") else: - print(result.get("data")) + continue msg = {"name": "体验任务", "value": f"获得 {num} 豆子"} else: msg = {"name": "体验任务", "value": f"{response.text}"} @@ -329,20 +339,26 @@ class DuoKan: def download(self, cookies): url = "https://www.duokan.com/events/common_task_gift" data = f"code=J18UK6YYAY&chances=17&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - msg = {"name": "下载任务", "value": result.get("msg")} + count = 0 + while True: + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if result.get("result") == 130014: + break + count += 1 + msg = {"name": "下载任务", "value": f"完成 {count} 次"} return msg def task(self, cookies): success_count = 0 url = "https://www.duokan.com/events/tasks_gift" - for code in self.code_list: - data = f"code={code}&chances=3&{self.get_data(cookies=cookies)}&withid=1" - response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) - result = response.json() - if result.get("result") == 0: - success_count += 1 + for i in range(3): + for code in self.code_list: + data = f"code={code}&chances=3&{self.get_data(cookies=cookies)}&withid=1" + response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) + result = response.json() + if result.get("result") == 0: + success_count += 1 msg = {"name": "其他任务", "value": f"完成 {success_count} 个"} return msg diff --git a/dailycheckin_scripts/ck_iqiyi.py b/dailycheckin_scripts/ck_iqiyi.py index 90dbf6d..ab7598d 100644 --- a/dailycheckin_scripts/ck_iqiyi.py +++ b/dailycheckin_scripts/ck_iqiyi.py @@ -6,6 +6,7 @@ import json import re import time from urllib.parse import unquote +import hashlib import requests @@ -23,7 +24,21 @@ class IQIYI: p00001 = re.findall(r"P00001=(.*?);", cookie)[0] if re.findall(r"P00001=(.*?);", cookie) else "" p00002 = re.findall(r"P00002=(.*?);", cookie)[0] if re.findall(r"P00002=(.*?);", cookie) else "" p00003 = re.findall(r"P00003=(.*?);", cookie)[0] if re.findall(r"P00003=(.*?);", cookie) else "" - return p00001, p00002, p00003 + dfp = re.findall(r"dfp=(.*?);", cookie)[0] if re.findall(r"dfp=(.*?);", cookie) else "" + return p00001, p00002, p00003, dfp + + @staticmethod + def md5(data): + return hashlib.md5(bytes(data, encoding="utf-8")).hexdigest() + + def get_sign(self, c, t, e=None): + buf = [] + for key, value in t.items(): + buf.append("=".join([key, str(value)])) + if e is not None: + buf.append(e) + return self.md5(c.join(buf)) + return c.join(buf) @staticmethod def user_information(p00001): @@ -70,17 +85,86 @@ class IQIYI: res = requests.get(url=url, params=params).json() if res["code"] == "A00000": try: - growth = res["data"]["signInfo"]["data"]["rewardMap"]["growth"] - cumulate_sign_days_sum = res["data"]["signInfo"]["data"]["cumulateSignDaysSum"] + cumulate_sign_days_sum = res["data"]["monthlyGrowthReward"] msg = [ - {"name": "签到奖励", "value": f"{growth}成长值"}, - {"name": "当月签到", "value": f"{cumulate_sign_days_sum}天"}, + {"name": "当月成长", "value": f"{cumulate_sign_days_sum}成长值"}, ] except Exception as e: print(e) - msg = [{"name": "签到奖励", "value": res["data"]["signInfo"].get("msg")}] + msg = [{"name": "当月成长", "value": str(e)}] + else: + msg = [{"name": "当月成长", "value": res.get("msg")}] + return msg + + def sign2(self, p00001, p00003): + sign_date = { + "agentType": "1", + "agentversion": "1.0", + "appKey": "basic_pcw", + "authCookie": p00001, + "qyid": self.md5("".join(random.sample(string.ascii_letters + string.digits, 16))), + "task_code": "natural_month_sign", + "timestamp": round(time.time() * 1000), + "typeCode": "point", + "userId": p00003, + } + post_date = { + "natural_month_sign": { + "agentType": "1", + "agentversion": "1", + "authCookie": p00001, + "qyid": self.md5("".join(random.sample(string.ascii_letters + string.digits, 16))), + "taskCode": "iQIYI_mofhr", + "verticalCode": "iQIYI", + } + } + sign = self.get_sign("|", sign_date, "UKobMjDMsDoScuWOfp6F") + url = f"https://community.iqiyi.com/openApi/task/execute?{self.get_sign('&', sign_date)}&sign={sign}" + header = {"Content-Type": "application/json"} + res = requests.post(url, headers=header, data=json.dumps(post_date)).json() + if res["code"] == "A00000": + if res["data"]["code"] == "A0000": + # quantity = res["data"]["data"]["rewards"][0]["rewardCount"] # 积分 + # addgrowthvalue = res["data"]["data"]["rewards"][0]["rewardCount"] # 新增成长值 + # continued = res["data"]["data"]["signDays"] # 签到天数 + msg = [{"name": "APP 签到", "value": "签到成功"}] + else: + msg = [{"name": "APP 签到", "value": f"签到失败:{res['data']['msg']}"}] + else: + msg = [{"name": "APP 签到", "value": f"签到失败:{res['message']}"}] + return msg + + def web_sign(self, p00001, p00003, dfp): + dfp = dfp.split("@")[0] + web_sign_date = { + "agenttype": "1", + "agentversion": "0", + "appKey": "basic_pca", + "appver": "0", + "authCookie": p00001, + "channelCode": "sign_pcw", + "dfp": dfp, + "scoreType": "1", + "srcplatform": "1", + "typeCode": "point", + "userId": p00003, + "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36", + "verticalCode": "iQIYI", + } + + sign = self.get_sign("|", web_sign_date, "DO58SzN6ip9nbJ4QkM8H") + url = f"https://community.iqiyi.com/openApi/score/add?{self.get_sign('&', web_sign_date)}&sign={sign}" + res = requests.get(url).json() + if res["code"] == "A00000": + if res["data"][0]["code"] == "A0000": + quantity = res["data"][0]["score"] + continued = res["data"][0]["continuousValue"] + msg = [{"name": "WEB 签到", "value": f"积分+{quantity} 累计签到{continued}天"}] + + else: + msg = [{"name": "WEB 签到", "value": f"网页端签到失败:{res['data'][0]['message']}"}] else: - msg = [{"name": "签到奖励", "value": res.get("msg")}] + msg = [{"name": "WEB 签到", "value": f"网页端签到失败:{res['message']}"}] return msg @staticmethod @@ -180,8 +264,10 @@ class IQIYI: return {"status": False, "msg": msg, "chance": 0} def main(self): - p00001, p00002, p00003 = self.parse_cookie(self.check_item.get("cookie")) + p00001, p00002, p00003, dfp = self.parse_cookie(self.check_item.get("cookie")) sign_msg = self.sign(p00001=p00001) + web_sign_msg = self.web_sign(p00001=p00001, p00003=p00003, dfp=dfp) + sign2_msg = self.sign2(p00001=p00001, p00003=p00003) chance = self.draw(0, p00001=p00001, p00003=p00003)["chance"] if chance: draw_msg = "" @@ -214,6 +300,8 @@ class IQIYI: ] + user_msg + sign_msg + + web_sign_msg + + sign2_msg + [ task_msg, {"name": "抽奖奖励", "value": draw_msg}, diff --git a/utils.py b/utils.py index 112f493..91aa37c 100644 --- a/utils.py +++ b/utils.py @@ -173,7 +173,7 @@ class check(object): print(f"获取到的账号信息为:{value}\n") num += 1 try: - result = func(value=value) + result = func(value=value) + '/n' print(f"执行结果:\n{result}") Push_message += result except IndexError: