Skip to content

Commit

Permalink
♻️ 重构(iqiyi/main.py):优化签到函数,使用新的签到算法
Browse files Browse the repository at this point in the history
  • Loading branch information
Sitoi committed Jan 16, 2024
1 parent adccbfb commit 189a6eb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 16 deletions.
1 change: 0 additions & 1 deletion dailycheckin/aliyun/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ def main(self):
) as f:
datas = json.loads(f.read())
_check_item = datas.get("ALIYUN", [])[0]
# _check_item = {"refresh_token": "599dcf6504364c6ca362eddf62e3d5c6"}
print(AliYun(check_item=_check_item).main())
48 changes: 33 additions & 15 deletions dailycheckin/iqiyi/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import re
import time
from hashlib import md5
from random import randint
from urllib.parse import unquote
from uuid import uuid4
Expand Down Expand Up @@ -76,25 +77,42 @@ def user_information(p00001):
]
return msg

@staticmethod
def sign(p00001):
def sign(self, p00001, p00003):
"""
VIP 签到
"""
url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask"
params = {"P00001": p00001, "autoSign": "yes"}
res = requests.get(url=url, params=params).json()
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()
url = f"https://community.iqiyi.com/openApi/task/execute?agentType=1&agentversion=1&appKey=basic_pcw&authCookie={p00001}&qyid={qyid}&sign={sign}&task_code=natural_month_sign&timestamp={time_stamp}&typeCode=point&userId={p00003}"
body = {
"natural_month_sign": {
"taskCode": "iQIYI_mofhr",
"agentType": 1,
"agentversion": 1,
"authCookie": p00001,
"qyid": qyid,
"verticalCode": "iQIYI",
}
}
res = requests.post(
url=url,
data=json.dumps(body),
headers={"Cookie": f"P00001={p00001}", "Content-Type": "application/json"},
).json()
if res["code"] == "A00000":
try:
cumulate_sign_days_sum = res["data"]["monthlyGrowthReward"]
msg = [
{"name": "当月成长", "value": f"{cumulate_sign_days_sum}成长值"},
]
except Exception as e:
print(e)
msg = [{"name": "当月成长", "value": str(e)}]
_msg = res["data"]["msg"]
if _msg:
msg = [{"name": "签到天数", "value": _msg}]
else:
try:
msg = [{"name": "签到天数", "value": res["data"]["data"]["signDays"]}]
except Exception as e:
msg = [{"name": "签到天数", "value": str(e)}]
else:
msg = [{"name": "当月成长", "value": res.get("msg")}]
msg = [{"name": "签到天数", "value": res.get("msg")}]
return msg

@staticmethod
Expand Down Expand Up @@ -330,7 +348,7 @@ def start_watch(self, p00001, p00003, dfp):

def main(self):
p00001, p00002, p00003, dfp = self.parse_cookie(self.check_item.get("cookie"))
sign_msg = self.sign(p00001=p00001)
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"]
Expand Down

0 comments on commit 189a6eb

Please sign in to comment.