代码拉取完成,页面将自动刷新
# -*- coding: utf-8 -*-
"""
cron: 1 9 * * *
new Env('glados签到');
"""
import notify
import json
import os
import requests
cookie_name = 'glados'
def get_cookies():
cookies_list = []
cookies = os.getenv(cookie_name)
if cookies:
cookies_list = [cookie for cookie in cookies.split('&')]
return cookies_list
def main():
send_content = ''
cookies = get_cookies()
if (len(cookies) == 0):
notify.send(cookie_name, '环境变量中设置:' + cookie_name)
return
url = "https://glados.rocks/api/user/checkin"
url2 = "https://glados.rocks/api/user/status"
referer = 'https://glados.rocks/console/checkin'
origin = "https://glados.rocks"
useragent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
payload = {
'token': 'glados.one'
}
for cookie in cookies:
checkin = requests.post(url, headers={'cookie': cookie, 'referer': referer, 'origin': origin,
'user-agent': useragent,
'content-type': 'application/json;charset=UTF-8'},
data=json.dumps(payload))
state = requests.get(url2, headers={
'cookie': cookie, 'referer': referer, 'origin': origin, 'user-agent': useragent})
if checkin.status_code == 200:
# 解析返回的json数据
result = checkin.json()
# 获取签到结果
status = result.get('message')
# 获取账号当前状态
result = state.json()
# 获取剩余时间
leftdays = int(float(result['data']['leftDays']))
# 获取账号email
email = result['data']['email']
if 'Checkin!' in status:
message_status = "签到成功"
elif 'Please Try Tomorrow' in status:
message_status = "今日已签到"
else:
message_status = "签到失败,请检查..."
if leftdays is not None:
message_days = f"{leftdays} 天"
else:
message_days = "无法获取剩余天数信息"
else:
email = ""
message_status = "签到请求url失败, 请检查..."
message_days = "获取信息失败"
send_content = send_content + f'账号: {email} 签到情况: {message_status} 剩余天数: {message_days} \r\n'
notify.send(cookie_name + '签到结果', send_content)
if __name__ == '__main__':
main()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。