【QMSG推送】添加群推送支持

🔨 优化【爱奇艺】任务
This commit is contained in:
Sitoi 2021-03-16 09:24:39 +08:00
parent e1bf1dad24
commit 7af4df6926
9 changed files with 44 additions and 33 deletions

View File

@ -42,6 +42,7 @@ jobs:
SENDKEY: ${{secrets.SENDKEY}}
BARK_URL: ${{secrets.BARK_URL}}
QMSG_KEY: ${{secrets.QMSG_KEY}}
QMSG_TYPE: ${{secrets.QMSG_TYPE}}
TG_BOT_TOKEN: ${{secrets.TG_BOT_TOKEN}}
TG_USER_ID: ${{secrets.TG_USER_ID}}
COOLPUSHSKEY: ${{secrets.COOLPUSHSKEY}}

View File

@ -32,6 +32,7 @@ jobs:
SENDKEY: ${{secrets.SENDKEY}}
BARK_URL: ${{secrets.BARK_URL}}
QMSG_KEY: ${{secrets.QMSG_KEY}}
QMSG_TYPE: ${{secrets.QMSG_TYPE}}
TG_BOT_TOKEN: ${{secrets.TG_BOT_TOKEN}}
TG_USER_ID: ${{secrets.TG_USER_ID}}
COOLPUSHSKEY: ${{secrets.COOLPUSHSKEY}}

View File

@ -33,6 +33,7 @@ jobs:
SENDKEY: ${{secrets.SENDKEY}}
BARK_URL: ${{secrets.BARK_URL}}
QMSG_KEY: ${{secrets.QMSG_KEY}}
QMSG_TYPE: ${{secrets.QMSG_TYPE}}
TG_BOT_TOKEN: ${{secrets.TG_BOT_TOKEN}}
TG_USER_ID: ${{secrets.TG_USER_ID}}
COOLPUSHSKEY: ${{secrets.COOLPUSHSKEY}}

View File

@ -65,6 +65,7 @@ notice_map = {
"TG_BOT_TOKEN": "",
"TG_USER_ID": "",
"QMSG_KEY": "",
"QMSG_TYPE": "",
"COOLPUSHSKEY": "",
"COOLPUSHQQ": "",
"COOLPUSHWX": "",

View File

@ -5,6 +5,7 @@
"SENDKEY": "",
"BARK_URL": "",
"QMSG_KEY": "",
"QMSG_TYPE": "",
"TG_BOT_TOKEN": "",
"TG_USER_ID": "",
"COOLPUSHSKEY": "",

View File

@ -5,6 +5,7 @@ if [[ $SCKEY ]]; then echo "SCKEY 变量存在,并成功赋值" ;else SCKEY=""
if [[ $SENDKEY ]]; then echo "SENDKEY 变量存在,并成功赋值" ;else SENDKEY=""; fi;
if [[ $BARK_URL ]]; then echo "BARK_URL 变量存在,并成功赋值" ;else BARK_URL=""; fi;
if [[ $QMSG_KEY ]]; then echo "QMSG_KEY 变量存在,并成功赋值" ;else QMSG_KEY=""; fi;
if [[ $QMSG_TYPE ]]; then echo "QMSG_TYPE 变量存在,并成功赋值" ;else QMSG_TYPE=""; fi;
if [[ $TG_BOT_TOKEN ]]; then echo "TG_BOT_TOKEN 变量存在,并成功赋值" ;else TG_BOT_TOKEN=""; fi;
if [[ $TG_USER_ID ]]; then echo "TG_USER_ID 变量存在,并成功赋值" ;else TG_USER_ID=""; fi;
if [[ $COOLPUSHSKEY ]]; then echo "COOLPUSHSKEY 变量存在,并成功赋值" ;else COOLPUSHSKEY=""; fi;
@ -53,6 +54,7 @@ JSONSTR="{
\"SENDKEY\": \"${SENDKEY}\",
\"BARK_URL\": \"${BARK_URL}\",
\"QMSG_KEY\": \"${QMSG_KEY}\",
\"QMSG_TYPE\": \"${QMSG_TYPE}\",
\"TG_BOT_TOKEN\": \"${TG_BOT_TOKEN}\",
\"TG_USER_ID\": \"${TG_USER_ID}\",
\"COOLPUSHSKEY\": \"${COOLPUSHSKEY}\",

View File

@ -14,6 +14,7 @@
|_**SENDKEY**_|server 酱 TURBO 推送|推送|server 酱 TURBO 推送[官方文档](https://sct.ftqq.com/sendkey) ,填写 `SENDKEY` 代码即可|
|_**BARK_URL**_|BARK 推送|推送|BARK 推送[使用](https://github.com/Sitoi/dailycheckin/issues/29) ,填写 `BARK_URL` 即可,例如: `https://api.day.app/DxHcxxxxxRxxxxxxcm/` |
|_**QMSG_KEY**_|qmsg 酱推送|推送|qmsg 酱推送[官方文档](https://qmsg.zendee.cn/index.html) ,填写 `KEY` 代码即可|
|_**QMSG_TYPE**_|qmsg 酱推送|推送|qmsg 酱推送[官方文档](https://qmsg.zendee.cn/index.html) ,如果需要推送到群填写 `group`,其他的都推送到 QQ |
|_**TG_BOT_TOKEN**_|telegram 推送|推送|telegram 推送 `TG_BOT_TOKEN`|
|_**TG_USER_ID**_|telegram 推送|推送|telegram 推送 `TG_USER_ID`|
|_**COOLPUSHSKEY**_|Cool Push 推送|推送|[Cool Push](https://cp.xuthus.cc/) 推送的 `SKEY`|
@ -181,6 +182,7 @@
"SENDKEY": "",
"BARK_URL": "",
"QMSG_KEY": "",
"QMSG_TYPE": "",
"TG_BOT_TOKEN": "",
"TG_USER_ID": "",
"COOLPUSHSKEY": "",

View File

@ -26,10 +26,10 @@ class IQIYICheckIn:
time.sleep(3)
url = "http://serv.vip.iqiyi.com/vipgrowth/query.action"
params = {"P00001": p00001}
res = requests.get(url=url, params=params)
if res.json()["code"] == "A00000":
res = requests.get(url=url, params=params).json()
if res["code"] == "A00000":
try:
res_data = res.json().get("data", {})
res_data = res.get("data", {})
level = res_data.get("level", 0) # VIP 等级
growthvalue = res_data.get("growthvalue", 0) # 当前 VIP 成长值
distance = res_data.get("distance", 0) # 升级需要成长值
@ -43,7 +43,7 @@ class IQIYICheckIn:
msg = str(e)
print(msg)
else:
msg = res.json().get("msg")
msg = res.get("msg")
return msg
@staticmethod
@ -53,11 +53,11 @@ class IQIYICheckIn:
"""
url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask"
params = {"P00001": p00001, "autoSign": "yes"}
res = requests.get(url=url, params=params)
if res.json()["code"] == "A00000":
res = requests.get(url=url, params=params).json()
if res["code"] == "A00000":
try:
growth = res.json()["data"]["signInfo"]["data"]["rewardMap"]["growth"]
continue_sign_days_sum = res.json()["data"]["signInfo"]["data"]["continueSignDaysSum"]
growth = res["data"]["signInfo"]["data"]["rewardMap"]["growth"]
continue_sign_days_sum = res["data"]["signInfo"]["data"]["continueSignDaysSum"]
reward_day = (
7 if continue_sign_days_sum % 28 <= 7 else (14 if continue_sign_days_sum % 28 <= 14 else 28)
)
@ -65,9 +65,9 @@ class IQIYICheckIn:
msg = f"+{growth}成长值\n连续签到: {continue_sign_days_sum}\n签到周期: {rouund_day}天/{reward_day}"
except Exception as e:
print(e)
msg = res.json()["data"]["signInfo"]["msg"]
msg = res["data"]["signInfo"].get("msg")
else:
msg = res.json()["msg"]
msg = res.get("msg")
return msg
def query_user_task(self, p00001):
@ -76,9 +76,9 @@ class IQIYICheckIn:
"""
url = "https://tc.vip.iqiyi.com/taskCenter/task/queryUserTask"
params = {"P00001": p00001}
res = requests.get(url=url, params=params)
if res.json()["code"] == "A00000":
for item in res.json()["data"]["tasks"]["daily"]:
res = requests.get(url=url, params=params).json()
if res["code"] == "A00000":
for item in res["data"]["tasks"]["daily"]:
self.task_list.append(
{
"name": item["name"],
@ -110,19 +110,17 @@ class IQIYICheckIn:
growth_task = 0
for item in self.task_list:
if item["status"] == 0:
params["taskCode"] = item["taskCode"]
res = requests.get(url=url, params=params)
if res.json()["code"] == "A00000":
growth_task += item["taskReward"]
params["taskCode"] = item.get("taskCode")
requests.get(url=url, params=params)
elif item["status"] == 4:
requests.get(
url='https://tc.vip.iqiyi.com/taskCenter/task/notify',
params=params
)
params["taskCode"] = item["taskCode"]
res = requests.get(url=url, params=params)
if res.json()["code"] == "A00000":
growth_task += item["taskReward"]
params["taskCode"] = item.get("taskCode")
requests.get(url=url, params=params)
elif item["status"] == 1:
growth_task += item["taskReward"]
msg = f"+{growth_task}成长值"
return msg
@ -154,17 +152,17 @@ class IQIYICheckIn:
}
if draw_type == 1:
del params["lottery_chance"]
res = requests.get(url=url, params=params)
if not res.json().get("code"):
chance = int(res.json().get("daysurpluschance"))
msg = res.json().get("awardName")
res = requests.get(url=url, params=params).json()
if not res.get("code"):
chance = int(res.get("daysurpluschance"))
msg = res.get("awardName")
return {"status": True, "msg": msg, "chance": chance}
else:
try:
msg = res.json().get("kv", {}).get("msg")
msg = res.get("kv", {}).get("msg")
except Exception as e:
print(e)
msg = res.json()["errorReason"]
msg = res["errorReason"]
return {"status": False, "msg": msg, "chance": 0}
def main(self):
@ -179,9 +177,9 @@ class IQIYICheckIn:
else:
draw_msg = "抽奖机会不足"
task_msg = ""
for one in range(4):
self.query_user_task(p00001=p00001)
self.join_task(p00001=p00001)
self.query_user_task(p00001=p00001)
self.join_task(p00001=p00001)
for one in range(6):
task_msg = self.get_task_rewards(p00001=p00001)
time.sleep(10)
user_msg = self.user_information(p00001=p00001)

View File

@ -37,10 +37,13 @@ def message2coolpush(
return
def message2qmsg(qmsg_key, content):
def message2qmsg(qmsg_key, qmsg_type, content):
print("qmsg 酱推送开始")
params = {"msg": content}
requests.get(url=f"https://qmsg.zendee.cn/send/{qmsg_key}", params=params)
if qmsg_type == "group":
requests.get(url=f"https://qmsg.zendee.cn/group/{qmsg_key}", params=params)
else:
requests.get(url=f"https://qmsg.zendee.cn/send/{qmsg_key}", params=params)
return
@ -144,6 +147,7 @@ def push_message(content_list: list, notice_info: dict):
sckey = notice_info.get("sckey")
sendkey = notice_info.get("sendkey")
qmsg_key = notice_info.get("qmsg_key")
qmsg_type = notice_info.get("qmsg_type")
tg_bot_token = notice_info.get("tg_bot_token")
tg_user_id = notice_info.get("tg_user_id")
coolpushskey = notice_info.get("coolpushskey")
@ -169,7 +173,7 @@ def push_message(content_list: list, notice_info: dict):
for content in content_list:
if qmsg_key:
try:
message2qmsg(qmsg_key=qmsg_key, content=content)
message2qmsg(qmsg_key=qmsg_key, qmsg_type=qmsg_type, content=content)
except Exception as e:
print("qmsg 推送失败", e)
if coolpushskey: