Преглед на файлове

上传文件至 ''

上传
gaojiang преди 2 години
родител
ревизия
003e864660
променени са 1 файла, в които са добавени 74 реда и са изтрити 0 реда
  1. 74 0
      checkinNew.py

+ 74 - 0
checkinNew.py

@@ -0,0 +1,74 @@
+#!/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)