- A+
所属分类:其他教程
支持爱奇艺 VIP 签到、VIP 日常任务、每日三次抽奖
使用方法
腾讯云新建空白函数,语言 python3.6。复制代码进去,超时时间设置成 60 秒,设置定时触发,保存。
酷推版本
酷推官网:https://cp.xuthus.cc/
- # -*- coding: utf8 -*-
- #爱奇艺(IQIYI)官网,加载主页面,
- #开发者工具搜索获取 P00001,P00003 参数
- #skey 为酷推 密钥,绑定发送 qq
- #修改 200、201、202 行代码,其中 202 行的 skey 是酷推的 skey。200 和 201 行是获取 Cookie 中的 P0001 和 P0003
- import time
- import requests
- class IQY:
- '''
- 爱奇艺签到、抽奖、做日常任务(签到、任务仅限 VIP)
- *奖励:签 7 天奖 1 天,14 天奖 2 天,28 天奖 7 天;日常任务;随机成长值
- '''
- def __init__(self, P00001, psp_uid):
- '''
- :param P00001: 签到,任务,抽奖必要参数
- :param psp_uid: 抽奖必要参数
- '''
- self.P00001 = P00001
- self.psp_uid = psp_uid
- self.taskList = []
- self.growthTask = 0
- def userInformation(self):
- '''
- 用户信息查询
- '''
- time.sleep(3)
- url = "http://serv.vip.iqiyi.com/vipgrowth/query.action"
- params = {
- "P00001": self.P00001,
- }
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- try:
- res_data = res.json()["data"]
- #VIP 等级
- level = res_data["level"]
- #当前 VIP 成长值
- growthvalue = res_data["growthvalue"]
- #升级需要成长值
- distance = res_data["distance"]
- #VIP 到期时间
- deadline = res_data["deadline"]
- #今日成长值
- todayGrowthValue = res_data["todayGrowthValue"]
- msg = f"VIP 等级:{level}\n 当前成长值:{growthvalue}\n 升级需成长值:{distance}\n 今日成长值: +{todayGrowthValue}\nVIP 到期时间:{deadline}"
- except:
- msg = res.json()
- else:
- # print("(iqy)签到错误", res.content.decode())
- msg = res.json()
- print(msg)
- return msg
- def sign(self):
- '''
- VIP 签到
- '''
- url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask"
- params = {
- "P00001": self.P00001,
- "autoSign": "yes"
- }
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- try:
- growth = res.json()["data"]["signInfo"]["data"]["rewardMap"]["growth"]
- continueSignDaysSum = res.json()["data"]["signInfo"]["data"]["continueSignDaysSum"]
- #vipStatus = res.json()["data"]["userInfo"]["vipStatus"]
- rewardDay = 7 if continueSignDaysSum%28<=7 else (14 if continueSignDaysSum%28<=14 else 28)
- rouund_day = 28 if continueSignDaysSum%28 == 0 else continueSignDaysSum%28
- #VIP 等级:{vipStatus}\n 签到:
- msg = f"+{growth}成长值\n 连续签到:{continueSignDaysSum}天\n 签到周期:{rouund_day}天/{rewardDay}天"
- except:
- msg = res.json()["data"]["signInfo"]["msg"]
- else:
- # print("(iqy)签到错误", res.content.decode())
- msg = res.json()["msg"]
- print(msg)
- return msg
- def queryTask(self):
- '''
- 获取 VIP 日常任务 和 taskCode(任务状态)
- '''
- url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask"
- params = {
- "P00001": self.P00001
- }
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- for item in res.json()["data"]["tasks"]["daily"]:
- self.taskList.append({
- "name": item["name"],
- "taskCode": item["taskCode"],
- "status": item["status"],
- "taskReward": item["taskReward"]["task_reward_growth"]
- })
- else:
- # print("(iqy)获取任务失败")
- pass
- return self
- def joinTask(self):
- """
- 遍历完成任务
- """
- url = "https://tc.vip.iqiyi.com/taskCenter/task/joinTask"
- params = {
- "P00001": self.P00001,
- "taskCode": "",
- "platform": "bb136ff4276771f3",
- "lang": "zh_CN"
- }
- # 遍历任务,仅做一次
- for item in self.taskList:
- if item["status"] == 2:
- params["taskCode"] = item["taskCode"]
- res = requests.get(url, params=params)
- print(res.text)
- def getReward(self):
- """
- 获取任务奖励
- :return: 返回信息
- """
- url = "https://tc.vip.iqiyi.com/taskCenter/task/getTaskRewards"
- params = {
- "P00001": self.P00001,
- "taskCode": "",
- "platform": "bb136ff4276771f3",
- "lang": "zh_CN"
- }
- # 遍历任务,领取奖励
- for item in self.taskList:
- if item["status"] == 0:
- params["taskCode"] = item["taskCode"]
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- self.growthTask += item["taskReward"]
- msg = f"+{self.growthTask}成长值"
- print(msg)
- return msg
- def draw(self, type):
- '''
- 查询抽奖次数(必),抽奖
- :param type: 类型。0 查询次数;1 抽奖
- :return: {status, msg, chance}
- '''
- url = "https://iface2.iqiyi.com/aggregate/3.0/lottery_activity"
- params = {
- "lottery_chance": 1,
- "app_k": "b398b8ccbaeacca840073a7ee9b7e7e6",
- "app_v": "11.6.5",
- "platform_id": 10,
- "dev_os": "8.0.0",
- "dev_ua": "FRD-AL10",
- "net_sts": 1,
- "qyid": "2655b332a116d2247fac3dd66a5285011102",
- "psp_uid": self.psp_uid,
- "psp_cki": self.P00001,
- "psp_status": 3,
- "secure_v": 1,
- "secure_p": "GPhone",
- "req_sn": round(time.time()*1000)
- }
- # 抽奖删除 lottery_chance 参数
- if type == 1:
- del params["lottery_chance"]
- res = requests.get(url, params=params)
- # print("(iqy)抽奖信息", res.json())
- if not res.json().get('code'):
- chance = int(res.json().get('daysurpluschance'))
- msg = res.json().get("awardName")
- return {"status": True, "msg": msg, "chance": chance}
- else:
- try:
- msg = res.json().get("kv", {}).get("msg")
- except:
- msg = res.json()["errorReason"]
- print(msg)
- return {"status": False, "msg": msg, "chance": 0}
- def sendMsg(key, content):
- '''
- 通过酷推(https://cp.xuthus.cc/)向 QQ 发送信息
- :param key: 酷推密钥
- :param content: 发送内容
- '''
- url = f"https://push.xuthus.cc/send/{key}"
- params = {
- "c": content
- }
- res = requests.get(url, params=params)
- def main_handler(event, context):
- P00001 = ""
- P00003 = ""
- skey = ""
- # 签到
- obj = IQY(P00001, P00003)
- msg1 = obj.sign()
- # 抽奖
- chance = obj.draw(0)["chance"]
- if chance:
- msg2 = ""
- for i in range(chance):
- ret = obj.draw(1)
- msg2 += ret["msg"]+";" if ret["status"] else ""
- else:
- msg2 = "抽奖机会不足"
- # 日常任务
- obj.queryTask().joinTask()
- msg3 = obj.queryTask().getReward()
- #查询用户信息
- msg_user = obj.userInformation()
- msg = f"【爱奇艺等级】\n{msg_user}\n-----------------------------\n【爱奇艺签到】\n 签到:{msg1}\n 任务:{msg3}\n 抽奖:{msg2}"
- sendMsg(skey, msg)
- return msg
server 酱版本
server 酱官网:https://sc.ftqq.com/
- # -*- coding: utf8 -*-
- #爱奇艺(IQIYI)官网,加载主页面,
- #开发者工具搜索获取 P00001,P00003 参数,修改 202 行和 203 行即可
- #skey 为 server 酱 SCKEY,修改 204 行即可
- import time
- import requests
- class IQY:
- '''
- 爱奇艺签到、抽奖、做日常任务(签到、任务仅限 VIP)
- *奖励:签 7 天奖 1 天,14 天奖 2 天,28 天奖 7 天;日常任务;随机成长值
- '''
- def __init__(self, P00001, psp_uid):
- '''
- :param P00001: 签到,任务,抽奖必要参数
- :param psp_uid: 抽奖必要参数
- '''
- self.P00001 = P00001
- self.psp_uid = psp_uid
- self.taskList = []
- self.growthTask = 0
- def userInformation(self):
- '''
- 用户信息查询
- '''
- time.sleep(3)
- url = "http://serv.vip.iqiyi.com/vipgrowth/query.action"
- params = {
- "P00001": self.P00001,
- }
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- try:
- res_data = res.json()["data"]
- #VIP 等级
- level = res_data["level"]
- #当前 VIP 成长值
- growthvalue = res_data["growthvalue"]
- #升级需要成长值
- distance = res_data["distance"]
- #VIP 到期时间
- deadline = res_data["deadline"]
- #今日成长值
- todayGrowthValue = res_data["todayGrowthValue"]
- msg = f"VIP 等级:{level}\n\r 当前成长值:{growthvalue}\n\r 升级需成长值:{distance}\n\r 今日成长值: +{todayGrowthValue}\n\rVIP 到期时间:{deadline}"
- except:
- msg = res.json()
- else:
- # print("(iqy)签到错误", res.content.decode())
- msg = res.json()
- print(msg)
- return msg
- def sign(self):
- '''
- VIP 签到
- '''
- url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask"
- params = {
- "P00001": self.P00001,
- "autoSign": "yes"
- }
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- try:
- growth = res.json()["data"]["signInfo"]["data"]["rewardMap"]["growth"]
- continueSignDaysSum = res.json()["data"]["signInfo"]["data"]["continueSignDaysSum"]
- #vipStatus = res.json()["data"]["userInfo"]["vipStatus"]
- rewardDay = 7 if continueSignDaysSum%28<=7 else (14 if continueSignDaysSum%28<=14 else 28)
- rouund_day = 28 if continueSignDaysSum%28 == 0 else continueSignDaysSum%28
- #VIP 等级:{vipStatus}\n 签到:
- msg = f"+{growth}成长值\n\r 连续签到:{continueSignDaysSum}天\n\r 签到周期:{rouund_day}天/{rewardDay}天"
- except:
- msg = res.json()["data"]["signInfo"]["msg"]
- else:
- # print("(iqy)签到错误", res.content.decode())
- msg = res.json()["msg"]
- print(msg)
- return msg
- def queryTask(self):
- '''
- 获取 VIP 日常任务 和 taskCode(任务状态)
- '''
- url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask"
- params = {
- "P00001": self.P00001
- }
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- for item in res.json()["data"]["tasks"]["daily"]:
- self.taskList.append({
- "name": item["name"],
- "taskCode": item["taskCode"],
- "status": item["status"],
- "taskReward": item["taskReward"]["task_reward_growth"]
- })
- else:
- # print("(iqy)获取任务失败")
- pass
- return self
- def joinTask(self):
- """
- 遍历完成任务
- """
- url = "https://tc.vip.iqiyi.com/taskCenter/task/joinTask"
- params = {
- "P00001": self.P00001,
- "taskCode": "",
- "platform": "bb136ff4276771f3",
- "lang": "zh_CN"
- }
- # 遍历任务,仅做一次
- for item in self.taskList:
- if item["status"] == 2:
- params["taskCode"] = item["taskCode"]
- res = requests.get(url, params=params)
- print(res.text)
- def getReward(self):
- """
- 获取任务奖励
- :return: 返回信息
- """
- url = "https://tc.vip.iqiyi.com/taskCenter/task/getTaskRewards"
- params = {
- "P00001": self.P00001,
- "taskCode": "",
- "platform": "bb136ff4276771f3",
- "lang": "zh_CN"
- }
- # 遍历任务,领取奖励
- for item in self.taskList:
- if item["status"] == 0:
- params["taskCode"] = item["taskCode"]
- res = requests.get(url, params=params)
- if res.json()["code"] == "A00000":
- self.growthTask += item["taskReward"]
- msg = f"+{self.growthTask}成长值"
- print(msg)
- return msg
- def draw(self, type):
- '''
- 查询抽奖次数(必),抽奖
- :param type: 类型。0 查询次数;1 抽奖
- :return: {status, msg, chance}
- '''
- url = "https://iface2.iqiyi.com/aggregate/3.0/lottery_activity"
- params = {
- "lottery_chance": 1,
- "app_k": "b398b8ccbaeacca840073a7ee9b7e7e6",
- "app_v": "11.6.5",
- "platform_id": 10,
- "dev_os": "8.0.0",
- "dev_ua": "FRD-AL10",
- "net_sts": 1,
- "qyid": "2655b332a116d2247fac3dd66a5285011102",
- "psp_uid": self.psp_uid,
- "psp_cki": self.P00001,
- "psp_status": 3,
- "secure_v": 1,
- "secure_p": "GPhone",
- "req_sn": round(time.time()*1000)
- }
- # 抽奖删除 lottery_chance 参数
- if type == 1:
- del params["lottery_chance"]
- res = requests.get(url, params=params)
- # print("(iqy)抽奖信息", res.json())
- if not res.json().get('code'):
- chance = int(res.json().get('daysurpluschance'))
- msg = res.json().get("awardName")
- return {"status": True, "msg": msg, "chance": chance}
- else:
- try:
- msg = res.json().get("kv", {}).get("msg")
- except:
- msg = res.json()["errorReason"]
- print(msg)
- return {"status": False, "msg": msg, "chance": 0}
- def sendMsg(key, content):
- '''
- 通过 serverkey 酱向微信发送信息
- :param key: serverkey 酱推送必要参数
- :param content: 发送内容
- '''
- notice = requests.get(url='https://sc.ftqq.com/{}.send?text=爱奇艺执行结果&desp={}'.format(key, str(content)))
- print(notice.text)
- # url = f"https://sc.ftqq.com/send/{key}"
- # params = {
- # "c": content
- # }
- # res = requests.get(url, params=params)
- def main_handler(event, context):
- P00001 = ""
- P00003 = ""
- skey = ""
- # 签到
- obj = IQY(P00001, P00003)
- msg1 = obj.sign()
- # 抽奖
- chance = obj.draw(0)["chance"]
- if chance:
- msg2 = ""
- for i in range(chance):
- ret = obj.draw(1)
- msg2 += ret["msg"]+";" if ret["status"] else ""
- else:
- msg2 = "抽奖机会不足"
- # 日常任务
- obj.queryTask().joinTask()
- msg3 = obj.queryTask().getReward()
- # 查询用户信息
- msg_user = obj.userInformation()
- fengexian = '-' * 30
- msg = f"【爱奇艺等级】\n\r{msg_user}\n\r{fengexian}\n\r【爱奇艺签到】\n\r 签到:{msg1}\n\r 抽奖:{msg2}\n\r 任务:{msg3}"
- sendMsg(skey, msg)
- return msg
- if __name__ == '__main__':
- print(main_handler())
以上代码来源互联网。