Update kuake.py

pull/25/head
wd210010 5 months ago committed by GitHub
parent 6f1ac5cc36
commit c3982edd29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 17
      kuake.py

@ -2,7 +2,7 @@
# -- coding: utf-8 --
# -------------------------------
# @Author : github@wd210010 https://github.com/wd210010/only_for_happly
# @Time : 2023/10/4 16:23
# @Time : 2024/5/4 16:23
# -------------------------------
# cron "0 0 2 * * *" script-path=xxx.py,tag=匹配cron用
# const $ = new Env('夸克签到')
@ -14,6 +14,18 @@ import re
import sys
import requests
#推送函数
# 推送加
plustoken = os.getenv("plustoken")
def Push(contents):
# 推送加
headers = {'Content-Type': 'application/json'}
json = {"token": plustoken, 'title': '夸克签到', 'content': contents.replace('\n', '<br>'), "template": "json"}
resp = requests.post(f'http://www.pushplus.plus/send', json=json, headers=headers).json()
print('push+推送成功' if resp['code'] == 200 else 'push+推送失败')
# 获取环境变量
def get_env():
# 判断 COOKIE_QUARK是否存在于环境变量
@ -89,11 +101,13 @@ class Quark:
if growth_info["cap_sign"]["sign_daily"]:
log = f"✅ 执行签到: 今日已签到+{int(growth_info['cap_sign']['sign_daily_reward'] / 1024 / 1024)}MB,连签进度({growth_info['cap_sign']['sign_progress']}/{growth_info['cap_sign']['sign_target']})"
msg += log + "\n"
Push(contents=msg)
else:
sign, sign_return = self.get_growth_sign()
if sign:
log = f"✅ 执行签到: 今日签到+{int(sign_return / 1024 / 1024)}MB,连签进度({growth_info['cap_sign']['sign_progress'] + 1}/{growth_info['cap_sign']['sign_target']})"
msg += log + "\n"
Push(contents=msg)
else:
msg += f"✅ 执行签到: {sign_return}\n"
@ -103,6 +117,7 @@ class Quark:
def main():
msg = ""
global cookie_quark
cookie_quark = get_env()
print("✅检测到共", len(cookie_quark), "个夸克账号\n")

Loading…
Cancel
Save