Suxiaoyu

GLaDOS自动签到并且把签到成功信息报告到钉钉群
签到脚本,签到成功结果,消息推送到钉钉群博主亲测可用~Python脚本每日自动签到GLaDOS,增加1天会员时间,...
扫描右侧二维码阅读全文
09
2023/04

GLaDOS自动签到并且把签到成功信息报告到钉钉群

签到脚本,签到成功结果,消息推送到钉钉群

博主亲测可用~

Python脚本每日自动签到GLaDOS,增加1天会员时间,并且把签到结果报告到钉钉群!

官方:GLaDOS 官方 githubGLaDOS 官网

如果您还没有注册的话,可以去这里注册,然后填写邀请码:DHFLJ-25LQF-90SQ4-U54F6。双方都可以获得3天奖励天数哦~

使用步骤如下

1、获取 cookie

GLaDOS 的网页上按 F12,进行请求,查看请求的 cookie。

2、设置 cookie

COOKIE 示例:

__cfduid=d526a2a21******c5521611332007; _ga=GA1.2.101***3158.1611332010; _gid=GA1.2.11***23.1611332010; koa:sess=eyJ1c2VyS******fZXhwaXJlIjoxNjM3MjU0NjEzMTEyLCJfbWF4QWd****yMDAwMDAwMH0=; koa:sess.sig=m6KAoBnv1s***DldbtvNw1v8; _gat_gtag_UA_10***600_2=1

执行脚本

cat bash.sh

#!/bin/bash

echo "---------GLaDos签到---------------"
# glados签到 https://www.glados.rocks/
/usr/bin/python3 /home/ghy/glados.py

定时任务

# 定时签到任务
0 9,12,18 * * * /usr/bin/bash /home/ghy/bash.sh >> /home/ghy/log/checkin_$(date +""\%Y-\%m-\%d_\%T"").log 2>&1

# 每隔15天删除30天以上的签到日志文件
* * */15 * *  /usr/bin/find /home/ghy/log/ -mtime +30 -name "*.log" -exec rm -rf {} \;

安装Python3

yum install python3

pip安装request模块

pip3 install requests -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

查看pip已经安装的模块

pip3 list
certifi (2022.12.7)
charset-normalizer (2.0.12)
idna (3.4)
pip (9.0.3)
requests (2.27.1)
setuptools (39.2.0)
urllib3 (1.26.15)

签到Python脚本

#!/usr/bin/python3
# -*- coding: utf-8 -*

import requests
import json

# 替换成你的glados账号cookie
cookie = 'xxxxxxx'
# webhook为你的钉钉机器人的webhook地址
webhook = 'xxxxxxx'

def main():
    checkin_res = checkin()
    if checkin_res == "Please Try Tomorrow":
        print("签到失败,请明天再试!")
    else:
        state_res = get_state()
        content = f'高宏宇,当前天数:{state_res} \n签到结果:{checkin_res}'
        send_dingtalk(content)

def checkin():
    url = 'https://glados.rocks/api/user/checkin'
    headers = {
        'cookie': cookie,
        'origin': 'https://glados.rocks',
        'referer': 'https://glados.rocks/console/checkin',
        'content-type': 'application/json;charset=UTF-8',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36'
    }
    data = {"token": "glados.network"}
    res = requests.post(url, headers=headers, data=json.dumps(data))
    return json.loads(res.text)['message']

def get_state():
    url = 'https://glados.rocks/api/user/status'
    headers = {
        'cookie': cookie,
        'origin': 'https://glados.rocks',
        'referer': 'https://glados.rocks/console/checkin',
        'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.75 Safari/537.36'
    }
    res = requests.get(url, headers=headers)
    return str(json.loads(res.text)['data']['leftDays']).split('.')[0]

def send_dingtalk(content):
    headers = {
        'Content-Type': 'application/json;charset=utf-8'
    }
    data = {
        "msgtype": "text",
        "text": {"content": content}
    }
    res = requests.post(url=webhook, headers=headers, data=json.dumps(data))
    print(res.text)

if __name__ == '__main__':
    main()
Last modification:April 9th, 2023 at 08:48 pm

Leave a Comment

One comment

  1. Suxiaoyu

    非常好使OωO