PT打卡,待优化
This commit is contained in:
parent
50fa6ae8b8
commit
8a95d903da
|
@ -0,0 +1,79 @@
|
|||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
import requests
|
||||
|
||||
# 从 青龙面板 获取GlaDOS账号Cookie
|
||||
def get_cookies():
|
||||
if os.environ.get("GR_COOKIE"):
|
||||
print("已获取并使用Env环境 Cookie")
|
||||
if '&' in os.environ["GR_COOKIE"]:
|
||||
cookies = os.environ["GR_COOKIE"].split('&')
|
||||
elif '\n' in os.environ["GR_COOKIE"]:
|
||||
cookies = os.environ["GR_COOKIE"].split('\n')
|
||||
else:
|
||||
cookies = [os.environ["GR_COOKIE"]]
|
||||
else:
|
||||
print("未获取到正确的GlaDOS账号Cookie")
|
||||
return
|
||||
print(f"共获取到{len(cookies)}个GlaDOS账号Cookie\n")
|
||||
print(f"脚本执行时间(北京时区): {time.strftime('%Y/%m/%d %H:%M:%S', time.localtime())}\n")
|
||||
return cookies
|
||||
|
||||
|
||||
# 加载通知服务
|
||||
def load_send():
|
||||
cur_path = os.path.abspath(os.path.dirname(__file__))
|
||||
sys.path.append(cur_path)
|
||||
if os.path.exists(cur_path + "/sendNotify.py"):
|
||||
print("发送消息!")
|
||||
# try:
|
||||
# from sendNotify import send
|
||||
# return send
|
||||
# except Exception as e:
|
||||
# print(f"加载通知服务失败:{e}")
|
||||
# return None
|
||||
else:
|
||||
print("加载通知服务失败")
|
||||
return None
|
||||
|
||||
|
||||
'''
|
||||
对 PT 网站自动签
|
||||
'''
|
||||
attendances = {
|
||||
"https://www.icc2022.com": "c_secure_uid=MTk0OTI%3D; c_secure_pass=d7f655d5b8e90739f23620b9d24241e1; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D; PHPSESSID=em8dtq7r0t77tt1e0aq4m0of1o",
|
||||
"https://hdmayi.com": "Hm_lvt_6d8ca12c6bcfbd37eefefe2acf29b40d=1701424866; c_secure_uid=MjcyODg%3D; c_secure_pass=4e745ac26cb64631db97c605af6eef25; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D; Hm_lpvt_6d8ca12c6bcfbd37eefefe2acf29b40d=1701832678",
|
||||
"https://www.pttime.org": "c_lang_folder=chs; c_secure_uid=OTExNDU%3D; c_secure_pass=b4567a9950c3906657ed8baeb5a39b2d; c_secure_ssl=eWVhaA%3D%3D; c_secure_tracker_ssl=eWVhaA%3D%3D; c_secure_login=bm9wZQ%3D%3D; cf_clearance=RtffM86J.2AMKNqMKcF5WTGWOK11V7gklzY2rDRNu24-1701826018-0-1-d71c894c.1d67b4d8.801dd6ac-0.2.1701826018",
|
||||
}
|
||||
for key, value in attendances.items():
|
||||
res_txt = f"开始对 [{key}] 进行签到操作...,签到结果:"
|
||||
headers = {
|
||||
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
|
||||
'accept-language': 'zh,zh-CN;q=0.9',
|
||||
'cache-control': 'max-age=0',
|
||||
'cookie': value,
|
||||
'sec-ch-ua': '"Google Chrome";v="119", "Chromium";v="119", "Not?A_Brand";v="24"',
|
||||
'sec-ch-ua-mobile': '?0',
|
||||
'sec-ch-ua-platform': '"macOS"',
|
||||
'sec-fetch-dest': 'document',
|
||||
'sec-fetch-mode': 'navigate',
|
||||
'sec-fetch-site': 'same-origin',
|
||||
'sec-fetch-user': '?1',
|
||||
'upgrade-insecure-requests': '1',
|
||||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36',
|
||||
}
|
||||
|
||||
request_url = key + "/attendance.php"
|
||||
try:
|
||||
response_result = requests.get(request_url, headers=headers)
|
||||
|
||||
if '签到成功' in response_result.text:
|
||||
res_txt = res_txt + '签到成功!'
|
||||
# 发送成功通知
|
||||
else:
|
||||
res_txt = res_txt + '签到未成功!'
|
||||
except Exception as e:
|
||||
res_txt = res_txt + '签到出错!'
|
||||
print(res_txt)
|
Loading…
Reference in New Issue