2024/03/21 需自行添加到青龙面板里面
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
File: flytea.py
Author: 乔大侠来了
Date: 2023/9/8 10:50
cron: 0 45 6 * * ?
new Env('飞客茶馆');
Description: 飞客茶馆,每日签到
Update: 2023/9/8 自行添加环境变量FLYTEA_COOKIE
"""
import os
import logging
import sys
import requests
import notify
import re
# 通知内容
message = []
def main():
cookies = ""
if cookies == "":
if os.environ.get("FLYTEA_COOKIE"):
cookies = os.environ.get("FLYTEA_COOKIE")
else:
logging.info("😢请在环境变量填写FLYTEA_COOKIE的值")
message.append("😢请在环境变量填写FLYTEA_COOKIE的值")
sys.exit()
for idx, cookie in enumerate(cookies.split("&")):
url = 'https://www.flyert.com/plugin.php?id=k_misign:sign&operation=qiandao&formhash=0b11b546&from=insign&is_ajax=1&infloat=yes&handlekey=qiandao&inajax=1&ajaxtarget=fwin_content_qiandao'
header = {
'authority':'www.flyert.com',
'method':'GET',
'path':'/plugin.php?id=k_misign:sign&operation=qiandao&formhash=0b11b546&from=insign&is_ajax=1&infloat=yes&handlekey=qiandao&inajax=1&ajaxtarget=fwin_content_qiandao',
'scheme':'https',
'Accept': '*/*',
'Accept-Encoding': 'utf-8',
'Accept-Language': 'zh-CN,zh;q=0.9,en;q=0.8',
'Cookie': cookie,
'Referer': 'https://www.flyert.com/forum.php?mod=forumdisplay&fid=319',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest'
}
respo = requests.get(url=url, headers=header).text
#print(respo)
pai1 = re.findall('签到成功', respo)
#print(pai1)
pai2 = re.findall('每天只能签到一次', respo)
#print(pai2)
if not pai1:
if not pai2:
message.append(f"😢第{idx+1}个账号,签到失败")
return "签到失败"
else :
message.append(f"😢第{idx+1}个账号,已签到")
return "已签到"
else:
message.append(f"😊第{idx+1}个账号,签到成功")
return "签到成功"
if __name__ == '__main__':
# 初始化日志系统
main()
# 发送通知
msg = '\n'.join(message)
notify.send("飞客茶馆", msg)