+
GameTimePause 加速器时长暂停脚本
+
+
+
+
+
+
+
+这是一项基于Python语言的Github Actions自动化定时脚本
+
+
+
+
+
+## 支持平台
+- [x] 雷神加速器
+- [ ] NN加速器
+
+如您使用其他以时间结算的加速器请向我提出issues
+## 使用教程
+1.请先Fork本项目。
+
+2.在仓库的Settings-Secrets-Actions中分别New repository secrets以下两个变量
+ - PHONE(填写您注册的手机号)
+ - PASSWORD(填写您的账户密码)
+ - TOKEN(可选 填写PUSHPLUS的Token)
+3.点击仓库的Actions,再点击“I understand my workflows, go ahead and enable them”的绿色按钮启用actions
+
+4.在左侧边栏找到“pause”并点击,再点击右侧的“Enable workflow”启用此action
+
+5.默认每天凌晨3点(UTC+8)执行定时任务(由于github action的特性,可能会延迟20分钟左右),如需修改请手动更改- cron: '0 19 * * *'字段,生成表达式可以用https://crontab.guru/
+
diff --git a/main.py b/main.py
new file mode 100644
index 0000000..c04d801
--- /dev/null
+++ b/main.py
@@ -0,0 +1,65 @@
+import requests
+import json
+import os
+import hashlib
+
+token = os.environ['TOKEN']
+user = os.environ['PHONE']
+# print('user:', user)
+password = os.environ['PASSWORD']
+
+
+# print('password:', password)
+def calculate_md5(input_string):
+ md5_hash = hashlib.md5(input_string.encode()).hexdigest()
+ return md5_hash
+
+
+md5_result = calculate_md5(password)
+# print("MD5 哈希值为:", md5_result)
+
+# 定义要发送的数据
+data = {
+ "username": user,
+ "password": md5_result,
+ "user_type": "0",
+ "src_channel": "guanwang",
+ "code": "8fAAIgr3HHmcX7JY",
+ "country_code": 86,
+ "lang": "en",
+ "os_type": 5
+}
+url = 'https://webapi.leigod.com/wap/login/bind'
+response = requests.post(url, json=data)
+if response.status_code == 200:
+ # print('返回值:', response.json())
+ account_token = response.json()['data']['login_info']['account_token']
+ # print('account_token:', account_token)
+ data = {
+ "account_token": account_token,
+ "lang": "en",
+ "os_type": 5
+ }
+ url = 'https://webapi.leigod.com/api/user/pause'
+ response = requests.post(url, json=data)
+ if response.status_code == 200:
+ state = response.json().get('msg', '')
+ text = '未知错误'
+
+ if state == 'Account has been paused, do not duplicate operation':
+ text = '您的加速器已经暂停过了'
+ elif state == 'OK': # 使用elif代替else if
+ text = '加速时长暂停成功'
+ else: # 最后一个条件应该是else
+ text = '未知错误:' + str(response.json())
+
+ print(text)
+
+ title = 'GameTimePause' # 改成你要的标题内容
+ content = text # 改成你要的正文内容
+ url = 'http://www.pushplus.plus/send?token=' + token + '&title=' + title + '&content=' + content
+ requests.get(url)
+ else:
+ print('请求失败:', response.text)
+else:
+ print('请求失败:', response.text)