Browse Source

更新上游代码

pull/15/head
yuxian 3 years ago
parent
commit
c2b1ecc5ce
  1. 2
      checksendNotify.py
  2. 44
      dailycheckin_scripts/ck_duokan.py
  3. 104
      dailycheckin_scripts/ck_iqiyi.py
  4. 2
      utils.py

2
checksendNotify.py

@ -523,7 +523,7 @@ def send(title: str, content: str) -> None:
hitokoto = push_config.get("HITOKOTO") hitokoto = push_config.get("HITOKOTO")
text = one() if hitokoto else "" text = one() if hitokoto else ""
content += "\n\n" + text content += "\n" + text
ts = [ ts = [
threading.Thread(target=mode, args=(title, content), name=mode.__name__) threading.Thread(target=mode, args=(title, content), name=mode.__name__)

44
dailycheckin_scripts/ck_duokan.py

@ -245,6 +245,12 @@ class DuoKan:
msg = {"name": "每日签到", "value": result.get("msg")} msg = {"name": "每日签到", "value": result.get("msg")}
return 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): def info(self, cookies):
url = "https://www.duokan.com/store/v0/award/coin/list" url = "https://www.duokan.com/store/v0/award/coin/list"
data = f"sandbox=0&{self.get_data(cookies=cookies)}&withid=1" data = f"sandbox=0&{self.get_data(cookies=cookies)}&withid=1"
@ -254,10 +260,14 @@ class DuoKan:
if "尚未登录" not in result.get("msg"): if "尚未登录" not in result.get("msg"):
coin = sum([one.get("coin") for one in result.get("data", {}).get("award")]) coin = sum([one.get("coin") for one in result.get("data", {}).get("award")])
msg.append({"name": "当前书豆", "value": coin}) msg.append({"name": "当前书豆", "value": coin})
msg += [ for one in result.get("data", {}).get("award"):
{"name": f"{one.get('expire')} 到期", "value": f"{one.get('coin')} 书豆"} if one.get("delay") == 1:
for one in result.get("data", {}).get("award") 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 return msg
else: else:
return [{"name": "账号异常", "value": "Cookie 失效"}] return [{"name": "账号异常", "value": "Cookie 失效"}]
@ -296,7 +306,7 @@ class DuoKan:
num += 30 num += 30
print("体验任务完成啦!豆子 +30") print("体验任务完成啦!豆子 +30")
else: else:
print(result.get("data")) continue
msg = {"name": "体验任务", "value": f"获得 {num} 豆子"} msg = {"name": "体验任务", "value": f"获得 {num} 豆子"}
else: else:
msg = {"name": "体验任务", "value": f"{response.text}"} msg = {"name": "体验任务", "value": f"{response.text}"}
@ -329,20 +339,26 @@ class DuoKan:
def download(self, cookies): def download(self, cookies):
url = "https://www.duokan.com/events/common_task_gift" url = "https://www.duokan.com/events/common_task_gift"
data = f"code=J18UK6YYAY&chances=17&{self.get_data(cookies=cookies)}&withid=1" 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) count = 0
result = response.json() while True:
msg = {"name": "下载任务", "value": result.get("msg")} 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 return msg
def task(self, cookies): def task(self, cookies):
success_count = 0 success_count = 0
url = "https://www.duokan.com/events/tasks_gift" url = "https://www.duokan.com/events/tasks_gift"
for code in self.code_list: for i in range(3):
data = f"code={code}&chances=3&{self.get_data(cookies=cookies)}&withid=1" for code in self.code_list:
response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers) data = f"code={code}&chances=3&{self.get_data(cookies=cookies)}&withid=1"
result = response.json() response = requests.post(url=url, data=data, cookies=cookies, headers=self.headers)
if result.get("result") == 0: result = response.json()
success_count += 1 if result.get("result") == 0:
success_count += 1
msg = {"name": "其他任务", "value": f"完成 {success_count}"} msg = {"name": "其他任务", "value": f"完成 {success_count}"}
return msg return msg

104
dailycheckin_scripts/ck_iqiyi.py

@ -6,6 +6,7 @@ import json
import re import re
import time import time
from urllib.parse import unquote from urllib.parse import unquote
import hashlib
import requests import requests
@ -23,7 +24,21 @@ class IQIYI:
p00001 = re.findall(r"P00001=(.*?);", cookie)[0] if re.findall(r"P00001=(.*?);", cookie) else "" 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 "" 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 "" 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 @staticmethod
def user_information(p00001): def user_information(p00001):
@ -70,17 +85,86 @@ class IQIYI:
res = requests.get(url=url, params=params).json() res = requests.get(url=url, params=params).json()
if res["code"] == "A00000": if res["code"] == "A00000":
try: try:
growth = res["data"]["signInfo"]["data"]["rewardMap"]["growth"] cumulate_sign_days_sum = res["data"]["monthlyGrowthReward"]
cumulate_sign_days_sum = res["data"]["signInfo"]["data"]["cumulateSignDaysSum"]
msg = [ msg = [
{"name": "签到奖励", "value": f"{growth}成长值"}, {"name": "当月成长", "value": f"{cumulate_sign_days_sum}成长值"},
{"name": "当月签到", "value": f"{cumulate_sign_days_sum}"},
] ]
except Exception as e: except Exception as e:
print(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: else:
msg = [{"name": "签到奖励", "value": res.get("msg")}] msg = [{"name": "WEB 签到", "value": f"网页端签到失败:{res['message']}"}]
return msg return msg
@staticmethod @staticmethod
@ -180,8 +264,10 @@ class IQIYI:
return {"status": False, "msg": msg, "chance": 0} return {"status": False, "msg": msg, "chance": 0}
def main(self): 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) 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"] chance = self.draw(0, p00001=p00001, p00003=p00003)["chance"]
if chance: if chance:
draw_msg = "" draw_msg = ""
@ -214,6 +300,8 @@ class IQIYI:
] ]
+ user_msg + user_msg
+ sign_msg + sign_msg
+ web_sign_msg
+ sign2_msg
+ [ + [
task_msg, task_msg,
{"name": "抽奖奖励", "value": draw_msg}, {"name": "抽奖奖励", "value": draw_msg},

2
utils.py

@ -173,7 +173,7 @@ class check(object):
print(f"获取到的账号信息为:{value}\n") print(f"获取到的账号信息为:{value}\n")
num += 1 num += 1
try: try:
result = func(value=value) result = func(value=value) + '/n'
print(f"执行结果:\n{result}") print(f"执行结果:\n{result}")
Push_message += result Push_message += result
except IndexError: except IndexError:

Loading…
Cancel
Save