| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- #!/usr/bin/env python3
- # -*- coding: utf-8 -*-
- """
- File: checkin.py(GLaDOS签到)
- Author: GJBlack
- cron: 40 0 * * *
- new Env('GLaDOS签到');
- Update: 2023/8/2
- """
- import requests
- import json
- import os
- import sys
- import time
- # GlaDOS签到
- def checkin(cookie):
- checkin_url= "https://glados.rocks/api/user/checkin"
- state_url= "https://glados.rocks/api/user/status"
- referer = 'https://glados.rocks/console/checkin'
- origin = "https://glados.rocks"
- useragent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36"
- payload={
- 'token': 'glados.one'
- }
- try:
- checkin = requests.post(checkin_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(state_url,headers={
- 'cookie': cookie ,
- 'referer': referer,
- 'origin':origin,
- 'user-agent':useragent})
- except Exception as e:
- print(f"签到失败,请检查网络:{e}")
- return None, None, None
-
- try:
- mess = checkin.json()['message']
- mail = state.json()['data']['email']
- time = state.json()['data']['leftDays'].split('.')[0]
- except Exception as e:
- print(f"解析登录结果失败:{e}")
- return None, None, None
-
- return mess, time, mail
- # 执行签到任务
- def run_checkin():
- cookies = ['这里写cookie']
- contents = []
- for cookie in cookies:
- ret, remain, email = checkin(cookie)
- if not ret:
- continue
-
- content = f"签到时间:{time.strftime('%Y-%m-%d-%H_%M_%S',time.localtime(time.time()))}\n账号:{email}\n签到结果:{ret}\n剩余天数:{remain}\n"
- print(content)
- contents.append(content)
- contents_str = "".join(contents)
- return contents_str
- if __name__ == '__main__':
- title = "GlaDOS签到通知"
- contents = run_checkin()
- #print(contents)
|