mirror of
https://github.com/Sitoi/dailycheckin.git
synced 2024-11-17 13:48:03 +08:00
🐛 修复(main.py):更改了从res["data"]["tasks"]["daily"]获取数据的方式,现在使用get方法
✨ 功能(main.py):在获取用户信息失败时,添加了错误信息的打印,并设置了默认的昵称和用户名 ♻️ 重构(main.py):对main函数进行了重构,将获取用户信息的代码块移到了更合适的位置 ✨ 功能(main.py):对于非VIP用户,添加了特定的视频时长和等级权利信息
This commit is contained in:
parent
acb699e974
commit
3fa73d14bd
@ -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)
|
||||
_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 = (
|
||||
|
Loading…
Reference in New Issue
Block a user