mirror of
https://github.com/CHERWING/CHERWIN_SCRIPTS.git
synced 2024-11-22 09:04:11 +08:00
更新脚本
This commit is contained in:
parent
5a1deccaa2
commit
fc39ef5c83
577
BWCJ.py
577
BWCJ.py
@ -1,286 +1,293 @@
|
|||||||
# !/usr/bin/python3
|
# !/usr/bin/python3
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "30 1 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "30 1 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('霸王茶姬小程序')
|
# const $ = new Env('霸王茶姬小程序')
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
# import CHERWIN_TOOLS
|
# import CHERWIN_TOOLS
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
IS_DEV = False
|
||||||
import DEV_ENV
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
if os.path.isfile('notify.py'):
|
import DEV_ENV
|
||||||
from notify import send
|
IS_DEV = True
|
||||||
print("加载通知服务成功!")
|
|
||||||
else:
|
if os.path.isfile('notify.py'):
|
||||||
print("加载通知服务失败!")
|
from notify import send
|
||||||
send_msg = ''
|
print("加载通知服务成功!")
|
||||||
one_msg=''
|
else:
|
||||||
def Log(cont=''):
|
print("加载通知服务失败!")
|
||||||
global send_msg,one_msg
|
send_msg = ''
|
||||||
print(cont)
|
one_msg=''
|
||||||
if cont:
|
def Log(cont=''):
|
||||||
one_msg += f'{cont}\n'
|
global send_msg,one_msg
|
||||||
send_msg += f'{cont}\n'
|
print(cont)
|
||||||
|
if cont:
|
||||||
class RUN:
|
one_msg += f'{cont}\n'
|
||||||
def __init__(self,info,index):
|
send_msg += f'{cont}\n'
|
||||||
global one_msg
|
|
||||||
one_msg = ''
|
class RUN:
|
||||||
split_info = info.split('@')
|
def __init__(self,info,index):
|
||||||
self.token = split_info[0]
|
global one_msg
|
||||||
len_split_info = len(split_info)
|
one_msg = ''
|
||||||
last_info = split_info[len_split_info - 1]
|
split_info = info.split('@')
|
||||||
self.send_UID = None
|
self.token = split_info[0]
|
||||||
if len_split_info > 0 and "UID_" in last_info:
|
len_split_info = len(split_info)
|
||||||
self.send_UID = last_info
|
last_info = split_info[len_split_info - 1]
|
||||||
self.index = index + 1
|
self.send_UID = None
|
||||||
Log(f"\n---------开始执行第{self.index}个账号>>>>>")
|
if len_split_info > 0 and "UID_" in last_info:
|
||||||
self.s = requests.session()
|
self.send_UID = last_info
|
||||||
self.s.verify = False
|
self.index = index + 1
|
||||||
|
Log(f"\n---------开始执行第{self.index}个账号>>>>>")
|
||||||
self.headers = {
|
self.s = requests.session()
|
||||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x6309080f) XWEB/8555',
|
self.s.verify = False
|
||||||
'work-wechat-userid': '',
|
|
||||||
'multi-store-id': '',
|
self.headers = {
|
||||||
'gdt-vid': '',
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x6309080f) XWEB/8555',
|
||||||
'qz-gtd': '',
|
'work-wechat-userid': '',
|
||||||
'scene': '1006',
|
'multi-store-id': '',
|
||||||
'Qm-From': 'wechat',
|
'gdt-vid': '',
|
||||||
'store-id': '49006',
|
'qz-gtd': '',
|
||||||
'Qm-User-Token': self.token,
|
'scene': '1006',
|
||||||
'channelCode': '',
|
'Qm-From': 'wechat',
|
||||||
'Qm-From-Type': 'catering',
|
'store-id': '49006',
|
||||||
'promotion-code': '',
|
'Qm-User-Token': self.token,
|
||||||
'work-staff-name': '',
|
'channelCode': '',
|
||||||
'work-staff-id': '',
|
'Qm-From-Type': 'catering',
|
||||||
'Accept': 'v=1.0',
|
'promotion-code': '',
|
||||||
'Accept-Encoding': 'gzip,compress,br,deflate',
|
'work-staff-name': '',
|
||||||
'Referer': 'https://servicewechat.com/wxafec6f8422cb357b/87/page-frame.html'
|
'work-staff-id': '',
|
||||||
}
|
'Accept': 'v=1.0',
|
||||||
self.s.headers.update(self.headers)
|
'Accept-Encoding': 'gzip,compress,br,deflate',
|
||||||
self.appid = 'wxafec6f8422cb357b'
|
'Referer': 'https://servicewechat.com/wxafec6f8422cb357b/87/page-frame.html'
|
||||||
self.activity_id='947079313798000641'
|
}
|
||||||
|
self.s.headers.update(self.headers)
|
||||||
def personal_info(self):
|
self.appid = 'wxafec6f8422cb357b'
|
||||||
personal_info_valid = False
|
self.activity_id='947079313798000641'
|
||||||
|
|
||||||
try:
|
def personal_info(self):
|
||||||
# 请求的参数
|
personal_info_valid = False
|
||||||
params = {'appid': self.appid}
|
|
||||||
|
try:
|
||||||
# 发送GET请求
|
# 请求的参数
|
||||||
response = self.s.get('https://webapi.qmai.cn/web/catering/crm/personal-info', json=params)
|
params = {'appid': self.appid}
|
||||||
result = response.json()
|
|
||||||
|
# 发送GET请求
|
||||||
# 检查请求是否成功
|
response = self.s.get('https://webapi.qmai.cn/web/catering/crm/personal-info', json=params)
|
||||||
if result.get('code','-1') == '0':
|
result = response.json()
|
||||||
personal_info_valid = True
|
|
||||||
# 提取个人信息
|
# 检查请求是否成功
|
||||||
mobile_phone = result['data']['mobilePhone'] if 'data' in result and 'mobilePhone' in result[
|
if result.get('code','-1') == '0':
|
||||||
'data'] else None
|
personal_info_valid = True
|
||||||
self.mobile_phone = mobile_phone[:3] + "*" * 4 + mobile_phone[7:]
|
# 提取个人信息
|
||||||
self.name = result['data']['name'] if 'data' in result and 'name' in result['data'] else None
|
mobile_phone = result['data']['mobilePhone'] if 'data' in result and 'mobilePhone' in result[
|
||||||
|
'data'] else None
|
||||||
Log(f"账号[{self.index}]登陆成功!\n用户名:【{self.name}】 \n手机号:【{self.mobile_phone}】")
|
self.mobile_phone = mobile_phone[:3] + "*" * 4 + mobile_phone[7:]
|
||||||
else:
|
self.name = result['data']['name'] if 'data' in result and 'name' in result['data'] else None
|
||||||
# 如果请求不成功,则打印错误信息
|
|
||||||
message = result.get('message', '')
|
Log(f"账号[{self.index}]登陆成功!\n用户名:【{self.name}】 \n手机号:【{self.mobile_phone}】")
|
||||||
Log(f'登录失败: {message}')
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
except Exception as e:
|
message = result.get('message', '')
|
||||||
# 捕获任何异常并打印
|
Log(f'登录失败: {message}')
|
||||||
print(e)
|
|
||||||
|
except Exception as e:
|
||||||
finally:
|
# 捕获任何异常并打印
|
||||||
# 最终返回请求是否成功的标志
|
print(e)
|
||||||
return personal_info_valid
|
|
||||||
|
finally:
|
||||||
def user_sign_statistics(self):
|
# 最终返回请求是否成功的标志
|
||||||
try:
|
return personal_info_valid
|
||||||
|
|
||||||
json_data = {
|
def user_sign_statistics(self):
|
||||||
'activityId': self.activity_id,
|
try:
|
||||||
'appid': self.appid
|
|
||||||
}
|
json_data = {
|
||||||
|
'activityId': self.activity_id,
|
||||||
# Send the POST request
|
'appid': self.appid
|
||||||
response = self.s.post('https://webapi.qmai.cn/web/cmk-center/sign/userSignStatistics', json=json_data)
|
}
|
||||||
result = response.json()
|
|
||||||
status_code = response.status_code
|
# Send the POST request
|
||||||
|
response = self.s.post('https://webapi.qmai.cn/web/cmk-center/sign/userSignStatistics', json=json_data)
|
||||||
# Check if the request was successful
|
result = response.json()
|
||||||
if result.get('code', status_code) == 0:
|
status_code = response.status_code
|
||||||
data = result.get('data', {})
|
|
||||||
sign_days = data.get('signDays', '')
|
# Check if the request was successful
|
||||||
sign_status = data.get('signStatus', 0) == 1
|
if result.get('code', status_code) == 0:
|
||||||
Log(f'新版签到今天{"已" if sign_status else "未"}签到, 已连续签到{sign_days}天')
|
data = result.get('data', {})
|
||||||
if not sign_status:
|
sign_days = data.get('signDays', '')
|
||||||
self.take_part_in_sign()
|
sign_status = data.get('signStatus', 0) == 1
|
||||||
return sign_status, sign_days
|
Log(f'新版签到今天{"已" if sign_status else "未"}签到, 已连续签到{sign_days}天')
|
||||||
else:
|
if not sign_status:
|
||||||
message = result.get('message', '')
|
self.take_part_in_sign()
|
||||||
Log(f'查询新版签到失败: {message}')
|
return sign_status, sign_days
|
||||||
return False, 0
|
else:
|
||||||
except Exception as e:
|
message = result.get('message', '')
|
||||||
print(e)
|
Log(f'查询新版签到失败: {message}')
|
||||||
return False, 0
|
return False, 0
|
||||||
|
except Exception as e:
|
||||||
def take_part_in_sign(self):
|
print(e)
|
||||||
try:
|
return False, 0
|
||||||
json_data = {
|
|
||||||
'activityId': self.activity_id,
|
def take_part_in_sign(self):
|
||||||
'appid': self.appid
|
try:
|
||||||
}
|
json_data = {
|
||||||
response = self.s.post('https://webapi.qmai.cn/web/cmk-center/sign/takePartInSign', json=json_data)
|
'activityId': self.activity_id,
|
||||||
result = response.json()
|
'appid': self.appid
|
||||||
status_code = response.status_code
|
}
|
||||||
|
response = self.s.post('https://webapi.qmai.cn/web/cmk-center/sign/takePartInSign', json=json_data)
|
||||||
if result.get('code', status_code) == 0:
|
result = response.json()
|
||||||
data = result.get('data',{})
|
status_code = response.status_code
|
||||||
rewardDetailList = data.get('rewardDetailList',[{}])
|
|
||||||
if rewardDetailList:
|
if result.get('code', status_code) == 0:
|
||||||
rewardName = rewardDetailList[0].get('rewardName','')
|
data = result.get('data',{})
|
||||||
sendNum = rewardDetailList[0].get('sendNum','')
|
rewardDetailList = data.get('rewardDetailList',[{}])
|
||||||
Log(f'新版签到成功,获得【{sendNum}】{rewardName}')
|
if rewardDetailList:
|
||||||
return True
|
rewardName = rewardDetailList[0].get('rewardName','')
|
||||||
else:
|
sendNum = rewardDetailList[0].get('sendNum','')
|
||||||
Log(f'签到失败:【{result.get("message","")}】')
|
Log(f'新版签到成功,获得【{sendNum}】{rewardName}')
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
message = result.get('message', '')
|
Log(f'签到失败:【{result.get("message","")}】')
|
||||||
Log(f'新版签到失败: {message}')
|
return True
|
||||||
return False
|
else:
|
||||||
except Exception as e:
|
message = result.get('message', '')
|
||||||
print(e)
|
Log(f'新版签到失败: {message}')
|
||||||
return False
|
return False
|
||||||
|
except Exception as e:
|
||||||
def points_info(self):
|
print(e)
|
||||||
try:
|
return False
|
||||||
json_data = {
|
|
||||||
'appid': self.appid
|
def points_info(self):
|
||||||
}
|
try:
|
||||||
|
json_data = {
|
||||||
response = self.s.post('https://webapi.qmai.cn/web/catering/crm/points-info', json=json_data)
|
'appid': self.appid
|
||||||
result = response.json()
|
}
|
||||||
status_code = response.status_code
|
|
||||||
|
response = self.s.post('https://webapi.qmai.cn/web/catering/crm/points-info', json=json_data)
|
||||||
if result.get('code', status_code) == '0':
|
result = response.json()
|
||||||
data = result.get('data', {})
|
status_code = response.status_code
|
||||||
soon_expired_points = data.get('soonExpiredPoints', 0)
|
|
||||||
total_points = data.get('totalPoints', 0)
|
if result.get('code', status_code) == '0':
|
||||||
expired_time = data.get('expiredTime', '')
|
data = result.get('data', {})
|
||||||
|
soon_expired_points = data.get('soonExpiredPoints', 0)
|
||||||
if soon_expired_points:
|
total_points = data.get('totalPoints', 0)
|
||||||
Log(f'有【{soon_expired_points}】积分将于( {expired_time})过期')
|
expired_time = data.get('expiredTime', '')
|
||||||
|
|
||||||
Log(f'当前积分: 【{total_points}】')
|
if soon_expired_points:
|
||||||
return total_points, soon_expired_points, expired_time
|
Log(f'有【{soon_expired_points}】积分将于( {expired_time})过期')
|
||||||
else:
|
|
||||||
message = result.get('message', '')
|
Log(f'当前积分: 【{total_points}】')
|
||||||
Log(f'查询积分失败: {message}')
|
return total_points, soon_expired_points, expired_time
|
||||||
return None
|
else:
|
||||||
except Exception as e:
|
message = result.get('message', '')
|
||||||
print(e)
|
Log(f'查询积分失败: {message}')
|
||||||
return False
|
return None
|
||||||
|
except Exception as e:
|
||||||
def main(self):
|
print(e)
|
||||||
if not self.personal_info() :
|
return False
|
||||||
Log("用户信息无效,请更新CK")
|
|
||||||
return False
|
def main(self):
|
||||||
self.user_sign_statistics()
|
if not self.personal_info() :
|
||||||
self.points_info()
|
Log("用户信息无效,请更新CK")
|
||||||
self.sendMsg()
|
self.sendMsg()
|
||||||
return True
|
return False
|
||||||
|
self.user_sign_statistics()
|
||||||
def sendMsg(self, help=False):
|
self.points_info()
|
||||||
if self.send_UID:
|
self.sendMsg()
|
||||||
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
return True
|
||||||
print(push_res)
|
|
||||||
|
def sendMsg(self, help=False):
|
||||||
|
if self.send_UID:
|
||||||
def down_file(filename, file_url):
|
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
||||||
print(f'开始下载:{filename},下载地址:{file_url}')
|
print(push_res)
|
||||||
try:
|
|
||||||
response = requests.get(file_url, verify=False, timeout=10)
|
|
||||||
response.raise_for_status()
|
def down_file(filename, file_url):
|
||||||
with open(filename + '.tmp', 'wb') as f:
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
f.write(response.content)
|
try:
|
||||||
print(f'【{filename}】下载完成!')
|
response = requests.get(file_url, verify=False, timeout=10)
|
||||||
|
response.raise_for_status()
|
||||||
# 检查临时文件是否存在
|
with open(filename + '.tmp', 'wb') as f:
|
||||||
temp_filename = filename + '.tmp'
|
f.write(response.content)
|
||||||
if os.path.exists(temp_filename):
|
print(f'【{filename}】下载完成!')
|
||||||
# 删除原有文件
|
|
||||||
if os.path.exists(filename):
|
# 检查临时文件是否存在
|
||||||
os.remove(filename)
|
temp_filename = filename + '.tmp'
|
||||||
# 重命名临时文件
|
if os.path.exists(temp_filename):
|
||||||
os.rename(temp_filename, filename)
|
# 删除原有文件
|
||||||
print(f'【{filename}】重命名成功!')
|
if os.path.exists(filename):
|
||||||
return True
|
os.remove(filename)
|
||||||
else:
|
# 重命名临时文件
|
||||||
print(f'【{filename}】临时文件不存在!')
|
os.rename(temp_filename, filename)
|
||||||
return False
|
print(f'【{filename}】重命名成功!')
|
||||||
except Exception as e:
|
return True
|
||||||
print(f'【{filename}】下载失败:{str(e)}')
|
else:
|
||||||
return False
|
print(f'【{filename}】临时文件不存在!')
|
||||||
|
return False
|
||||||
def import_Tools():
|
except Exception as e:
|
||||||
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
import CHERWIN_TOOLS
|
return False
|
||||||
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
|
||||||
|
def import_Tools():
|
||||||
|
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
if __name__ == '__main__':
|
import CHERWIN_TOOLS
|
||||||
APP_NAME = '霸王茶姬小程序'
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
||||||
ENV_NAME = 'BWCJ'
|
|
||||||
CK_NAME = 'qm-user-token'
|
|
||||||
print(f'''
|
if __name__ == '__main__':
|
||||||
✨✨✨ {APP_NAME}签到✨✨✨
|
APP_NAME = '霸王茶姬小程序'
|
||||||
✨ 功能:
|
ENV_NAME = 'BWCJ'
|
||||||
积分签到
|
CK_NAME = 'qm-user-token'
|
||||||
✨ 抓包步骤:
|
print(f'''
|
||||||
打开{APP_NAME}
|
✨✨✨ {APP_NAME}签到✨✨✨
|
||||||
授权登陆
|
✨ 功能:
|
||||||
打开抓包工具
|
积分签到
|
||||||
找请求头带{CK_NAME}的URl
|
✨ 抓包步骤:
|
||||||
复制里面的{CK_NAME}参数值
|
打开{APP_NAME}
|
||||||
✨ ✨✨wxpusher一对一推送功能,
|
授权登陆
|
||||||
✨需要定义变量export WXPUSHER=wxpusher的app_token,不设置则不启用wxpusher一对一推送
|
打开抓包工具
|
||||||
✨需要在{ENV_NAME}变量最后添加@wxpusher的UID
|
找请求头带{CK_NAME}的URl
|
||||||
参数示例:Fks8FqmiTksnmZSj2fDvxxxxxxxxx@UID_xxxxx
|
复制里面的{CK_NAME}参数值
|
||||||
✨ 设置青龙变量:
|
✨ ✨✨wxpusher一对一推送功能,
|
||||||
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
✨需要定义变量export WXPUSHER=wxpusher的app_token,不设置则不启用wxpusher一对一推送
|
||||||
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
✨需要在{ENV_NAME}变量最后添加@wxpusher的UID
|
||||||
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
参数示例:Fks8FqmiTksnmZSj2fDvxxxxxxxxx@UID_xxxxx
|
||||||
✨ 推荐cron:5 8 * * *
|
✨ 设置青龙变量:
|
||||||
✨✨✨ @Author CHERWIN✨✨✨
|
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
||||||
''')
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
local_script_name = os.path.basename(__file__)
|
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
||||||
local_version = '2024.04.06'
|
✨ 推荐cron:5 8 * * *
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
import_Tools()
|
''')
|
||||||
else:
|
local_script_name = os.path.basename(__file__)
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
local_version = '2024.05.15'
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
exit()
|
import_Tools()
|
||||||
print(TIPS)
|
else:
|
||||||
token = ''
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
token = ENV if ENV else token
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
if not token:
|
import_Tools()
|
||||||
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
else:
|
||||||
exit()
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
exit()
|
||||||
# print(tokens)
|
print(TIPS)
|
||||||
if len(tokens) > 0:
|
token = ''
|
||||||
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
token = ENV if ENV else token
|
||||||
for index, infos in enumerate(tokens):
|
if not token:
|
||||||
run_result = RUN(infos, index).main()
|
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
||||||
if not run_result: continue
|
exit()
|
||||||
|
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
||||||
|
# print(tokens)
|
||||||
|
if len(tokens) > 0:
|
||||||
|
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
||||||
|
for index, infos in enumerate(tokens):
|
||||||
|
run_result = RUN(infos, index).main()
|
||||||
|
if not run_result: continue
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
957
CHERWIN_TOOLS.py
957
CHERWIN_TOOLS.py
@ -1,505 +1,452 @@
|
|||||||
import json
|
import hashlib
|
||||||
import os
|
import json
|
||||||
import importlib.util
|
import os
|
||||||
import subprocess
|
import importlib.util
|
||||||
import sys
|
import random
|
||||||
import requests
|
import string
|
||||||
from http import HTTPStatus
|
import subprocess
|
||||||
|
import sys
|
||||||
NOW_TOOLS_VERSION = '2024.05.04'
|
import time
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
import requests
|
||||||
import DEV_ENV
|
from http import HTTPStatus
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
# 尝试导入包
|
NOW_TOOLS_VERSION = '2024.05.15'
|
||||||
def import_or_install(package_name, import_name=None):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
# 如果传入了 import_name,则使用它来检查模块,否则默认与包名相同
|
import DEV_ENV
|
||||||
import_name = import_name or package_name
|
IS_DEV = True
|
||||||
|
else:
|
||||||
try:
|
IS_DEV = False
|
||||||
# 检查模块是否已安装
|
|
||||||
package_spec = importlib.util.find_spec(import_name)
|
|
||||||
|
# 尝试导入包
|
||||||
if package_spec is None:
|
def import_or_install(package_name, import_name=None):
|
||||||
print(f"{package_name} 模块未安装. 开始安装...")
|
# 如果传入了 import_name,则使用它来检查模块,否则默认与包名相同
|
||||||
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package_name])
|
import_name = import_name or package_name
|
||||||
print(f"{package_name} 模块安装完成。")
|
try:
|
||||||
else:
|
# 检查模块是否已安装
|
||||||
print(f"{package_name} 模块已安装。")
|
package_spec = importlib.util.find_spec(import_name)
|
||||||
|
if package_spec is None:
|
||||||
# 尝试导入模块检查是否安装成功
|
print(f"{package_name} 模块未安装. 开始安装...")
|
||||||
__import__(import_name)
|
subprocess.check_call([sys.executable, '-m', 'pip', 'install', package_name])
|
||||||
module = importlib.import_module(import_name)
|
print(f"{package_name} 模块安装完成。")
|
||||||
print(f"{import_name} 模块导入成功.")
|
else:
|
||||||
return module
|
print(f"{package_name} 模块已安装。")
|
||||||
except ImportError as e:
|
# 尝试导入模块检查是否安装成功
|
||||||
print(f"无法导入 {import_name} 模块. 错误信息: {e}")
|
__import__(import_name)
|
||||||
except subprocess.CalledProcessError as e:
|
module = importlib.import_module(import_name)
|
||||||
print(f"安装 {package_name} 模块时出错. 错误信息: {e}")
|
print(f"{import_name} 模块导入成功.")
|
||||||
except Exception as e:
|
return module
|
||||||
print(f"处理 {package_name} 模块时发生错误. 错误信息: {e}")
|
except ImportError as e:
|
||||||
|
print(f"无法导入 {import_name} 模块. 错误信息: {e}")
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
def SAVE_INVITE_CODE(file_name, new_data):
|
print(f"安装 {package_name} 模块时出错. 错误信息: {e}")
|
||||||
# 读取现有JSON文件(如果存在)
|
except Exception as e:
|
||||||
try:
|
print(f"处理 {package_name} 模块时发生错误. 错误信息: {e}")
|
||||||
with open(file_name, 'r', encoding='utf-8') as file:
|
|
||||||
data = json.load(file)
|
|
||||||
except FileNotFoundError:
|
def SAVE_INVITE_CODE(file_name, new_data):
|
||||||
# 如果文件不存在,创建所需目录并一个新的空JSON文件
|
# 读取现有JSON文件(如果存在)
|
||||||
directory = os.path.dirname(file_name)
|
try:
|
||||||
if not os.path.exists(directory):
|
with open(file_name, 'r', encoding='utf-8') as file:
|
||||||
os.makedirs(directory)
|
data = json.load(file)
|
||||||
data = {}
|
except FileNotFoundError:
|
||||||
|
# 如果文件不存在,创建所需目录并一个新的空JSON文件
|
||||||
# 检查是否已存在相同的键,如果存在,合并数据
|
directory = os.path.dirname(file_name)
|
||||||
for key, value in new_data.items():
|
if not os.path.exists(directory):
|
||||||
if key in data:
|
os.makedirs(directory)
|
||||||
# 如果键已存在,将新数据合并到现有数据中
|
data = {}
|
||||||
data[key].update(value)
|
# 检查是否已存在相同的键,如果存在,合并数据
|
||||||
else:
|
for key, value in new_data.items():
|
||||||
# 如果键不存在,直接插入新数据
|
if key in data:
|
||||||
data[key] = value
|
# 如果键已存在,将新数据合并到现有数据中
|
||||||
|
data[key].update(value)
|
||||||
# 将更新后的数据写入JSON文件
|
else:
|
||||||
with open(file_name, 'w', encoding='utf-8') as file:
|
# 如果键不存在,直接插入新数据
|
||||||
json.dump(data, file, indent=4)
|
data[key] = value
|
||||||
|
# 将更新后的数据写入JSON文件
|
||||||
|
with open(file_name, 'w', encoding='utf-8') as file:
|
||||||
# 将参数转换为字典
|
json.dump(data, file, indent=4)
|
||||||
def create_dict_from_string(self, data_string):
|
|
||||||
params = {}
|
|
||||||
key_value_pairs = data_string.split(',')
|
# 将参数转换为字典
|
||||||
for pair in key_value_pairs:
|
def create_dict_from_string(self, data_string):
|
||||||
key, value = pair.split('=')
|
params = {}
|
||||||
params[key] = value
|
key_value_pairs = data_string.split(',')
|
||||||
return params
|
for pair in key_value_pairs:
|
||||||
|
key, value = pair.split('=')
|
||||||
|
params[key] = value
|
||||||
def compare_versions(local_version, server_version):
|
return params
|
||||||
local_parts = local_version.split('.') # 将本地版本号拆分成数字部分
|
|
||||||
server_parts = server_version.split('.') # 将服务器版本号拆分成数字部分
|
|
||||||
|
def compare_versions(local_version, server_version):
|
||||||
for l, s in zip(local_parts, server_parts):
|
local_parts = local_version.split('.') # 将本地版本号拆分成数字部分
|
||||||
if int(l) < int(s):
|
server_parts = server_version.split('.') # 将服务器版本号拆分成数字部分
|
||||||
return True # 当前版本低于服务器版本
|
for l, s in zip(local_parts, server_parts):
|
||||||
elif int(l) > int(s):
|
if int(l) < int(s):
|
||||||
return False # 当前版本高于服务器版本
|
return True
|
||||||
|
# 当前版本低于服务器版本
|
||||||
# 如果上述循环没有返回结果,则表示当前版本与服务器版本的数字部分完全相同
|
elif int(l) > int(s):
|
||||||
if len(local_parts) < len(server_parts):
|
return False
|
||||||
return True # 当前版本位数较短,即版本号形如 x.y 比 x.y.z 低
|
# 当前版本高于服务器版本
|
||||||
else:
|
# 如果上述循环没有返回结果,则表示当前版本与服务器版本的数字部分完全相同
|
||||||
return False # 当前版本与服务器版本相同或更高
|
if len(local_parts) < len(server_parts):
|
||||||
|
return True # 当前版本位数较短,即版本号形如 x.y 比 x.y.z 低
|
||||||
|
else:
|
||||||
def CHECK_UPDATE(local_version, server_version_url, server_script_url, script_filename):
|
return False # 当前版本与服务器版本相同或更高
|
||||||
"""
|
|
||||||
检查版本并更新
|
|
||||||
|
|
||||||
Args:
|
def CHECK_UPDATE_NEW(local_version, server_version, server_script_url, script_filename, server_version_url=None,
|
||||||
local_version (str): 本地版本号
|
APP_NAME=None):
|
||||||
server_version_url (str): 服务器版本文件地址
|
"""
|
||||||
server_script_url (str): 服务器脚本地址
|
检查版本并更新
|
||||||
script_filename (str): 要保存的脚本文件名
|
|
||||||
|
Args:
|
||||||
Returns:
|
local_version (str): 本地版本号
|
||||||
bool: 是否进行了更新操作
|
server_version_url (str): 服务器版本文件地址
|
||||||
"""
|
server_script_url (str): 服务器脚本地址
|
||||||
try:
|
script_filename (str): 要保存的脚本文件名
|
||||||
# 获取服务器版本号
|
|
||||||
response = requests.get(server_version_url, verify=False)
|
Returns:
|
||||||
response.raise_for_status() # Raises an HTTPError for bad responses
|
bool: 是否进行了更新操作
|
||||||
# print(response.text)
|
"""
|
||||||
server_version = response.text.strip() # 去除首尾空格
|
print(f'当前检测:【{script_filename}】')
|
||||||
print(f'当前版本:【{local_version}】')
|
try:
|
||||||
print(f'服务器版本:【{server_version}】')
|
if server_version_url:
|
||||||
|
# 获取服务器版本号
|
||||||
if compare_versions(local_version, server_version):
|
response = requests.get(server_version_url, verify=False)
|
||||||
# 需要更新,下载服务器脚本
|
response.raise_for_status() # Raises an HTTPError for bad responses
|
||||||
AUTO_UPDATE = os.getenv("SCRIPT_UPDATE", "True").lower() != "false"
|
# print(response.text)
|
||||||
# print(AUTO_UPDATE)
|
server_version = response.text.strip() # 去除首尾空格
|
||||||
if AUTO_UPDATE:
|
if "code" in server_version:
|
||||||
print(">>>>>>>发现新版本的脚本,默认自动更新,准备更新...")
|
print('【获取远程版本号失败,设为本地同版本】')
|
||||||
print(">>>>>>>禁用更新请定义变量export SCRIPT_UPDATE = 'False'")
|
server_version = local_version
|
||||||
response_script = requests.get(server_script_url, verify=False, timeout=10)
|
if not server_version: server_version = NOW_TOOLS_VERSION
|
||||||
response_script.raise_for_status()
|
print(f'本地版本:【{local_version}】')
|
||||||
|
print(f'服务器版本:【{server_version}】')
|
||||||
with open(script_filename, 'wb') as f:
|
if compare_versions(local_version, server_version):
|
||||||
f.write(response_script.content)
|
# 需要更新,下载服务器脚本
|
||||||
print(f'{script_filename} 下载完成!')
|
AUTO_UPDATE = os.getenv("SCRIPT_UPDATE", "True").lower() != "false"
|
||||||
print(f'尝试运行新脚本')
|
# print(AUTO_UPDATE)
|
||||||
import subprocess, sys
|
if AUTO_UPDATE:
|
||||||
# 使用 sys.executable 获取 Python 可执行文件的完整路径
|
print(">>>>>>>发现新版本的脚本,默认自动更新,准备更新...")
|
||||||
python_executable = sys.executable
|
print(">>>>>>>禁用更新请定义变量export SCRIPT_UPDATE = 'False'")
|
||||||
subprocess.Popen([python_executable, script_filename])
|
if down_file(script_filename, server_script_url):
|
||||||
|
print(f'请重新运行新脚本\n')
|
||||||
else:
|
return True
|
||||||
print(">>>>>>>发现新版本的脚本,您禁用了自动更新,如需启用请删除变量SCRIPT_UPDATE")
|
else:
|
||||||
else:
|
print(">>>>>>>发现新版本的脚本,您禁用了自动更新,如需启用请删除变量SCRIPT_UPDATE\n")
|
||||||
print(f'当前版本高于或等于服务器版本')
|
else:
|
||||||
|
print(f'无需更新\n')
|
||||||
except requests.exceptions.RequestException as e:
|
return False
|
||||||
print(f'发生网络错误:{e}')
|
except requests.exceptions.RequestException as e:
|
||||||
|
print(f'发生网络错误:{e}')
|
||||||
except Exception as e:
|
server_base_url = f"https://py.cherwin.cn/{APP_NAME}/"
|
||||||
print(f'发生未知错误:{e}')
|
server_script_url = f"{server_base_url}{script_filename}"
|
||||||
|
CHECK_UPDATE_NEW(local_version, server_version, server_script_url, script_filename, APP_NAME=APP_NAME)
|
||||||
return False # 返回 False 表示没有进行更新操作
|
except Exception as e:
|
||||||
|
print(f'发生未知错误:{e}')
|
||||||
|
return False # 返回 False 表示没有进行更新操作
|
||||||
def CHECK_UPDATE_NEW(local_version, server_version, server_script_url, script_filename, server_version_url=None,
|
|
||||||
APP_NAME=None):
|
|
||||||
"""
|
def down_file(filename, file_url):
|
||||||
检查版本并更新
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
|
try:
|
||||||
Args:
|
response = requests.get(file_url, verify=False, timeout=10)
|
||||||
local_version (str): 本地版本号
|
response.raise_for_status()
|
||||||
server_version_url (str): 服务器版本文件地址
|
with open(filename + '.tmp', 'wb') as f:
|
||||||
server_script_url (str): 服务器脚本地址
|
f.write(response.content)
|
||||||
script_filename (str): 要保存的脚本文件名
|
print(f'【{filename}】下载完成!')
|
||||||
|
# 检查临时文件是否存在
|
||||||
Returns:
|
temp_filename = filename + '.tmp'
|
||||||
bool: 是否进行了更新操作
|
if os.path.exists(temp_filename):
|
||||||
"""
|
# 删除原有文件
|
||||||
print(f'当前检测:【{script_filename}】')
|
if os.path.exists(filename):
|
||||||
try:
|
os.remove(filename)
|
||||||
if server_version_url:
|
# 重命名临时文件
|
||||||
# 获取服务器版本号
|
os.rename(temp_filename, filename)
|
||||||
response = requests.get(server_version_url, verify=False)
|
print(f'【{filename}】重命名成功!')
|
||||||
response.raise_for_status() # Raises an HTTPError for bad responses
|
return True
|
||||||
# print(response.text)
|
else:
|
||||||
server_version = response.text.strip() # 去除首尾空格
|
print(f'【{filename}】临时文件不存在!')
|
||||||
if "code" in server_version:
|
return False
|
||||||
print('【获取远程版本号失败,设为本地同版本】')
|
except Exception as e:
|
||||||
server_version = local_version
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
if not server_version: server_version = NOW_TOOLS_VERSION
|
return False
|
||||||
print(f'本地版本:【{local_version}】')
|
|
||||||
print(f'服务器版本:【{server_version}】')
|
|
||||||
|
def get_AuthorInviteCode(url):
|
||||||
if compare_versions(local_version, server_version):
|
global AuthorCode
|
||||||
# 需要更新,下载服务器脚本
|
try:
|
||||||
AUTO_UPDATE = os.getenv("SCRIPT_UPDATE", "True").lower() != "false"
|
response = requests.get(url, verify=False, timeout=10)
|
||||||
# print(AUTO_UPDATE)
|
if response.status_code == 200:
|
||||||
if AUTO_UPDATE:
|
content = json.loads(response.text)
|
||||||
print(">>>>>>>发现新版本的脚本,默认自动更新,准备更新...")
|
AuthorCode = list(content.values())
|
||||||
print(">>>>>>>禁用更新请定义变量export SCRIPT_UPDATE = 'False'")
|
# print(f'获取到作者邀请码:{AuthorCode}')
|
||||||
if down_file(script_filename, server_script_url):
|
return AuthorCode
|
||||||
print(f'请重新运行新脚本\n')
|
else:
|
||||||
return True
|
# print("无法获取文件。状态代码:", response.status_code)
|
||||||
else:
|
return {}
|
||||||
print(">>>>>>>发现新版本的脚本,您禁用了自动更新,如需启用请删除变量SCRIPT_UPDATE\n")
|
except Exception as e:
|
||||||
else:
|
print(f"An error occurred: {e}")
|
||||||
print(f'无需更新\n')
|
return {}
|
||||||
return False
|
|
||||||
|
|
||||||
except requests.exceptions.RequestException as e:
|
|
||||||
print(f'发生网络错误:{e}')
|
def CHECK_PARAMENTERS(index, input_string, required_parameters):
|
||||||
server_base_url = f"https://py.cherwin.cn/{APP_NAME}/"
|
# required_parameters = ['deviceid', 'jysessionid', 'shopid', 'memberid', 'access_token', 'sign']
|
||||||
server_script_url = f"{server_base_url}{script_filename}"
|
|
||||||
CHECK_UPDATE_NEW(local_version, server_version, server_script_url, script_filename, APP_NAME=APP_NAME)
|
# 记录缺少的参数
|
||||||
|
missing_parameters = []
|
||||||
except Exception as e:
|
# 将输入字符串和参数列表中的所有字符都转换为小写
|
||||||
print(f'发生未知错误:{e}')
|
input_string_lower = input_string.lower()
|
||||||
|
required_parameters_lower = [param.lower() for param in required_parameters]
|
||||||
return False # 返回 False 表示没有进行更新操作
|
# 判断字符串中是否包含所有必需的参数
|
||||||
|
for param in required_parameters_lower:
|
||||||
|
if param not in input_string_lower:
|
||||||
def down_file(filename, file_url):
|
missing_parameters.append(param)
|
||||||
print(f'开始下载:{filename},下载地址:{file_url}')
|
if missing_parameters:
|
||||||
try:
|
print(f"\n第【{index + 1}】个账号,缺少以下参数:【{missing_parameters}】")
|
||||||
response = requests.get(file_url, verify=False, timeout=10)
|
return False
|
||||||
response.raise_for_status()
|
else:
|
||||||
with open(filename + '.tmp', 'wb') as f:
|
print(f"\n第【{index + 1}】个账号,URL包含所有必需的参数,开始执行脚本")
|
||||||
f.write(response.content)
|
return True
|
||||||
print(f'【{filename}】下载完成!')
|
|
||||||
|
|
||||||
# 检查临时文件是否存在
|
def QIANWEN(tongyiSysPromt, content, api_key):
|
||||||
temp_filename = filename + '.tmp'
|
print('开始调用通义千问')
|
||||||
if os.path.exists(temp_filename):
|
# 检查dashscope库是否已安装
|
||||||
# 删除原有文件
|
dashscope = import_or_install('dashscope')
|
||||||
if os.path.exists(filename):
|
if dashscope:
|
||||||
os.remove(filename)
|
dashscope.api_key = api_key
|
||||||
# 重命名临时文件
|
response = dashscope.Generation.call(
|
||||||
os.rename(temp_filename, filename)
|
model='qwen-max',
|
||||||
print(f'【{filename}】重命名成功!')
|
messages=[
|
||||||
return True
|
{"role": "system",
|
||||||
else:
|
"content": tongyiSysPromt},
|
||||||
print(f'【{filename}】临时文件不存在!')
|
{"role": "user", "content": content}],
|
||||||
return False
|
seed=1234,
|
||||||
except Exception as e:
|
top_p=0.8,
|
||||||
print(f'【{filename}】下载失败:{str(e)}')
|
result_format='message',
|
||||||
return False
|
enable_search=False,
|
||||||
|
max_tokens=1500,
|
||||||
|
temperature=1.0,
|
||||||
def get_AuthorInviteCode(url):
|
repetition_penalty=1.0,
|
||||||
global AuthorCode
|
)
|
||||||
try:
|
if response.status_code == HTTPStatus.OK:
|
||||||
response = requests.get(url, verify=False, timeout=10)
|
# print(response)
|
||||||
if response.status_code == 200:
|
video_info = response.output['choices'][0]['message']['content']
|
||||||
content = json.loads(response.text)
|
print('通义生成【成功】!')
|
||||||
AuthorCode = list(content.values())
|
return video_info
|
||||||
# print(f'获取到作者邀请码:{AuthorCode}')
|
else:
|
||||||
return AuthorCode
|
print(f"无法解析通义返回的信息:{response}")
|
||||||
else:
|
return None
|
||||||
# print("无法获取文件。状态代码:", response.status_code)
|
else:
|
||||||
return {}
|
print('dashscope 模块无法导入,函数无法执行。')
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
print(f"An error occurred: {e}")
|
# 取环境变量,并分割
|
||||||
return {}
|
def ENV_SPLIT(input_str):
|
||||||
|
parts = []
|
||||||
|
if '&' in input_str:
|
||||||
def GET_TIPS(server_base_url):
|
amp_parts = input_str.split('&')
|
||||||
url = f'{server_base_url}tips.txt'
|
for part in amp_parts:
|
||||||
try:
|
if '#' in part:
|
||||||
response = requests.get(url, verify=False)
|
hash_parts = part.split('#')
|
||||||
# 检查响应的编码
|
for hash_part in hash_parts:
|
||||||
encoding = response.encoding
|
parts.append(hash_part)
|
||||||
# print(f"编码: {encoding}")
|
else:
|
||||||
# 设置正确的编码(根据实际情况可能需要调整)
|
parts.append(part)
|
||||||
response.encoding = 'utf-8'
|
# print(parts)
|
||||||
# 读取内容
|
return (parts)
|
||||||
content = response.text
|
|
||||||
if 'code' in content:
|
elif '#' in input_str:
|
||||||
content = None
|
hash_parts = input_str.split('#')
|
||||||
except:
|
# print(hash_parts)
|
||||||
content = None
|
return (hash_parts)
|
||||||
print('获取通知内容失败')
|
else:
|
||||||
if content:
|
out_str = str(input_str)
|
||||||
return (f'''
|
# print([out_str])
|
||||||
***********通知内容************\n
|
return ([out_str])
|
||||||
{content}
|
|
||||||
***********通知内容************\n
|
|
||||||
''')
|
# 使用导入的模块进行验证码识别
|
||||||
else:
|
def CAPCODE(captcha_slider, captcha_bg):
|
||||||
return (f'''
|
ddddocr = import_or_install('ddddocr')
|
||||||
***********通知内容************\n
|
if ddddocr:
|
||||||
@Author Cherwin
|
slide = ddddocr.DdddOcr(det=False, ocr=False)
|
||||||
***********通知内容************\n
|
with open(captcha_slider, 'rb') as f:
|
||||||
''')
|
target_bytes = f.read()
|
||||||
|
with open(captcha_bg, 'rb') as f:
|
||||||
|
background_bytes = f.read()
|
||||||
def CHECK_PARAMENTERS(index, input_string, required_parameters):
|
res = slide.slide_match(target_bytes, background_bytes, simple_target=True)
|
||||||
# required_parameters = ['deviceid', 'jysessionid', 'shopid', 'memberid', 'access_token', 'sign']
|
# print(res['target'][0])
|
||||||
|
# print(type(res['target'][0]))
|
||||||
# 记录缺少的参数
|
return res['target'][0]
|
||||||
missing_parameters = []
|
else:
|
||||||
|
print('ddddocr 模块无法导入,函数无法执行。')
|
||||||
# 将输入字符串和参数列表中的所有字符都转换为小写
|
return False
|
||||||
input_string_lower = input_string.lower()
|
|
||||||
required_parameters_lower = [param.lower() for param in required_parameters]
|
|
||||||
|
def send_wxpusher(UID, one_msg, APP_NAME, help=False):
|
||||||
# 判断字符串中是否包含所有必需的参数
|
WXPUSHER = os.environ.get('WXPUSHER', False)
|
||||||
for param in required_parameters_lower:
|
if WXPUSHER:
|
||||||
if param not in input_string_lower:
|
if help:
|
||||||
missing_parameters.append(param)
|
push_res = wxpusher(WXPUSHER, APP_NAME + '互助', one_msg, UID, TIPS_HTML)
|
||||||
|
else:
|
||||||
if missing_parameters:
|
push_res = wxpusher(WXPUSHER, APP_NAME, one_msg, UID, TIPS_HTML)
|
||||||
print(f"\n第【{index + 1}】个账号,缺少以下参数:【{missing_parameters}】")
|
print(push_res)
|
||||||
return False
|
|
||||||
else:
|
|
||||||
print(f"\n第【{index + 1}】个账号,URL包含所有必需的参数,开始执行脚本")
|
def wxpusher(UID, msg, title, help=False):
|
||||||
return True
|
"""利用 wxpusher 的 web api 发送 json 数据包,实现微信信息的发送"""
|
||||||
|
WXPUSHER = os.environ.get('WXPUSHER', False)
|
||||||
|
if WXPUSHER:
|
||||||
def QIANWEN(tongyiSysPromt, content, api_key):
|
if help: title = title + '互助'
|
||||||
print('开始调用通义千问')
|
print('\n------开始wxpusher推送------')
|
||||||
# 检查dashscope库是否已安装
|
print(f'标题:【{title}】\n内容:{msg}')
|
||||||
dashscope = import_or_install('dashscope')
|
webapi = 'http://wxpusher.zjiecode.com/api/send/message'
|
||||||
if dashscope:
|
msg = msg.replace("\n", "<br>")
|
||||||
dashscope.api_key = api_key
|
# tips = TIPS_HTML.replace("\n", "<br>")
|
||||||
response = dashscope.Generation.call(
|
data = {
|
||||||
model='qwen-max',
|
"appToken": WXPUSHER,
|
||||||
messages=[
|
"content": f'{title}<br>{msg}<br>{TIPS_HTML}',
|
||||||
{"role": "system",
|
# "summary": msg[:99], # 该参数可选,默认为 msg 的前10个字符
|
||||||
"content": tongyiSysPromt},
|
"summary": title,
|
||||||
{"role": "user", "content": content}],
|
"contentType": 2,
|
||||||
seed=1234,
|
"uids": [UID],
|
||||||
top_p=0.8,
|
"url": "https://gj.cherwin.cn"
|
||||||
result_format='message',
|
}
|
||||||
enable_search=False,
|
try:
|
||||||
max_tokens=1500,
|
result = requests.post(url=webapi, json=data)
|
||||||
temperature=1.0,
|
result.raise_for_status() # 对于非2xx状态码,抛出异常
|
||||||
repetition_penalty=1.0,
|
response_json = result.json()
|
||||||
)
|
if response_json["success"]:
|
||||||
if response.status_code == HTTPStatus.OK:
|
return "------消息发送成功------\n"
|
||||||
# print(response)
|
else:
|
||||||
video_info = response.output['choices'][0]['message']['content']
|
return f"消息发送失败。错误信息:{response_json['msg']}"
|
||||||
print('通义生成【成功】!')
|
except requests.exceptions.RequestException as e:
|
||||||
return video_info
|
return f"发送消息时发生错误:{str(e)}"
|
||||||
else:
|
except Exception as e:
|
||||||
print(f"无法解析通义返回的信息:{response}")
|
return f"发生意外错误:{str(e)}"
|
||||||
return None
|
|
||||||
else:
|
|
||||||
print('dashscope 模块无法导入,函数无法执行。')
|
def RESTART_SCRIPT(RESTART_SCRIPT_NAME):
|
||||||
|
python = sys.executable
|
||||||
|
os.execl(python, RESTART_SCRIPT_NAME, *sys.argv[1:])
|
||||||
# 取环境变量,并分割
|
|
||||||
def ENV_SPLIT(input_str):
|
|
||||||
parts = []
|
def CHECK():
|
||||||
if '&' in input_str:
|
global CHERWIN_SCRIPT_CONFIG
|
||||||
amp_parts = input_str.split('&')
|
print('>>>>>>>开始获取版本信息...')
|
||||||
for part in amp_parts:
|
baseurl = 'https://py.cherwin.cn/'
|
||||||
if '#' in part:
|
TOOLS_NAME = 'CHERWIN_TOOLS.py'
|
||||||
hash_parts = part.split('#')
|
server_script_url = f'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/{TOOLS_NAME}'
|
||||||
for hash_part in hash_parts:
|
try:
|
||||||
parts.append(hash_part)
|
response = requests.get(f'{baseurl}CHERWIN_SCRIPT_CONFIG.json', verify=False)
|
||||||
else:
|
response.encoding = 'utf-8'
|
||||||
parts.append(part)
|
# 读取内容
|
||||||
# print(parts)
|
CHERWIN_SCRIPT_CONFIG = response.json()
|
||||||
return (parts)
|
if 'code' in CHERWIN_SCRIPT_CONFIG:
|
||||||
|
CHERWIN_SCRIPT_CONFIG = None
|
||||||
elif '#' in input_str:
|
server_version = CHERWIN_SCRIPT_CONFIG.get('TOOLS_VERSION', NOW_TOOLS_VERSION)
|
||||||
hash_parts = input_str.split('#')
|
if CHECK_UPDATE_NEW(NOW_TOOLS_VERSION, server_version, server_script_url, TOOLS_NAME):
|
||||||
# print(hash_parts)
|
print('更新脚本完成')
|
||||||
return (hash_parts)
|
# print(f'重新检测[{TOOLS_NAME}]版本')
|
||||||
else:
|
return False
|
||||||
out_str = str(input_str)
|
else:
|
||||||
# print([out_str])
|
return True
|
||||||
return ([out_str])
|
except:
|
||||||
|
print('获取CHERWIN_SCRIPT_CONFIG.json失败')
|
||||||
|
return False
|
||||||
# 使用导入的模块进行验证码识别
|
def GJJJ_SIGN():
|
||||||
def CAPCODE(captcha_slider, captcha_bg):
|
app_id = "667516"
|
||||||
ddddocr = import_or_install('ddddocr')
|
app_crypto = "FH3yRrHG2RfexND8"
|
||||||
if ddddocr:
|
timestamp = int(time.time() * 1000)
|
||||||
slide = ddddocr.DdddOcr(det=False, ocr=False)
|
# timestamp = 1715180892075
|
||||||
with open(captcha_slider, 'rb') as f:
|
text = f"{app_id}{app_crypto}{timestamp}"
|
||||||
target_bytes = f.read()
|
sign = hashlib.md5(text.encode()).hexdigest()
|
||||||
with open(captcha_bg, 'rb') as f:
|
new_data = {
|
||||||
background_bytes = f.read()
|
'timestamp': str(timestamp),
|
||||||
res = slide.slide_match(target_bytes, background_bytes, simple_target=True)
|
"sign": sign
|
||||||
# print(res['target'][0])
|
}
|
||||||
# print(type(res['target'][0]))
|
return new_data
|
||||||
return res['target'][0]
|
def KWW_SIGN(memberId):
|
||||||
else:
|
timestamp = int(time.time() * 1000)
|
||||||
print('ddddocr 模块无法导入,函数无法执行。')
|
random_num = random.randint(0, 31)
|
||||||
return False
|
u = [
|
||||||
|
"A", "Z", "B", "Y", "C", "X", "D", "T", "E", "S", "F", "R", "G", "Q", "H", "P", "I", "O", "J", "N", "k",
|
||||||
|
"M", "L", "a", "c", "d", "f", "h", "k", "p", "y", "n"]
|
||||||
def BASE64_TO_IMG(base64_string, output_path):
|
r = f"{timestamp}{memberId}{u[random_num]}"
|
||||||
import base64
|
sign = hashlib.md5(r.encode()).hexdigest()
|
||||||
import io
|
update_headers = {
|
||||||
Image = import_or_install('Pillow', 'PIL.Image')
|
"user-sign": sign,
|
||||||
|
"user-paramname": "memberId",
|
||||||
if Image:
|
"user-timestamp": str(timestamp),
|
||||||
try:
|
"user-random": str(random_num)
|
||||||
# 解码base64字符串
|
}
|
||||||
image_data = base64.b64decode(base64_string)
|
return update_headers
|
||||||
# 将字节数据转换为字节流
|
def TYQH_SIGN(parameters={}, body=None):
|
||||||
image_buf = Image.open(io.BytesIO(image_data))
|
sorted_keys = sorted(parameters.keys())
|
||||||
# 转换为RGB模式
|
parameter_strings = []
|
||||||
image_buf = image_buf.convert('RGB')
|
for key in sorted_keys:
|
||||||
# 保存图片到指定路径
|
if isinstance(parameters[key], dict):
|
||||||
image_buf.save(output_path, format='JPEG')
|
parameter_strings.append(f"{key}={json.dumps(parameters[key])}")
|
||||||
return True
|
else:
|
||||||
except Exception as e:
|
parameter_strings.append(f"{key}={parameters[key]}")
|
||||||
print(f'发生错误:{e}')
|
|
||||||
return False
|
current_time = int(datetime.now().timestamp() * 1000)
|
||||||
else:
|
secret_chars = list('BxzTx45uIGT25TTHIIBU2')
|
||||||
print('需要的模块[PIL]无法导入,函数无法执行。')
|
last_three_digits = str(current_time)[-3:]
|
||||||
return False
|
for digit in last_three_digits:
|
||||||
|
secret_chars.insert(int(digit), digit)
|
||||||
|
|
||||||
def send_wxpusher(UID, one_msg, APP_NAME, help=False):
|
secret = hashlib.md5(''.join(secret_chars).encode()).hexdigest()
|
||||||
WXPUSHER = os.environ.get('WXPUSHER', False)
|
nonce_str = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
|
||||||
if WXPUSHER:
|
|
||||||
if help:
|
sign_data = {
|
||||||
push_res = wxpusher(WXPUSHER, APP_NAME + '互助', one_msg, UID, TIPS_HTML)
|
'client_id': 'game',
|
||||||
else:
|
'nonstr': nonce_str,
|
||||||
push_res = wxpusher(WXPUSHER, APP_NAME, one_msg, UID, TIPS_HTML)
|
'timestamp': current_time,
|
||||||
print(push_res)
|
'body': json.dumps(body) if body else '',
|
||||||
|
'query': '&'.join(parameter_strings) if parameter_strings else '',
|
||||||
|
'secret': secret
|
||||||
def wxpusher(UID, msg, title, help=False):
|
}
|
||||||
"""利用 wxpusher 的 web api 发送 json 数据包,实现微信信息的发送"""
|
|
||||||
WXPUSHER = os.environ.get('WXPUSHER', False)
|
sign_string = '|'.join([str(v) for v in sign_data.values()])
|
||||||
if WXPUSHER:
|
sign = hashlib.md5(sign_string.encode()).hexdigest().upper()
|
||||||
if help: title = title + '互助'
|
sign_header = {
|
||||||
print('\n------开始wxpusher推送------')
|
'client_id': 'game',
|
||||||
print(f'标题:【{title}】\n内容:{msg}')
|
'timestamp': str(current_time),
|
||||||
webapi = 'http://wxpusher.zjiecode.com/api/send/message'
|
'nonstr': sign_data['nonstr'],
|
||||||
msg = msg.replace("\n", "<br>")
|
'sign': sign
|
||||||
tips = TIPS_HTML.replace("\n", "<br>")
|
}
|
||||||
data = {
|
return sign_header
|
||||||
"appToken": WXPUSHER,
|
|
||||||
"content": f'{title}<br>{msg}<br>{tips}',
|
def main(APP_NAME, local_script_name, ENV_NAME, local_version,need_invite=False):
|
||||||
# "summary": msg[:99], # 该参数可选,默认为 msg 的前10个字符
|
global APP_INFO, TIPS, TIPS_HTML
|
||||||
"summary": title,
|
git_url = f'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/{local_script_name}'
|
||||||
"contentType": 2,
|
if CHECK():
|
||||||
"uids": [UID],
|
APP_INFO = CHERWIN_SCRIPT_CONFIG.get("APP_CONFIG", {}).get(ENV_NAME, {})
|
||||||
"url": "https://gj.cherwin.cn"
|
# print(APP_INFO)
|
||||||
}
|
server_version = APP_INFO.get('NEW_VERSION', '')
|
||||||
|
if CHECK_UPDATE_NEW(local_version, server_version, git_url, local_script_name, APP_NAME=APP_NAME):
|
||||||
try:
|
print('更新成功,请重新运行脚本!')
|
||||||
result = requests.post(url=webapi, json=data)
|
|
||||||
result.raise_for_status() # 对于非2xx状态码,抛出异常
|
if not APP_INFO.get('ENABLE', False) and not IS_DEV:
|
||||||
response_json = result.json()
|
print('当前脚本未开放')
|
||||||
if response_json["success"]:
|
exit()
|
||||||
return "------消息发送成功------\n"
|
TIPS = APP_INFO.get('NTC', '') if APP_INFO.get('NTC', '') else CHERWIN_SCRIPT_CONFIG.get('GLOBAL_NTC', '')
|
||||||
else:
|
TIPS_HTML = APP_INFO.get('NTC', '') if APP_INFO.get('NTC', '') else CHERWIN_SCRIPT_CONFIG.get('GLOBAL_NTC_HTML','')
|
||||||
return f"消息发送失败。错误信息:{response_json['msg']}"
|
ENV = os.environ.get(ENV_NAME)
|
||||||
except requests.exceptions.RequestException as e:
|
if need_invite:
|
||||||
return f"发送消息时发生错误:{str(e)}"
|
AuthorCode = get_AuthorInviteCode(f'https://yhsh.ziyuand.cn/{ENV_NAME}_INVITE_CODE.json')
|
||||||
except Exception as e:
|
else:
|
||||||
return f"发生意外错误:{str(e)}"
|
AuthorCode = ''
|
||||||
|
return ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
|
else:
|
||||||
def RESTART_SCRIPT(RESTART_SCRIPT_NAME):
|
exit()
|
||||||
python = sys.executable
|
|
||||||
os.execl(python, RESTART_SCRIPT_NAME, *sys.argv[1:])
|
if __name__ == '__main__':
|
||||||
|
print(NOW_TOOLS_VERSION)
|
||||||
|
|
||||||
def CHECK():
|
|
||||||
global CHERWIN_SCRIPT_CONFIG
|
|
||||||
print('>>>>>>>开始获取版本信息...')
|
|
||||||
baseurl = 'https://py.cherwin.cn/'
|
|
||||||
TOOLS_NAME = 'CHERWIN_TOOLS.py'
|
|
||||||
server_script_url = f'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/{TOOLS_NAME}'
|
|
||||||
try:
|
|
||||||
response = requests.get(f'{baseurl}CHERWIN_SCRIPT_CONFIG.json', verify=False)
|
|
||||||
response.encoding = 'utf-8'
|
|
||||||
# 读取内容
|
|
||||||
CHERWIN_SCRIPT_CONFIG = response.json()
|
|
||||||
if 'code' in CHERWIN_SCRIPT_CONFIG:
|
|
||||||
CHERWIN_SCRIPT_CONFIG = None
|
|
||||||
server_version = CHERWIN_SCRIPT_CONFIG.get('TOOLS_VERSION', NOW_TOOLS_VERSION)
|
|
||||||
if CHECK_UPDATE_NEW(NOW_TOOLS_VERSION, server_version, server_script_url, TOOLS_NAME):
|
|
||||||
print('更新脚本完成')
|
|
||||||
# print(f'重新检测[{TOOLS_NAME}]版本')
|
|
||||||
return False
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
except:
|
|
||||||
print('获取CHERWIN_SCRIPT_CONFIG.json失败')
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def main(APP_NAME, local_script_name, ENV_NAME, local_version):
|
|
||||||
global APP_INFO, TIPS, TIPS_HTML
|
|
||||||
git_url = f'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/{local_script_name}'
|
|
||||||
if CHECK():
|
|
||||||
APP_INFO = CHERWIN_SCRIPT_CONFIG.get("APP_CONFIG", {}).get(ENV_NAME, {})
|
|
||||||
# print(APP_INFO)
|
|
||||||
server_version = APP_INFO.get('NEW_VERSION', '')
|
|
||||||
if CHECK_UPDATE_NEW(local_version, server_version, git_url, local_script_name, APP_NAME=APP_NAME):
|
|
||||||
print('更新成功,请重新运行脚本!')
|
|
||||||
|
|
||||||
if not APP_INFO.get('ENABLE', False):
|
|
||||||
print('当前脚本未开放')
|
|
||||||
exit()
|
|
||||||
TIPS = APP_INFO.get('NTC', '') if APP_INFO.get('NTC', '') else CHERWIN_SCRIPT_CONFIG.get('GLOBAL_NTC', '')
|
|
||||||
|
|
||||||
TIPS_HTML = APP_INFO.get('NTC', '') if APP_INFO.get('NTC', '') else CHERWIN_SCRIPT_CONFIG.get('GLOBAL_NTC_HTML',
|
|
||||||
'')
|
|
||||||
ENV = os.environ.get(ENV_NAME)
|
|
||||||
AuthorCode = get_AuthorInviteCode(f'https://yhsh.ziyuand.cn/{ENV_NAME}_INVITE_CODE.json')
|
|
||||||
|
|
||||||
return ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
|
||||||
else:
|
|
||||||
exit()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
pass
|
|
||||||
89
DBKD.py
89
DBKD.py
@ -3,8 +3,8 @@
|
|||||||
# -------------------------------
|
# -------------------------------
|
||||||
# ✨✨✨ @Author CHERWIN✨✨✨
|
# ✨✨✨ @Author CHERWIN✨✨✨
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "0 7 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "0 6 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('德邦快递小程序签到')
|
# const $ = new Env('中通快递小程序签到')
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
@ -13,9 +13,10 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -46,14 +47,12 @@ class RUN:
|
|||||||
self.index = index + 1
|
self.index = index + 1
|
||||||
self.s = requests.session()
|
self.s = requests.session()
|
||||||
self.s.verify = False
|
self.s.verify = False
|
||||||
|
self.token = f'ECO_TOKEN={token};'
|
||||||
self.token = token
|
|
||||||
self.headers = {
|
self.headers = {
|
||||||
'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 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x6309080f) XWEB/9079',
|
'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 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x6309080f) XWEB/9079',
|
||||||
|
'Cookie':self.token,
|
||||||
'Referer': 'https://servicewechat.com/wxa1ebeeb0ed47f0b2/633/page-frame.html'
|
'Referer': 'https://servicewechat.com/wxa1ebeeb0ed47f0b2/633/page-frame.html'
|
||||||
}
|
}
|
||||||
self.baseUrl = 'https://api.ztomember.com/api/'
|
|
||||||
|
|
||||||
|
|
||||||
def do_request(self, method, url, params=None, data=None, headers=None):
|
def do_request(self, method, url, params=None, data=None, headers=None):
|
||||||
if not headers:
|
if not headers:
|
||||||
@ -86,6 +85,26 @@ class RUN:
|
|||||||
print(f"查询账户异常: {e}")
|
print(f"查询账户异常: {e}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def queryUserInfo(self):
|
||||||
|
try:
|
||||||
|
self.headers['Content-Type'] = 'application/json'
|
||||||
|
self.headers['Accept'] = '*/*'
|
||||||
|
response = self.do_request('GET', 'https://www.deppon.com/ndcc-gwapi/userService/eco/user/secure/queryUserInfo')
|
||||||
|
if response and response.get('message') == 'ok':
|
||||||
|
# print(response)
|
||||||
|
result = response.get('result', {})
|
||||||
|
phone = result.get('mobile', '')
|
||||||
|
self.mobile = phone[:3] + "*" * 4 + phone[7:]
|
||||||
|
self.userName = result.get('userName', '')
|
||||||
|
Log(f'\n用户名:【{self.userName}】\n手机号:【{self.mobile}】')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f"登录验证失败: {response}")
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f"登录验证异常: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
def generate_tmp_token(self):
|
def generate_tmp_token(self):
|
||||||
try:
|
try:
|
||||||
response = self.do_request('GET', 'https://www.deppon.com/ndcc-gwapi/userService/eco/user/token/secure/generateTmpToken')
|
response = self.do_request('GET', 'https://www.deppon.com/ndcc-gwapi/userService/eco/user/token/secure/generateTmpToken')
|
||||||
@ -107,11 +126,11 @@ class RUN:
|
|||||||
if response and response.get('code') == 200:
|
if response and response.get('code') == 200:
|
||||||
# print(response)
|
# print(response)
|
||||||
Log(f"登录验证成功!")
|
Log(f"登录验证成功!")
|
||||||
self.phone = response['data']['mobile']
|
data = response.get('data', {})
|
||||||
self.token = response['data']['token']
|
self.token = data.get('token','')
|
||||||
self.headers['mobile'] = self.phone
|
self.phone = data.get('mobile','')
|
||||||
self.headers['token'] = self.token
|
self.headers['token'] = self.token
|
||||||
#
|
self.headers['mobile'] = self.phone
|
||||||
# print(f"PHONE:【{self.phone}】")
|
# print(f"PHONE:【{self.phone}】")
|
||||||
# print(f"TOKEN:【{self.token}】")
|
# print(f"TOKEN:【{self.token}】")
|
||||||
return True
|
return True
|
||||||
@ -248,7 +267,7 @@ class RUN:
|
|||||||
"rightsClaimStatus":1,
|
"rightsClaimStatus":1,
|
||||||
"taskRuleId":self.taskRuleId
|
"taskRuleId":self.taskRuleId
|
||||||
}
|
}
|
||||||
response = self.do_request('POST', 'https://mas.deppon.com/crm-api/deppon/pay/member/add/package/query',data = data)
|
response = self.do_request('POST', 'https://mas.deppon.com/crm-api/deppon/points/task/changeStatus',data = data)
|
||||||
if response and response.get('code') == 200:
|
if response and response.get('code') == 200:
|
||||||
Log(f'完成任务:【{self.name}】成功!')
|
Log(f'完成任务:【{self.name}】成功!')
|
||||||
return response['msg']
|
return response['msg']
|
||||||
@ -276,14 +295,15 @@ class RUN:
|
|||||||
|
|
||||||
def lottery(self):
|
def lottery(self):
|
||||||
try:
|
try:
|
||||||
data = {"phone": self.phone,"gameId":'Zv8i7IsOPZIQrvvupKXE1w=='}
|
data = {"mobile": self.phone,"gameId":'67'}
|
||||||
response = self.do_request('POST', 'https://mas.deppon.com/crm-api/game/draw/lottery',data = data)
|
response = self.do_request('POST', 'https://mas.deppon.com/admin/envelops/game/lottery',data = data)
|
||||||
|
|
||||||
if response and response.get('code') == 200:
|
if response and response.get('code') == 0:
|
||||||
print('抽奖成功')
|
# print(response)
|
||||||
print(response)
|
data = response.get('data','')
|
||||||
self.pointsAvailableValue -= 1
|
name = data.get('name','')
|
||||||
return response['msg']
|
Log(f'抽奖成功,获得:{name}')
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
print(f"抽奖失败: {response}")
|
print(f"抽奖失败: {response}")
|
||||||
return None
|
return None
|
||||||
@ -318,16 +338,20 @@ class RUN:
|
|||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
Log(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
Log(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
||||||
if self.login():
|
# if self.login():
|
||||||
|
|
||||||
|
if self.queryUserInfo():
|
||||||
|
self.generate_tmp_token()
|
||||||
self.getSvipNewestInfo()
|
self.getSvipNewestInfo()
|
||||||
self.signIn_info()
|
self.signIn_info()
|
||||||
self.points_signIn_info()
|
self.points_signIn_info()
|
||||||
self.task_list()
|
self.task_list()
|
||||||
self.lottery_query2()
|
self.lottery()
|
||||||
self.getSvipNewestInfo('执行后')
|
self.getSvipNewestInfo('执行后')
|
||||||
self.sendMsg()
|
self.sendMsg()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
self.sendMsg()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def sendMsg(self):
|
def sendMsg(self):
|
||||||
@ -374,8 +398,8 @@ def import_Tools():
|
|||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
APP_NAME = '德邦快递小程序'
|
APP_NAME = '德邦快递小程序'
|
||||||
ENV_NAME = 'DBKD'
|
ENV_NAME = 'DBKD'
|
||||||
CK_NAME = 'code'
|
CK_NAME = 'ECO_TOKEN=里面的值;'
|
||||||
CK_URL = 'https://www.deppon.com/ndcc-gwapi/userService/eco/user/login'
|
CK_URL = 'https://www.deppon.com/ndcc-gwapi/userService/eco/user/secure/queryUserInfo'
|
||||||
print(f'''
|
print(f'''
|
||||||
✨✨✨ {APP_NAME}签到✨✨✨
|
✨✨✨ {APP_NAME}签到✨✨✨
|
||||||
✨ 功能:
|
✨ 功能:
|
||||||
@ -384,7 +408,7 @@ if __name__ == '__main__':
|
|||||||
打开{APP_NAME}
|
打开{APP_NAME}
|
||||||
授权登陆
|
授权登陆
|
||||||
打开抓包工具
|
打开抓包工具
|
||||||
找{CK_URL}请求body里面的[{CK_NAME}]
|
找{CK_URL}请求Cookies里面的[{CK_NAME}]
|
||||||
复制里面的[{CK_NAME}]参数值
|
复制里面的[{CK_NAME}]参数值
|
||||||
参数示例:0f1bjLFa1ZdedHxxxxxxxx
|
参数示例:0f1bjLFa1ZdedHxxxxxxxx
|
||||||
✨ ✨✨wxpusher一对一推送功能,
|
✨ ✨✨wxpusher一对一推送功能,
|
||||||
@ -398,16 +422,19 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.18'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
@ -422,4 +449,4 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
for index, infos in enumerate(tokens):
|
for index, infos in enumerate(tokens):
|
||||||
run_result = RUN(infos, index).main()
|
run_result = RUN(infos, index).main()
|
||||||
if not run_result: continue
|
if not run_result: continue
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
# if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
274
EMS.py
Executable file
274
EMS.py
Executable file
@ -0,0 +1,274 @@
|
|||||||
|
# !/usr/bin/python3
|
||||||
|
# -- coding: utf-8 --
|
||||||
|
# -------------------------------
|
||||||
|
# ✨✨✨ @Author CHERWIN✨✨✨
|
||||||
|
# -------------------------------
|
||||||
|
# cron "0 10 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
|
# const $ = new Env('EMS邮惠中心小程序')
|
||||||
|
|
||||||
|
import os
|
||||||
|
import requests
|
||||||
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
|
|
||||||
|
# 禁用安全请求警告
|
||||||
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
|
if os.path.isfile('notify.py'):
|
||||||
|
from notify import send
|
||||||
|
print("加载通知服务成功!")
|
||||||
|
else:
|
||||||
|
print("加载通知服务失败!")
|
||||||
|
send_msg = ''
|
||||||
|
one_msg=''
|
||||||
|
def Log(cont=''):
|
||||||
|
global send_msg,one_msg
|
||||||
|
print(cont)
|
||||||
|
if cont:
|
||||||
|
one_msg += f'{cont}\n'
|
||||||
|
send_msg += f'{cont}\n'
|
||||||
|
|
||||||
|
class RUN:
|
||||||
|
def __init__(self,info,index):
|
||||||
|
global one_msg
|
||||||
|
one_msg = ''
|
||||||
|
split_info = info.split('@')
|
||||||
|
token = split_info[0]
|
||||||
|
len_split_info = len(split_info)
|
||||||
|
last_info = split_info[len_split_info - 1]
|
||||||
|
self.send_UID = None
|
||||||
|
if len_split_info > 0 and "UID_" in last_info:
|
||||||
|
print('检测到设置了UID')
|
||||||
|
print(last_info)
|
||||||
|
self.send_UID = last_info
|
||||||
|
self.index = index + 1
|
||||||
|
self.s = requests.session()
|
||||||
|
self.s.verify = False
|
||||||
|
self.openId = token
|
||||||
|
self.headers = {
|
||||||
|
'Host': 'ump.ems.com.cn',
|
||||||
|
'Upgrade-Insecure-Requests': '1',
|
||||||
|
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6945',
|
||||||
|
'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.9',
|
||||||
|
'Sec-Fetch-Site': 'none',
|
||||||
|
'Sec-Fetch-Mode': 'navigate',
|
||||||
|
'Sec-Fetch-User': '?1',
|
||||||
|
'Sec-Fetch-Dest': 'document',
|
||||||
|
'Accept-Language': 'zh-CN,zh',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def do_request(self, url, method="POST",params=None, data=None, headers=None):
|
||||||
|
if not headers:
|
||||||
|
headers = self.headers
|
||||||
|
try:
|
||||||
|
response = self.s.request(method, url, params=params, json=data, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
|
except Exception as e:
|
||||||
|
print(f"请求错误: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
def findByOpenIdAppId(self):
|
||||||
|
Log(f"====== 获取TOKEN ======")
|
||||||
|
try:
|
||||||
|
params = {
|
||||||
|
"appId":"wx52872495fb375c4b",
|
||||||
|
"openId":self.openId,
|
||||||
|
"source":"JD"
|
||||||
|
}
|
||||||
|
response = self.do_request('https://ump.ems.com.cn/memberCenterApiV2/member/findByOpenIdAppId',data=params)
|
||||||
|
if response and response.get('code') == '000000':
|
||||||
|
# print(response)
|
||||||
|
info = response.get('info', {})
|
||||||
|
self.token = info.get('token', '')
|
||||||
|
self.memberId = info.get('memberId', '')
|
||||||
|
self.headers['MC-TOKEN'] = self.token
|
||||||
|
Log(f'>>获取token成功✅')
|
||||||
|
# print(f'>用户ID:【{self.memberId}】')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f">获取TOKEN失败❌: {response}")
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f"获取TOKEN异常❌: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
def details(self):
|
||||||
|
Log(f"====== 获取用户信息 ======")
|
||||||
|
try:
|
||||||
|
params = {}
|
||||||
|
response = self.do_request('https://ump.ems.com.cn/memberCenterApiV2/member/details',data=params)
|
||||||
|
if response and response.get('code') == '000000':
|
||||||
|
# print(response)
|
||||||
|
info = response.get('info', {})
|
||||||
|
phone = info.get('phone', '')
|
||||||
|
Log(f'>>获取用户信息成功✅')
|
||||||
|
Log(f'>用户ID:【{self.memberId}】\n手机号:【{phone}】')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f">获取TOKEN失败❌: {response}")
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f"获取TOKEN异常❌: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def sign(self):
|
||||||
|
Log(f"====== 开始签到 ======")
|
||||||
|
try:
|
||||||
|
params = {
|
||||||
|
"appId":"wx52872495fb375c4b",
|
||||||
|
"userId":self.memberId,
|
||||||
|
"openId":self.openId,
|
||||||
|
"activId":'d191dce0740849b1b7377e83c00475d6'
|
||||||
|
}
|
||||||
|
response = self.do_request('https://ump.ems.com.cn/activCenterApi/signActivInfo/sign',data=params)
|
||||||
|
if response and response.get('code') == '000000':
|
||||||
|
# print(response)
|
||||||
|
info = response.get('info', {})
|
||||||
|
prizeSize = info.get('prizeSize', {})
|
||||||
|
Log(f'>签到成功✅获得:【{prizeSize}】积分')
|
||||||
|
return True
|
||||||
|
elif response and response.get('code') == '600001':
|
||||||
|
msg = response.get('msg')
|
||||||
|
Log(f'>签到失败❌ 【{msg}】')
|
||||||
|
else:
|
||||||
|
Log(f"签到失败❌: {response}")
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f"登录验证异常❌: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
def memberGoldsInfo(self):
|
||||||
|
Log(f"====== 获取积分信息 ======")
|
||||||
|
try:
|
||||||
|
params = {}
|
||||||
|
response = self.do_request('https://ump.ems.com.cn/memberCenterApiV2/golds/memberGoldsInfo',data=params)
|
||||||
|
if response and response.get('code') == '000000':
|
||||||
|
# print(response)
|
||||||
|
info = response.get('info', {})
|
||||||
|
availableGoldsTotal = info.get('availableGoldsTotal', {})
|
||||||
|
Log(f'>当前积分:【{availableGoldsTotal}】')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f"获取积分信息失败❌: {response}")
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f"获取积分信息异常❌: {e}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
Log(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
||||||
|
# if self.login():
|
||||||
|
|
||||||
|
if self.findByOpenIdAppId():
|
||||||
|
self.details()
|
||||||
|
self.sign()
|
||||||
|
self.memberGoldsInfo()
|
||||||
|
self.sendMsg()
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self.sendMsg()
|
||||||
|
return False
|
||||||
|
|
||||||
|
def sendMsg(self):
|
||||||
|
if self.send_UID:
|
||||||
|
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME)
|
||||||
|
print(push_res)
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def down_file(filename, file_url):
|
||||||
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
|
try:
|
||||||
|
response = requests.get(file_url, verify=False, timeout=10)
|
||||||
|
response.raise_for_status()
|
||||||
|
with open(filename + '.tmp', 'wb') as f:
|
||||||
|
f.write(response.content)
|
||||||
|
print(f'【{filename}】下载完成!')
|
||||||
|
|
||||||
|
# 检查临时文件是否存在
|
||||||
|
temp_filename = filename + '.tmp'
|
||||||
|
if os.path.exists(temp_filename):
|
||||||
|
# 删除原有文件
|
||||||
|
if os.path.exists(filename):
|
||||||
|
os.remove(filename)
|
||||||
|
# 重命名临时文件
|
||||||
|
os.rename(temp_filename, filename)
|
||||||
|
print(f'【{filename}】重命名成功!')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
print(f'【{filename}】临时文件不存在!')
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def import_Tools():
|
||||||
|
global CHERWIN_TOOLS, ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
|
import CHERWIN_TOOLS
|
||||||
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,
|
||||||
|
local_version)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
APP_NAME = 'EMS邮惠中心小程序'
|
||||||
|
ENV_NAME = 'EMS'
|
||||||
|
CK_NAME = 'openId'
|
||||||
|
CK_URL = 'https://ump.ems.com.cn/memberCenterApiV2/member/findByOpenIdAppId'
|
||||||
|
print(f'''
|
||||||
|
✨✨✨ {APP_NAME}签到✨✨✨
|
||||||
|
✨ 功能:
|
||||||
|
积分签到
|
||||||
|
✨ 抓包步骤:
|
||||||
|
打开{APP_NAME}
|
||||||
|
授权登陆
|
||||||
|
打开抓包工具
|
||||||
|
找{CK_URL}请求body里面的[{CK_NAME}]
|
||||||
|
复制里面的[{CK_NAME}]参数值
|
||||||
|
参数示例:o-7675D-prmxxxxxxxxxx
|
||||||
|
✨ ✨✨wxpusher一对一推送功能,
|
||||||
|
✨需要定义变量export WXPUSHER=wxpusher的app_token,不设置则不启用wxpusher一对一推送
|
||||||
|
✨需要在{ENV_NAME}变量最后添加@wxpusher的UID
|
||||||
|
✨ 设置青龙变量:
|
||||||
|
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
||||||
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
|
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
||||||
|
✨ 推荐cron:0 10 * * *
|
||||||
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
|
''')
|
||||||
|
local_script_name = os.path.basename(__file__)
|
||||||
|
local_version = '2024.05.15'
|
||||||
|
if IS_DEV:
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
|
print(TIPS)
|
||||||
|
token = ''
|
||||||
|
token = ENV if ENV else token
|
||||||
|
if not token:
|
||||||
|
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
||||||
|
exit()
|
||||||
|
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
||||||
|
# print(tokens)
|
||||||
|
if len(tokens) > 0:
|
||||||
|
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
||||||
|
access_token = []
|
||||||
|
for index, infos in enumerate(tokens):
|
||||||
|
run_result = RUN(infos, index).main()
|
||||||
|
if not run_result: continue
|
||||||
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
493
GJJJ.py
Executable file
493
GJJJ.py
Executable file
@ -0,0 +1,493 @@
|
|||||||
|
# !/usr/bin/python3
|
||||||
|
# -- coding: utf-8 --
|
||||||
|
# -------------------------------
|
||||||
|
# ✨✨✨ @Author CHERWIN✨✨✨
|
||||||
|
# -------------------------------
|
||||||
|
# cron "1 9 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
|
# const $ = new Env('顾家家居小程序')
|
||||||
|
import os
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
|
import requests
|
||||||
|
|
||||||
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
|
|
||||||
|
# 禁用安全请求警告
|
||||||
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
|
|
||||||
|
if os.path.isfile('notify.py'):
|
||||||
|
from notify import send
|
||||||
|
print("加载通知服务成功!")
|
||||||
|
else:
|
||||||
|
print("加载通知服务失败!")
|
||||||
|
send_msg = ''
|
||||||
|
one_msg=''
|
||||||
|
def Log(cont=''):
|
||||||
|
global send_msg,one_msg
|
||||||
|
print(cont)
|
||||||
|
if cont:
|
||||||
|
one_msg += f'{cont}\n'
|
||||||
|
send_msg += f'{cont}\n'
|
||||||
|
|
||||||
|
class RUN:
|
||||||
|
def __init__(self,info,index):
|
||||||
|
global one_msg
|
||||||
|
one_msg = ''
|
||||||
|
split_info = info.split('@')
|
||||||
|
|
||||||
|
# self.token = json.loads(split_info[0])
|
||||||
|
len_split_info = len(split_info)
|
||||||
|
if len_split_info < 3:return False
|
||||||
|
identityValue = split_info[0]
|
||||||
|
openid = split_info[1]
|
||||||
|
unionid = split_info[2]
|
||||||
|
self.token = {
|
||||||
|
"identityType":"mobile",
|
||||||
|
"identityValue":identityValue,
|
||||||
|
"type2":"wechat-unionid",
|
||||||
|
"value2":"",
|
||||||
|
"source":"顾家小程序",
|
||||||
|
"contentName":"",
|
||||||
|
"openid":openid,
|
||||||
|
"unionid":unionid
|
||||||
|
}
|
||||||
|
# print(self.token)
|
||||||
|
last_info = split_info[len_split_info - 1]
|
||||||
|
self.send_UID = None
|
||||||
|
if len_split_info > 0 and "UID_" in last_info:
|
||||||
|
print('检测到设置了UID')
|
||||||
|
print(last_info)
|
||||||
|
self.send_UID = last_info
|
||||||
|
self.index = index + 1
|
||||||
|
self.max_try = 3
|
||||||
|
self.headers = {
|
||||||
|
"Host": "mc.kukahome.com",
|
||||||
|
"E-Opera": "",
|
||||||
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) XWEB/8555",
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
# "timestamp": "1715180892075",
|
||||||
|
"xweb_xhr": "1",
|
||||||
|
"brandCode": "K001",
|
||||||
|
# "X-Customer": "4802198",
|
||||||
|
"appid": "667516",
|
||||||
|
# "sign": "7acf4f02413bd9855047cc345be6da21",
|
||||||
|
"Accept": "*/*",
|
||||||
|
"Sec-Fetch-Site": "cross-site",
|
||||||
|
"Sec-Fetch-Mode": "cors",
|
||||||
|
"Sec-Fetch-Dest": "empty",
|
||||||
|
"Referer": "https://servicewechat.com/wx0770280d160f09fe/179/page-frame.html",
|
||||||
|
"Accept-Language": "zh-CN,zh;q=0.9",
|
||||||
|
}
|
||||||
|
|
||||||
|
def generate_sign(self):
|
||||||
|
new_data = CHERWIN_TOOLS.GJJJ_SIGN()
|
||||||
|
self.headers.update(new_data)
|
||||||
|
|
||||||
|
|
||||||
|
def make_request(self, url, method='post', headers={}, params={}):
|
||||||
|
self.generate_sign()
|
||||||
|
if headers == {}:
|
||||||
|
headers = self.headers
|
||||||
|
# if params == {}:
|
||||||
|
# params = self.default_data
|
||||||
|
try:
|
||||||
|
if method.lower() == 'get':
|
||||||
|
response = requests.get(url, headers=headers, verify=False)
|
||||||
|
|
||||||
|
elif method.lower() == 'post':
|
||||||
|
response = requests.post(url, headers=headers, json=params, verify=False)
|
||||||
|
else:
|
||||||
|
raise ValueError("不支持的请求方法❌: " + method)
|
||||||
|
return response.json()
|
||||||
|
except requests.exceptions.RequestException as e:
|
||||||
|
print("请求异常❌:", e)
|
||||||
|
except ValueError as e:
|
||||||
|
print("值错误或不支持的请求方法❌:", e)
|
||||||
|
except Exception as e:
|
||||||
|
print("发生了未知错误❌:", e)
|
||||||
|
|
||||||
|
def automaticLogin(self):
|
||||||
|
Log('======= 刷新用户信息 =======')
|
||||||
|
url = 'https://mc.kukahome.com/club-server/member/automaticLogin'
|
||||||
|
response = self.make_request(url,params=self.token)
|
||||||
|
# print(response)
|
||||||
|
if response.get('msg')== "成功":
|
||||||
|
data = response.get('data','')
|
||||||
|
AccessToken = data.get('AccessToken','')
|
||||||
|
membership = data.get('membership', {})
|
||||||
|
point = membership.get('point', '')
|
||||||
|
# systemSource = membership.get('systemSource', '')
|
||||||
|
self.membershipId = membership.get('id', '')
|
||||||
|
self.brandCode = membership.get('brandCode', '')
|
||||||
|
self.mobile = membership.get('mobile', '')
|
||||||
|
oneId = membership.get('oneId', '')
|
||||||
|
memberLevel = membership.get('memberLevel', '')
|
||||||
|
new_headers={
|
||||||
|
"brandCode":self.brandCode,
|
||||||
|
"X-Customer": str(self.membershipId),
|
||||||
|
"AccessToken":AccessToken
|
||||||
|
}
|
||||||
|
self.headers.update(new_headers)
|
||||||
|
Log(f'>手机号:【{self.mobile}】')
|
||||||
|
print(f'>ID:【{self.membershipId}】')
|
||||||
|
print(f'>等级:【{memberLevel}】')
|
||||||
|
print(f'>oneId:【{oneId}】')
|
||||||
|
Log(f'>当前积分:【{point}】')
|
||||||
|
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f'>可能token失效了❌,{response}')
|
||||||
|
return False
|
||||||
|
def personal(self):
|
||||||
|
Log('======= 查询用户信息 =======')
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/member/personal'
|
||||||
|
response = self.make_request(url,params=self.token)
|
||||||
|
# print(response)
|
||||||
|
if response:
|
||||||
|
point = response.get('point','')
|
||||||
|
Log(f'>执行后积分:【{point}】')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f'>可能token失效了❌,{response}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def selectPointTask(self):
|
||||||
|
Log('======= 获取任务列表 =======')
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/member/selectPointTask'
|
||||||
|
data={"brandCode":self.brandCode}
|
||||||
|
response = self.make_request(url,params=data)
|
||||||
|
print(response)
|
||||||
|
if response.get('code')== 0:
|
||||||
|
data = response.get('data',[{}])
|
||||||
|
for li in data:
|
||||||
|
pass
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f'>可能token失效了❌,{response}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def checkSign(self):
|
||||||
|
Log('======= 查询签到状态 =======')
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/member/calendar'
|
||||||
|
data={
|
||||||
|
"t":int(time.time()*1000),
|
||||||
|
"membershipId":self.membershipId
|
||||||
|
}
|
||||||
|
response = self.make_request(url,params=data)
|
||||||
|
if response:
|
||||||
|
isTodaySigned = response.get('isTodaySigned',False)
|
||||||
|
if not isTodaySigned:
|
||||||
|
Log('>今日未签到')
|
||||||
|
self.signIn()
|
||||||
|
else:
|
||||||
|
Log('>今日已签到✅')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
Log(f'>可能token失效了❌,{response}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def signIn(self):
|
||||||
|
Log('======= 开始签到 =======')
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/member/signIn'
|
||||||
|
data={
|
||||||
|
"identityType":"mobile",
|
||||||
|
"identityValue":self.mobile,
|
||||||
|
"membershipId":self.membershipId
|
||||||
|
}
|
||||||
|
response = self.make_request(url,params=data)
|
||||||
|
# print(response)
|
||||||
|
if response.get('status')== 200:
|
||||||
|
data = response.get('data',[])
|
||||||
|
success = data.get('success',False)
|
||||||
|
if success:
|
||||||
|
Log('>签到成功!✅')
|
||||||
|
else:
|
||||||
|
Log(f'>可能token失效了❌,{response}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def selectPage(self):
|
||||||
|
print('======= 获取帖子列表 =======')
|
||||||
|
url = 'https://mc.kukahome.com/club-server/applet/waterfall/selectPage'
|
||||||
|
random_topicId = str(random.randint(0,27))
|
||||||
|
data={"source":1,"pageNum":1,"pageSize":5,"topicId":random_topicId}
|
||||||
|
response = self.make_request(url,params=data)
|
||||||
|
# print(response)
|
||||||
|
if response.get('code')== 0:
|
||||||
|
data = response.get('data',{})
|
||||||
|
list = data.get('list',[{}])
|
||||||
|
if list:
|
||||||
|
print('>获取帖子列表成功✅')
|
||||||
|
randomlist=random.choices(list)
|
||||||
|
# print(randomlist)
|
||||||
|
self.postLikeTask(randomlist)
|
||||||
|
self.postCollectTask(randomlist)
|
||||||
|
self.postCollectTask(randomlist)
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
if self.max_try > 0:
|
||||||
|
print('>获取帖子列表失败❌!正常重试....')
|
||||||
|
self.selectPage()
|
||||||
|
self.max_try -= 1
|
||||||
|
else:
|
||||||
|
Log(f'>可能token失效了❌,{response}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def like_post(self, post_id):
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/postOrder/like'
|
||||||
|
data = {"id": post_id}
|
||||||
|
response = self.make_request(url, params=data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def likeSendPoint(self, post_id,triggerType,content):
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/member/likeSendPoint'
|
||||||
|
data = {
|
||||||
|
"postOrderId": post_id,
|
||||||
|
"triggerType": triggerType,
|
||||||
|
"content": content
|
||||||
|
}
|
||||||
|
response = self.make_request(url, params=data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def collect_post(self, post_id):
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/postOrder/collect'
|
||||||
|
data = {"id": post_id}
|
||||||
|
response = self.make_request(url, params=data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
def submit_comment(self, post_id, content, post_member_id, parent_id="", is_flag=False):
|
||||||
|
url = 'https://mc.kukahome.com/club-server/user/post/comment/insert'
|
||||||
|
data = {
|
||||||
|
"postId": post_id,
|
||||||
|
"parentId": parent_id,
|
||||||
|
"content": content,
|
||||||
|
"postMemberId": post_member_id,
|
||||||
|
"commentMemberId": self.access_token,
|
||||||
|
"isFlag": is_flag
|
||||||
|
}
|
||||||
|
response = self.make_request(url, params=data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def insert_foot_point(self, buried_point_logo, subordinate_terminal, business_name, business_code,current_page_link):
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/foot/point/insertFootPoint'
|
||||||
|
data = {
|
||||||
|
"brandCode": "K001",
|
||||||
|
"buriedPointLogo": buried_point_logo,
|
||||||
|
"subordinateTerminal": subordinate_terminal,
|
||||||
|
"businessName": business_name,
|
||||||
|
"businessCode": business_code,
|
||||||
|
"currentPageLink": current_page_link
|
||||||
|
}
|
||||||
|
response = self.make_request(url, params=data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def push_event(self, event_id, content, target_id, target_name, business_id, business_name):
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/member/pushEvent'
|
||||||
|
data = {
|
||||||
|
"eventId": event_id,
|
||||||
|
"content": content,
|
||||||
|
"targetId": target_id,
|
||||||
|
"targetName": target_name,
|
||||||
|
"businessId": business_id,
|
||||||
|
"businessName": business_name
|
||||||
|
}
|
||||||
|
response = self.make_request(url, params=data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def like_send_point(self, post_order_id, trigger_type, content):
|
||||||
|
url = 'https://mc.kukahome.com/club-server/front/member/likeSendPoint'
|
||||||
|
data = {
|
||||||
|
"postOrderId": post_order_id,
|
||||||
|
"triggerType": trigger_type,
|
||||||
|
"content": content
|
||||||
|
}
|
||||||
|
response = self.make_request(url, params=data)
|
||||||
|
return response
|
||||||
|
|
||||||
|
def resp_result(self,even,response):
|
||||||
|
if response.get('message','') == '提示:保存成功!':
|
||||||
|
print(f'{even}保存成功✅')
|
||||||
|
else:
|
||||||
|
print(f'{even}保存失败❌')
|
||||||
|
|
||||||
|
def postLikeTask(self,postlist):
|
||||||
|
# 点赞帖子
|
||||||
|
post_id = postlist[0]['id']
|
||||||
|
title = postlist[0]['title']
|
||||||
|
print("======= 进入点赞流程------>>>")
|
||||||
|
# 推送点赞事件
|
||||||
|
event_response = self.push_event(event_id="c_showhome_like", content="晒家-点赞", target_id="300001",target_name="晒家-点赞", business_id=post_id,business_name=title)
|
||||||
|
|
||||||
|
self.resp_result("推送点赞事件:", event_response)
|
||||||
|
|
||||||
|
# 点赞事件
|
||||||
|
like_response = self.like_post(post_id)
|
||||||
|
self.resp_result("点赞帖子:", like_response)
|
||||||
|
|
||||||
|
# 插入点赞足迹
|
||||||
|
foot_point_response = self.insert_foot_point(buried_point_logo="do_good_btn",subordinate_terminal="会员小程序", business_name="",business_code="", current_page_link="")
|
||||||
|
self.resp_result("插入点赞足迹:", foot_point_response)
|
||||||
|
#
|
||||||
|
# 点赞送积分
|
||||||
|
like_point_response = self.like_send_point(post_order_id=post_id, trigger_type="1",content="点赞")
|
||||||
|
self.resp_result("点赞送积分响应:", like_point_response)
|
||||||
|
|
||||||
|
print("------>>>点赞结束\n")
|
||||||
|
print("======= 进入取消点赞流程------>>>")
|
||||||
|
# 取消点赞帖子
|
||||||
|
like_response = self.like_post(post_id)
|
||||||
|
self.resp_result("取消点赞帖子:", like_response)
|
||||||
|
|
||||||
|
# 插入取消点赞足迹
|
||||||
|
foot_point_response = self.insert_foot_point(buried_point_logo="cancel_good_btn", subordinate_terminal="会员小程序",business_name="", business_code="", current_page_link="")
|
||||||
|
self.resp_result("插入取消点赞足迹:", foot_point_response)
|
||||||
|
#
|
||||||
|
# 推送取消点赞事件
|
||||||
|
event_response = self.push_event(event_id="c_showhome_unlike", content="晒家-取消点赞", target_id="300002",target_name="晒家-取消点赞", business_id=post_id, business_name=title)
|
||||||
|
self.resp_result("推送取消点赞事件:", event_response)
|
||||||
|
print("------>>>取消点赞结束\n")
|
||||||
|
|
||||||
|
def postCollectTask(self,postlist):
|
||||||
|
|
||||||
|
post_id = postlist[0]['id']
|
||||||
|
title = postlist[0]['title']
|
||||||
|
|
||||||
|
print("======= 进入收藏帖子流程------>>>")
|
||||||
|
# 收藏帖子
|
||||||
|
collect_response = self.collect_post(post_id)
|
||||||
|
self.resp_result("收藏帖子:", collect_response)
|
||||||
|
|
||||||
|
# 插入收藏足迹
|
||||||
|
foot_point_response = self.insert_foot_point(buried_point_logo="buriedPointLogo", subordinate_terminal="会员小程序", business_name="", business_code="", current_page_link="")
|
||||||
|
self.resp_result("插入收藏足迹:", foot_point_response)
|
||||||
|
#
|
||||||
|
#收藏送积分
|
||||||
|
likeSendPoint_response = self.likeSendPoint(post_id, 2, "收藏")
|
||||||
|
self.resp_result("收藏送积分:", likeSendPoint_response)
|
||||||
|
|
||||||
|
print("------>>>收藏帖子结束\n")
|
||||||
|
print("======= 进入取消收藏帖子流程------>>>")
|
||||||
|
# 取消收藏足迹
|
||||||
|
foot_point_response = self.insert_foot_point(buried_point_logo="cancel_collect_btn", subordinate_terminal="会员小程序",business_name="", business_code="", current_page_link="")
|
||||||
|
self.resp_result("取消收藏足迹:", foot_point_response)
|
||||||
|
|
||||||
|
# 取消收藏帖子
|
||||||
|
uncollect_response = self.collect_post(post_id)
|
||||||
|
self.resp_result("取消收藏帖子:", uncollect_response)
|
||||||
|
|
||||||
|
print("------>>>取消收藏帖子结束\n")
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
Log(f"\n======= 开始执行第{self.index}个账号 =======")
|
||||||
|
if self.automaticLogin():
|
||||||
|
self.checkSign()
|
||||||
|
# self.selectPointTask()
|
||||||
|
self.selectPage()
|
||||||
|
self.personal()
|
||||||
|
self.sendMsg()
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
self.sendMsg()
|
||||||
|
return False
|
||||||
|
|
||||||
|
def sendMsg(self):
|
||||||
|
if self.send_UID:
|
||||||
|
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME)
|
||||||
|
print(push_res)
|
||||||
|
|
||||||
|
|
||||||
|
def down_file(filename, file_url):
|
||||||
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
|
try:
|
||||||
|
response = requests.get(file_url, verify=False, timeout=10)
|
||||||
|
response.raise_for_status()
|
||||||
|
with open(filename + '.tmp', 'wb') as f:
|
||||||
|
f.write(response.content)
|
||||||
|
print(f'【{filename}】下载完成!')
|
||||||
|
|
||||||
|
# 检查临时文件是否存在
|
||||||
|
temp_filename = filename + '.tmp'
|
||||||
|
if os.path.exists(temp_filename):
|
||||||
|
# 删除原有文件
|
||||||
|
if os.path.exists(filename):
|
||||||
|
os.remove(filename)
|
||||||
|
# 重命名临时文件
|
||||||
|
os.rename(temp_filename, filename)
|
||||||
|
print(f'【{filename}】重命名成功!')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
print(f'【{filename}】临时文件不存在!')
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def import_Tools():
|
||||||
|
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
|
import CHERWIN_TOOLS
|
||||||
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
APP_NAME = '顾家家居小程序'
|
||||||
|
ENV_NAME = 'GJJJ'
|
||||||
|
CK_URL = 'https://mc.kukahome.com/club-server/member/automaticLogin'
|
||||||
|
CK_NAME = 'identityValue@openid@o98mO0xrQ9Jqp0DUsGpmfHpQm_pQ'
|
||||||
|
print(f'''
|
||||||
|
✨✨✨ {APP_NAME}签到✨✨✨
|
||||||
|
✨ 功能:
|
||||||
|
积分签到
|
||||||
|
社区互动
|
||||||
|
✨ 抓包步骤:
|
||||||
|
打开{APP_NAME}
|
||||||
|
授权登陆
|
||||||
|
打开抓包工具
|
||||||
|
找{CK_URL}返回值[{CK_NAME}]
|
||||||
|
参数示例:3ee9ceccccscscscscscscsc
|
||||||
|
✨ ✨✨wxpusher一对一推送功能,
|
||||||
|
✨需要定义变量export WXPUSHER=wxpusher的app_token,不设置则不启用wxpusher一对一推送
|
||||||
|
✨需要在{ENV_NAME}变量最后添加@wxpusher的UID
|
||||||
|
✨ 设置青龙变量:
|
||||||
|
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
||||||
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
|
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
||||||
|
✨ 推荐cron:1 9 * * *
|
||||||
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
|
''')
|
||||||
|
local_script_name = os.path.basename(__file__)
|
||||||
|
local_version = '2024.05.09'
|
||||||
|
if IS_DEV:
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
|
print(TIPS)
|
||||||
|
token = ''
|
||||||
|
token = ENV if ENV else token
|
||||||
|
if not token:
|
||||||
|
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
||||||
|
exit()
|
||||||
|
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
||||||
|
# print(tokens)
|
||||||
|
if len(tokens) > 0:
|
||||||
|
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
||||||
|
access_token = []
|
||||||
|
for index, infos in enumerate(tokens):
|
||||||
|
s = requests.session()
|
||||||
|
s.verify = False
|
||||||
|
run_result = RUN(infos, index).main()
|
||||||
|
if not run_result: continue
|
||||||
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
26
HDL.py
26
HDL.py
@ -1,10 +1,11 @@
|
|||||||
# !/usr/bin/python3
|
# !/usr/bin/python3
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
# ✨ 推荐cron:0 6 * * *
|
||||||
# ✨✨✨ @Author CHERWIN✨✨✨
|
# ✨✨✨ @Author CHERWIN✨✨✨
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "1 8 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "0 6 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('海底捞小程序签到')
|
# const $ = new Env('中通快递小程序签到')
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from os import path
|
from os import path
|
||||||
@ -15,8 +16,11 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
|
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -237,6 +241,7 @@ class RUN:
|
|||||||
self.sendMsg()
|
self.sendMsg()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
self.sendMsg()
|
||||||
return False
|
return False
|
||||||
def sendMsg(self):
|
def sendMsg(self):
|
||||||
if self.send_UID:
|
if self.send_UID:
|
||||||
@ -299,20 +304,23 @@ if __name__ == '__main__':
|
|||||||
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
||||||
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
||||||
✨ 推荐cron:01 8 * * *
|
✨ 推荐cron:0 6 * * *
|
||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.08'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
|
|||||||
24
JTSD.py
24
JTSD.py
@ -1,9 +1,8 @@
|
|||||||
# !/usr/bin/python3
|
# !/usr/bin/python3
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# ✨✨✨ @Author CHERWIN✨✨✨
|
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "0 6 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "0 5 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('极兔速递小程序签到')
|
# const $ = new Env('极兔速递小程序签到')
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
@ -17,8 +16,11 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
|
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -133,6 +135,7 @@ class RUN:
|
|||||||
self.sign()
|
self.sign()
|
||||||
self.sendMsg()
|
self.sendMsg()
|
||||||
else:
|
else:
|
||||||
|
self.sendMsg()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def sendMsg(self):
|
def sendMsg(self):
|
||||||
@ -200,16 +203,19 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.18'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
@ -224,4 +230,4 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
for index, infos in enumerate(tokens):
|
for index, infos in enumerate(tokens):
|
||||||
run_result = RUN(infos, index).main()
|
run_result = RUN(infos, index).main()
|
||||||
if not run_result: continue
|
if not run_result: continue
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
115
KFHS.py
115
KFHS.py
@ -1,21 +1,23 @@
|
|||||||
# !/usr/bin/python3
|
# !/usr/bin/python3
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "30 1 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "0 0,8 * * " script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('微信公众号:卡夫亨氏新厨艺')
|
# const $ = new Env('微信公众号:卡夫亨氏新厨艺')
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import time
|
import time
|
||||||
from datetime import date, datetime
|
from datetime import date, datetime,time as times
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
# import CHERWIN_TOOLS
|
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
|
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -75,7 +77,7 @@ class RUN:
|
|||||||
openId = data.get('openId','')
|
openId = data.get('openId','')
|
||||||
signTimes = data.get('signTimes',0)
|
signTimes = data.get('signTimes',0)
|
||||||
memberInfo = data.get('memberInfo', {})
|
memberInfo = data.get('memberInfo', {})
|
||||||
phone = memberInfo.get('phone', '')
|
self.phone = memberInfo.get('phone', '')
|
||||||
score = memberInfo.get('score', '')
|
score = memberInfo.get('score', '')
|
||||||
if End :
|
if End :
|
||||||
Log(f'执行后积分:【{score}】')
|
Log(f'执行后积分:【{score}】')
|
||||||
@ -84,22 +86,23 @@ class RUN:
|
|||||||
# add = {"nickname":nickname,"member_id":member_id}
|
# add = {"nickname":nickname,"member_id":member_id}
|
||||||
userid_list.append(self.member_id)
|
userid_list.append(self.member_id)
|
||||||
username_list.append(nickname)
|
username_list.append(nickname)
|
||||||
Log(f'>>>当前用户:【{nickname}】\nID:【{self.member_id}】 \nOpenID:【{openId}】 \n已连续签到【{signTimes}】天')
|
|
||||||
serialSign = data.get('serialSign', [{}])
|
serialSign = data.get('serialSign', [{}])
|
||||||
|
signTimes = data.get('signTimes', 0)
|
||||||
|
Log(f'>>>当前用户:【{nickname}】\nID:【{self.member_id}】 \nOpenID:【{openId}】 \n已连续签到【{signTimes}】天')
|
||||||
|
|
||||||
if serialSign :
|
if serialSign:
|
||||||
current_date = date.today()
|
current_date = date.today()
|
||||||
date_string = serialSign[0].get('createdAt',current_date)
|
date_string = serialSign[0].get('createdAt',current_date)
|
||||||
memberBalance = serialSign[0].get('memberBalance', 0)
|
memberBalance = serialSign[0].get('memberBalance', 0)
|
||||||
parsed_date = datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S').date()
|
parsed_date = datetime.strptime(date_string, '%Y-%m-%d %H:%M:%S').date()
|
||||||
if parsed_date == current_date:
|
if parsed_date == current_date:
|
||||||
print(f"今日已签到,当前积分:【{memberBalance}】")
|
print(f"今日已签到,当前积分:【{memberBalance}】")
|
||||||
else:
|
else:
|
||||||
print("今日未签到")
|
print("今日未签到")
|
||||||
wait_time = random.randint(1000, 10000) / 1000.0 # 转换为秒
|
wait_time = random.randint(1000, 10000) / 1000.0 # 转换为秒
|
||||||
time.sleep(wait_time)
|
time.sleep(wait_time)
|
||||||
print('随机延时1-10秒执行签到')
|
print('随机延时1-10秒执行签到')
|
||||||
self.dailySign()
|
self.dailySign()
|
||||||
return True
|
return True
|
||||||
except:
|
except:
|
||||||
print(response.text)
|
print(response.text)
|
||||||
@ -141,12 +144,33 @@ class RUN:
|
|||||||
id_list = resp['data']['chineseCookbook']['data']
|
id_list = resp['data']['chineseCookbook']['data']
|
||||||
for i in id_list:
|
for i in id_list:
|
||||||
Cookid_list.append(i['id'])
|
Cookid_list.append(i['id'])
|
||||||
|
# self.creatCookbookCode(i['id'])
|
||||||
print(f'>获取到菜谱ID:【{Cookid_list}】')
|
print(f'>获取到菜谱ID:【{Cookid_list}】')
|
||||||
except:
|
except:
|
||||||
print(response.text)
|
print(response.text)
|
||||||
else:
|
else:
|
||||||
print("API访问失败!")
|
print("API访问失败!")
|
||||||
|
|
||||||
|
def creatCookbookCode(self,cookbook_id):
|
||||||
|
|
||||||
|
data = {
|
||||||
|
'cookbook_id':cookbook_id
|
||||||
|
}
|
||||||
|
response = self.s.post(
|
||||||
|
f'{self.baseUrl}createCookbookCode',
|
||||||
|
headers=self.headers, data=data
|
||||||
|
)
|
||||||
|
if response.status_code == 200:
|
||||||
|
try:
|
||||||
|
resp = response.json()
|
||||||
|
data = resp.get('data',{})
|
||||||
|
code_url = data.get('code_url','')
|
||||||
|
print(f'创建分享链接成功:[{code_url}]')
|
||||||
|
except:
|
||||||
|
print(response.text)
|
||||||
|
else:
|
||||||
|
print("API访问失败!")
|
||||||
|
|
||||||
def recordScoreShare(self, cookbook_id, now_id):
|
def recordScoreShare(self, cookbook_id, now_id):
|
||||||
# print('')
|
# print('')
|
||||||
# self.getUserInfo()
|
# self.getUserInfo()
|
||||||
@ -195,19 +219,31 @@ class RUN:
|
|||||||
else:
|
else:
|
||||||
Log('助力对象为自身,跳过')
|
Log('助力对象为自身,跳过')
|
||||||
|
|
||||||
# 预留兑换函数
|
def exchange(self):
|
||||||
def exchangeIntegralNew(self):
|
|
||||||
data = {
|
data = {
|
||||||
'value': '爱奇艺月卡',
|
'phone': self.phone
|
||||||
'phone': '',
|
|
||||||
'type': '视频卡'
|
|
||||||
}
|
}
|
||||||
# data = {
|
huafei_li = ['全网10元话费', '全网20元话费']
|
||||||
# 'value': '全网10元话费',
|
videoCard_li = ['爱奇艺', '腾讯', '优酷']
|
||||||
# 'phone': '',
|
cardType = ['年卡', '季卡', '月卡', '周卡']
|
||||||
# 'type': '话费',
|
for card in huafei_li:
|
||||||
# 'memberId': '',
|
data['value'] = card
|
||||||
# }
|
data['type'] = '话费'
|
||||||
|
data['memberId'] = self.member_id
|
||||||
|
self.exchangeIntegralNew(data)
|
||||||
|
|
||||||
|
for card in cardType:
|
||||||
|
for video in videoCard_li:
|
||||||
|
cardname = video + card
|
||||||
|
data['value'] = cardname
|
||||||
|
data['type'] = '视频卡'
|
||||||
|
self.exchangeIntegralNew(data)
|
||||||
|
print(cardname)
|
||||||
|
|
||||||
|
|
||||||
|
# 预留兑换函数
|
||||||
|
def exchangeIntegralNew(self,data):
|
||||||
|
print(f'正在尝试兑换【{data["value"]}】')
|
||||||
response = self.s.post(
|
response = self.s.post(
|
||||||
f'{self.baseUrl}exchangeIntegralNew',
|
f'{self.baseUrl}exchangeIntegralNew',
|
||||||
headers=self.headers,
|
headers=self.headers,
|
||||||
@ -224,15 +260,18 @@ class RUN:
|
|||||||
print("API访问失败!")
|
print("API访问失败!")
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
# self.getUserInfo()
|
|
||||||
# self.getCookbookIndex()
|
|
||||||
if self.getUserInfo():
|
if self.getUserInfo():
|
||||||
if self.index == 1:
|
now = datetime.now().time()
|
||||||
self.getCookbookIndex()
|
start_time = times(23, 59, 59)
|
||||||
|
end_time = times(0, 5)
|
||||||
|
if start_time <= now <= end_time:
|
||||||
|
self.exchange()
|
||||||
|
self.getCookbookIndex()
|
||||||
self.getUserInfo(True)
|
self.getUserInfo(True)
|
||||||
self.sendMsg()
|
self.sendMsg()
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
self.sendMsg()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def help(self):
|
def help(self):
|
||||||
@ -245,6 +284,7 @@ class RUN:
|
|||||||
now_id = userid_list[self.index-1]
|
now_id = userid_list[self.index-1]
|
||||||
Log(f'\n当前用于助力用户:【{username}】 ID:【{now_id}】')
|
Log(f'\n当前用于助力用户:【{username}】 ID:【{now_id}】')
|
||||||
self.helpAuthor(662056, cookbook_id, now_id)
|
self.helpAuthor(662056, cookbook_id, now_id)
|
||||||
|
self.helpAuthor(662086, cookbook_id, now_id)
|
||||||
self.recordScoreShare(cookbook_id, now_id)
|
self.recordScoreShare(cookbook_id, now_id)
|
||||||
self.sendMsg(True)
|
self.sendMsg(True)
|
||||||
return True
|
return True
|
||||||
@ -316,29 +356,32 @@ if __name__ == '__main__':
|
|||||||
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
||||||
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
✨ ✨ 注意:token有效期7天,7天后重新抓
|
✨ ✨ 注意:token有效期7天,7天后重新抓
|
||||||
✨ 推荐cron:5 8 * * *
|
✨ 推荐cron:0 0,8 * *
|
||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.06'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
print(token)
|
# print(token)
|
||||||
if not token:
|
if not token:
|
||||||
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
||||||
exit()
|
exit()
|
||||||
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
||||||
print(tokens)
|
# print(tokens)
|
||||||
Cookid_list = []
|
Cookid_list = []
|
||||||
userid_list = []
|
userid_list = []
|
||||||
username_list = []
|
username_list = []
|
||||||
|
|||||||
372
KGZJ.py
Executable file
372
KGZJ.py
Executable file
@ -0,0 +1,372 @@
|
|||||||
|
# !/usr/bin/python3
|
||||||
|
# -- coding: utf-8 --
|
||||||
|
# -------------------------------
|
||||||
|
# cron "30 9 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
|
# const $ = new Env('宽哥之家小程序')
|
||||||
|
|
||||||
|
import os
|
||||||
|
import random
|
||||||
|
import time
|
||||||
|
|
||||||
|
import requests
|
||||||
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
|
# import CHERWIN_TOOLS
|
||||||
|
# 禁用安全请求警告
|
||||||
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
IS_DEV = False
|
||||||
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
|
|
||||||
|
if os.path.isfile('notify.py'):
|
||||||
|
from notify import send
|
||||||
|
print("加载通知服务成功!")
|
||||||
|
else:
|
||||||
|
print("加载通知服务失败!")
|
||||||
|
send_msg = ''
|
||||||
|
one_msg=''
|
||||||
|
def Log(cont=''):
|
||||||
|
global send_msg,one_msg
|
||||||
|
print(cont)
|
||||||
|
if cont:
|
||||||
|
one_msg += f'{cont}\n'
|
||||||
|
send_msg += f'{cont}\n'
|
||||||
|
|
||||||
|
class RUN:
|
||||||
|
def __init__(self,info,index):
|
||||||
|
global one_msg
|
||||||
|
one_msg = ''
|
||||||
|
split_info = info.split('@')
|
||||||
|
self.token = split_info[0]
|
||||||
|
len_split_info = len(split_info)
|
||||||
|
last_info = split_info[len_split_info - 1]
|
||||||
|
self.send_UID = None
|
||||||
|
if len_split_info > 0 and "UID_" in last_info:
|
||||||
|
self.send_UID = last_info
|
||||||
|
self.index = index + 1
|
||||||
|
Log(f"\n---------开始执行第{self.index}个账号>>>>>")
|
||||||
|
self.s = requests.session()
|
||||||
|
self.s.verify = False
|
||||||
|
|
||||||
|
self.headers = {
|
||||||
|
'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 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090a13) XWEB/9129',
|
||||||
|
'Host': 'shop.sctobacco.com',
|
||||||
|
'Connection': 'keep-alive',
|
||||||
|
'xweb_xhr': '1',
|
||||||
|
'gray': '0',
|
||||||
|
'token': self.token,
|
||||||
|
'Accept': '*/*',
|
||||||
|
'Sec-Fetch-Site': 'cross-site',
|
||||||
|
'Sec-Fetch-Mode': 'cors',
|
||||||
|
'Sec-Fetch-Dest': 'empty',
|
||||||
|
'Referer': 'https://servicewechat.com/wxb6bc0796e0f0db00/224/page-frame.html',
|
||||||
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
|
'Accept-Language': 'zh-CN,zh;q=0.9'
|
||||||
|
}
|
||||||
|
self.s.headers.update(self.headers)
|
||||||
|
|
||||||
|
|
||||||
|
def do_request(self, url, method='POST',params=None, data=None, headers=None):
|
||||||
|
|
||||||
|
try:
|
||||||
|
response = self.s.request(method, url, params=params, json=data, headers=headers)
|
||||||
|
response.raise_for_status()
|
||||||
|
return response.json()
|
||||||
|
except Exception as e:
|
||||||
|
print(f"请求错误: {e}")
|
||||||
|
return None
|
||||||
|
|
||||||
|
def personal_info(self):
|
||||||
|
Log(f'======= 查询用户信息 =======')
|
||||||
|
personal_info_valid = False
|
||||||
|
try:
|
||||||
|
# 发送GET请求
|
||||||
|
response = self.do_request('https://shop.sctobacco.com/api/mc-server/mypage/simpleInfo',method='GET')
|
||||||
|
# 检查请求是否成功
|
||||||
|
if response.get('code','-1'):
|
||||||
|
personal_info_valid = True
|
||||||
|
data = response.get('data', {})
|
||||||
|
mobile_phone = data.get('phone','')
|
||||||
|
self.name = data.get('nickname','')
|
||||||
|
unionId = data.get('unionId','')
|
||||||
|
self.mobile_phone = mobile_phone[:3] + "*" * 4 + mobile_phone[7:]
|
||||||
|
# 提取个人信息
|
||||||
|
Log(f">>账号[{self.index}]登陆成功!✅\n用户名:【{self.name}】 \n手机号:【{self.mobile_phone}】")
|
||||||
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
|
message = response.get('msg', '')
|
||||||
|
Log(f'>>登录失败❌: {message}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获任何异常并打印
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
# 最终返回请求是否成功的标志
|
||||||
|
return personal_info_valid
|
||||||
|
|
||||||
|
def myTask(self):
|
||||||
|
print(f'======= 查询任务列表 =======')
|
||||||
|
try:
|
||||||
|
|
||||||
|
# 发送GET请求
|
||||||
|
response = self.do_request('https://shop.sctobacco.com/api/mc-server/mcTask/myTask',method='GET')
|
||||||
|
# 检查请求是否成功
|
||||||
|
if response.get('code','-1'):
|
||||||
|
data = response.get('data', {})
|
||||||
|
taskList = data.get('taskList',[{}])
|
||||||
|
skip_task =[50001,50002,30002]
|
||||||
|
for task in taskList:
|
||||||
|
taskName = task.get('taskName', '')
|
||||||
|
taskId = task.get('taskId', '')
|
||||||
|
isCompleted = task.get('isCompleted', '0')
|
||||||
|
print(f'>>当前任务:【{taskName}】')
|
||||||
|
if taskId in skip_task:
|
||||||
|
print('>暂不支持,跳过❌')
|
||||||
|
continue
|
||||||
|
if isCompleted != '0' :
|
||||||
|
print('>已完成,跳过✅')
|
||||||
|
continue
|
||||||
|
if taskId == 30016:
|
||||||
|
self.SignSubmit()
|
||||||
|
elif taskId == 30004:
|
||||||
|
self.listForMobile()
|
||||||
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
|
message = response.get('msg', '')
|
||||||
|
Log(f'查询任务列表失败❌: {message}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获任何异常并打印
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def get_score(self):
|
||||||
|
Log(f'======= 获取积分信息 =======')
|
||||||
|
try:
|
||||||
|
timestamp = int(time.time() * 1000)
|
||||||
|
# 发送GET请求
|
||||||
|
response = self.do_request(f'https://shop.sctobacco.com/api/sc-server/log/detail?scoreTypeId=jifen001',method='GET')
|
||||||
|
# 检查请求是否成功
|
||||||
|
if response.get('code','-1'):
|
||||||
|
data = response.get('data', {})
|
||||||
|
if data:
|
||||||
|
scoreTypeName = data.get('scoreTypeName', '')
|
||||||
|
totalScore = data.get('totalScore', '')
|
||||||
|
Log(f'>当前{scoreTypeName}:【{totalScore}】✅')
|
||||||
|
else:
|
||||||
|
Log('>获取积分信息失败❌')
|
||||||
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
|
message = response.get('msg', '')
|
||||||
|
Log(f'获取积分信息失败❌: {message}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获任何异常并打印
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def SignSubmit(self):
|
||||||
|
Log(f'======= 签到 =======')
|
||||||
|
try:
|
||||||
|
timestamp = int(time.time() * 1000)
|
||||||
|
# 发送GET请求
|
||||||
|
response = self.do_request(f'https://shop.sctobacco.com/api/ac-server/manage/acSignMemberLog/SignSubmit?t={timestamp}',method='GET')
|
||||||
|
# 检查请求是否成功
|
||||||
|
if response.get('code','-1'):
|
||||||
|
data = response.get('data', '')
|
||||||
|
if data:
|
||||||
|
Log(f'>签到成功✅,获得{data}积分')
|
||||||
|
else:
|
||||||
|
Log('>签到失败❌')
|
||||||
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
|
message = response.get('msg', '')
|
||||||
|
Log(f'签到失败❌: {message}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获任何异常并打印
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
|
def listForMobile(self):
|
||||||
|
Log(f'======= 获取文章列表 =======')
|
||||||
|
try:
|
||||||
|
timestamp = int(time.time() * 1000)
|
||||||
|
# 发送GET请求
|
||||||
|
response = self.do_request(f'https://shop.sctobacco.com/api/mc-server/mcMedia/listForMobile?t={timestamp}&offset=0&limit=10&isShow=1',method='GET')
|
||||||
|
# 检查请求是否成功
|
||||||
|
if response.get('code','-1'):
|
||||||
|
data = response.get('data', {})
|
||||||
|
rows = response.get('rows', [{}])
|
||||||
|
random_element = random.choice(rows)
|
||||||
|
if random_element:
|
||||||
|
Log(f'>>>获取文章列表成功✅')
|
||||||
|
appid = random_element['appid']
|
||||||
|
title = random_element['title']
|
||||||
|
mediaId = random_element['mediaId']
|
||||||
|
Log(f'>>前选择文章:【{title}】 appid:{appid} mediaId:{mediaId}')
|
||||||
|
self.clickMedia(mediaId,appid)
|
||||||
|
else:
|
||||||
|
Log('>>获取文章列表失败❌')
|
||||||
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
|
message = response.get('msg', '')
|
||||||
|
Log(f'获取文章列表失败❌: {message}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获任何异常并打印
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def clickMedia(self,mediaId,appid):
|
||||||
|
Log(f'======= 阅读文章 =======')
|
||||||
|
try:
|
||||||
|
parmas={
|
||||||
|
'mpMediaId':mediaId,
|
||||||
|
'mediaId':mediaId,
|
||||||
|
'appid' :appid
|
||||||
|
}
|
||||||
|
# 发送GET请求
|
||||||
|
response = self.do_request(f'https://shop.sctobacco.com/api/mc-server/mcMedia/clickMedia',method='GET',params=parmas)
|
||||||
|
# 检查请求是否成功
|
||||||
|
if response.get('code','-1'):
|
||||||
|
message = response.get('message', {})
|
||||||
|
if message == "success":
|
||||||
|
Log(f'>阅读文章成功✅')
|
||||||
|
else:
|
||||||
|
Log('>阅读文章失败❌')
|
||||||
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
|
message = response.get('msg', '')
|
||||||
|
Log(f'阅读文章❌: {message}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获任何异常并打印
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def clickMedia(self,mediaId,appid):
|
||||||
|
Log(f'======= 阅读文章 =======')
|
||||||
|
try:
|
||||||
|
parmas={
|
||||||
|
'mpMediaId':mediaId,
|
||||||
|
'mediaId':mediaId,
|
||||||
|
'appid' :appid
|
||||||
|
}
|
||||||
|
# 发送GET请求
|
||||||
|
response = self.do_request(f'https://shop.sctobacco.com/api/mc-server/mcMedia/clickMedia',method='GET',params=parmas)
|
||||||
|
# 检查请求是否成功
|
||||||
|
if response.get('code','-1'):
|
||||||
|
message = response.get('message', {})
|
||||||
|
if message == "success":
|
||||||
|
Log(f'>阅读文章成功✅')
|
||||||
|
else:
|
||||||
|
Log('>阅读文章失败❌')
|
||||||
|
else:
|
||||||
|
# 如果请求不成功,则打印错误信息
|
||||||
|
message = response.get('msg', '')
|
||||||
|
Log(f'阅读文章❌: {message}')
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获任何异常并打印
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
if not self.personal_info() :
|
||||||
|
Log("用户信息无效,请更新CK")
|
||||||
|
self.sendMsg()
|
||||||
|
return False
|
||||||
|
self.myTask()
|
||||||
|
self.get_score()
|
||||||
|
self.sendMsg()
|
||||||
|
return True
|
||||||
|
|
||||||
|
def sendMsg(self, help=False):
|
||||||
|
if self.send_UID:
|
||||||
|
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
||||||
|
print(push_res)
|
||||||
|
|
||||||
|
|
||||||
|
def down_file(filename, file_url):
|
||||||
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
|
try:
|
||||||
|
response = requests.get(file_url, verify=False, timeout=10)
|
||||||
|
response.raise_for_status()
|
||||||
|
with open(filename + '.tmp', 'wb') as f:
|
||||||
|
f.write(response.content)
|
||||||
|
print(f'【{filename}】下载完成!')
|
||||||
|
|
||||||
|
# 检查临时文件是否存在
|
||||||
|
temp_filename = filename + '.tmp'
|
||||||
|
if os.path.exists(temp_filename):
|
||||||
|
# 删除原有文件
|
||||||
|
if os.path.exists(filename):
|
||||||
|
os.remove(filename)
|
||||||
|
# 重命名临时文件
|
||||||
|
os.rename(temp_filename, filename)
|
||||||
|
print(f'【{filename}】重命名成功!')
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
print(f'【{filename}】临时文件不存在!')
|
||||||
|
return False
|
||||||
|
except Exception as e:
|
||||||
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
|
return False
|
||||||
|
|
||||||
|
def import_Tools():
|
||||||
|
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
|
import CHERWIN_TOOLS
|
||||||
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
APP_NAME = '宽哥之家小程序'
|
||||||
|
ENV_NAME = 'KGZJ'
|
||||||
|
CK_NAME = 'token'
|
||||||
|
print(f'''
|
||||||
|
✨✨✨ {APP_NAME}签到✨✨✨
|
||||||
|
✨ 功能:
|
||||||
|
积分签到
|
||||||
|
✨ 抓包步骤:
|
||||||
|
打开{APP_NAME}
|
||||||
|
授权登陆
|
||||||
|
打开抓包工具
|
||||||
|
找请求头带{CK_NAME}的URl
|
||||||
|
复制里面的{CK_NAME}参数值
|
||||||
|
✨ ✨✨wxpusher一对一推送功能,
|
||||||
|
✨需要定义变量export WXPUSHER=wxpusher的app_token,不设置则不启用wxpusher一对一推送
|
||||||
|
✨需要在{ENV_NAME}变量最后添加@wxpusher的UID
|
||||||
|
参数示例:1790314xxxxxx@UID_xxxxx
|
||||||
|
✨ 设置青龙变量:
|
||||||
|
export {ENV_NAME}='{CK_NAME}参数值'多账号#或&分割
|
||||||
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
|
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
||||||
|
✨ 推荐cron:5 8 * * *
|
||||||
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
|
''')
|
||||||
|
local_script_name = os.path.basename(__file__)
|
||||||
|
local_version = '2024.05.15'
|
||||||
|
if IS_DEV:
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
|
print(TIPS)
|
||||||
|
token = ''
|
||||||
|
token = ENV if ENV else token
|
||||||
|
if not token:
|
||||||
|
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
||||||
|
exit()
|
||||||
|
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
||||||
|
# print(tokens)
|
||||||
|
if len(tokens) > 0:
|
||||||
|
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
||||||
|
for index, infos in enumerate(tokens):
|
||||||
|
run_result = RUN(infos, index).main()
|
||||||
|
if not run_result: continue
|
||||||
|
if send: send(f'{APP_NAME}挂机通知', f'{send_msg}\n{TIPS_HTML}')
|
||||||
18
KKYP.py
Normal file → Executable file
18
KKYP.py
Normal file → Executable file
@ -10,8 +10,11 @@ import requests
|
|||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -159,16 +162,19 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.05.04'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
|
|||||||
21
LSXDS.py
Normal file → Executable file
21
LSXDS.py
Normal file → Executable file
@ -14,9 +14,11 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
# import CHERWIN_TOOLS
|
# import CHERWIN_TOOLS
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
#
|
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -368,16 +370,19 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.05.08'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
@ -394,4 +399,4 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
s.verify = False
|
s.verify = False
|
||||||
run_result = RUN(infos, index).main()
|
run_result = RUN(infos, index).main()
|
||||||
if not run_result: continue
|
if not run_result: continue
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
18
MXBC.py
Normal file → Executable file
18
MXBC.py
Normal file → Executable file
@ -20,8 +20,11 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
|
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -300,16 +303,19 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.15'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
|
|||||||
676
NXDD.py
676
NXDD.py
@ -1,335 +1,341 @@
|
|||||||
# !/usr/bin/python3
|
# !/usr/bin/python3
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# @Author CHERWIN✨✨✨
|
# @Author CHERWIN✨✨✨
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "30 1 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "30 1 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('奈雪小程序签到')
|
# const $ = new Env('奈雪小程序签到')
|
||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import requests
|
import requests
|
||||||
import hashlib
|
import hashlib
|
||||||
import hmac
|
import hmac
|
||||||
import base64
|
import base64
|
||||||
import time
|
import time
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
|
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
|
||||||
import DEV_ENV
|
IS_DEV = False
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
from notify import send
|
import DEV_ENV
|
||||||
print("加载通知服务成功!")
|
IS_DEV = True
|
||||||
else:
|
if os.path.isfile('notify.py'):
|
||||||
print("加载通知服务失败!")
|
from notify import send
|
||||||
send_msg = ''
|
print("加载通知服务成功!")
|
||||||
one_msg=''
|
else:
|
||||||
def Log(cont=''):
|
print("加载通知服务失败!")
|
||||||
global send_msg,one_msg
|
send_msg = ''
|
||||||
print(cont)
|
one_msg=''
|
||||||
if cont:
|
def Log(cont=''):
|
||||||
one_msg += f'{cont}\n'
|
global send_msg,one_msg
|
||||||
send_msg += f'{cont}\n'
|
print(cont)
|
||||||
|
if cont:
|
||||||
class RUN:
|
one_msg += f'{cont}\n'
|
||||||
def __init__(self,info,index):
|
send_msg += f'{cont}\n'
|
||||||
global one_msg
|
|
||||||
one_msg = ''
|
class RUN:
|
||||||
split_info = info.split('@')
|
def __init__(self,info,index):
|
||||||
token = split_info[0]
|
global one_msg
|
||||||
len_split_info = len(split_info)
|
one_msg = ''
|
||||||
last_info = split_info[len_split_info - 1]
|
split_info = info.split('@')
|
||||||
self.send_UID = None
|
token = split_info[0]
|
||||||
if len_split_info > 0 and "UID_" in last_info:
|
len_split_info = len(split_info)
|
||||||
print('检测到设置了UID')
|
last_info = split_info[len_split_info - 1]
|
||||||
print(last_info)
|
self.send_UID = None
|
||||||
self.send_UID = last_info
|
if len_split_info > 0 and "UID_" in last_info:
|
||||||
self.index = index + 1
|
print('检测到设置了UID')
|
||||||
self.s = requests.session()
|
print(last_info)
|
||||||
self.s.verify = False
|
self.send_UID = last_info
|
||||||
|
self.index = index + 1
|
||||||
self.token = f'Bearer {token}'
|
self.s = requests.session()
|
||||||
self.UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6945'
|
self.s.verify = False
|
||||||
self.openId = 'QL6ZOftGzbziPlZwfiXM'
|
|
||||||
|
self.token = f'Bearer {token}'
|
||||||
def random_string(self,length=6, chars='123456789'):
|
self.UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.102 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF XWEB/6945'
|
||||||
return ''.join(random.choice(chars) for _ in range(length))
|
self.openId = 'QL6ZOftGzbziPlZwfiXM'
|
||||||
|
|
||||||
def get_body(self):
|
def random_string(self,length=6, chars='123456789'):
|
||||||
nonce = int(self.random_string())
|
return ''.join(random.choice(chars) for _ in range(length))
|
||||||
timestamp = int(time.time())
|
|
||||||
url_path = f'nonce={nonce}&openId={self.openId}×tamp={timestamp}'
|
def get_body(self):
|
||||||
signature = base64.b64encode(
|
nonce = int(self.random_string())
|
||||||
hmac.new('sArMTldQ9tqU19XIRDMWz7BO5WaeBnrezA'.encode(), url_path.encode(), hashlib.sha1).digest()).decode()
|
timestamp = int(time.time())
|
||||||
common = {
|
url_path = f'nonce={nonce}&openId={self.openId}×tamp={timestamp}'
|
||||||
'platform': 'wxapp',
|
signature = base64.b64encode(
|
||||||
'version': '5.1.8',
|
hmac.new('sArMTldQ9tqU19XIRDMWz7BO5WaeBnrezA'.encode(), url_path.encode(), hashlib.sha1).digest()).decode()
|
||||||
'imei': '',
|
common = {
|
||||||
'osn': 'microsoft',
|
'platform': 'wxapp',
|
||||||
'sv': 'Windows 10 x64',
|
'version': '5.1.8',
|
||||||
'lang': 'zh_CN',
|
'imei': '',
|
||||||
'currency': 'CNY',
|
'osn': 'microsoft',
|
||||||
'timeZone': '',
|
'sv': 'Windows 10 x64',
|
||||||
'nonce': nonce,
|
'lang': 'zh_CN',
|
||||||
'openId': self.openId,
|
'currency': 'CNY',
|
||||||
'timestamp': timestamp,
|
'timeZone': '',
|
||||||
'signature': signature
|
'nonce': nonce,
|
||||||
}
|
'openId': self.openId,
|
||||||
params = {
|
'timestamp': timestamp,
|
||||||
'businessType': 1,
|
'signature': signature
|
||||||
'brand': 26000252,
|
}
|
||||||
'tenantId': 1,
|
params = {
|
||||||
'channel': 2,
|
'businessType': 1,
|
||||||
'stallType': None,
|
'brand': 26000252,
|
||||||
'storeId': None
|
'tenantId': 1,
|
||||||
}
|
'channel': 2,
|
||||||
|
'stallType': None,
|
||||||
requestData = {
|
'storeId': None
|
||||||
'common': common,
|
}
|
||||||
'params': params
|
|
||||||
}
|
requestData = {
|
||||||
return requestData
|
'common': common,
|
||||||
|
'params': params
|
||||||
def task_api(self,api_options=None):
|
}
|
||||||
if api_options is None:
|
return requestData
|
||||||
api_options = {}
|
|
||||||
try:
|
def task_api(self,api_options=None):
|
||||||
# 首先解析URL,获得主机名
|
if api_options is None:
|
||||||
host_name = api_options['url'].replace('//', '/').split('/')[1]
|
api_options = {}
|
||||||
full_url = api_options['url']
|
try:
|
||||||
if 'queryParam' in api_options:
|
# 首先解析URL,获得主机名
|
||||||
# 如果存在查询参数,将其附加到URL
|
host_name = api_options['url'].replace('//', '/').split('/')[1]
|
||||||
query_str = "&".join(f"{k}={v}" for k, v in api_options['queryParam'].items())
|
full_url = api_options['url']
|
||||||
full_url += '?' + query_str
|
if 'queryParam' in api_options:
|
||||||
# 定义请求头
|
# 如果存在查询参数,将其附加到URL
|
||||||
headers = {
|
query_str = "&".join(f"{k}={v}" for k, v in api_options['queryParam'].items())
|
||||||
'Host': host_name,
|
full_url += '?' + query_str
|
||||||
'Connection': 'keep-alive',
|
# 定义请求头
|
||||||
'User-Agent': self.UA,
|
headers = {
|
||||||
'Authorization': self.token,
|
'Host': host_name,
|
||||||
'Referer': 'https://tm-web.pin-dao.cn/',
|
'Connection': 'keep-alive',
|
||||||
'Origin': 'https://tm-web.pin-dao.cn'
|
'User-Agent': self.UA,
|
||||||
}
|
'Authorization': self.token,
|
||||||
# 准备请求体
|
'Referer': 'https://tm-web.pin-dao.cn/',
|
||||||
data = None
|
'Origin': 'https://tm-web.pin-dao.cn'
|
||||||
if 'body' in api_options:
|
}
|
||||||
body = self.get_body()
|
# 准备请求体
|
||||||
body['params'].update(api_options['body'])
|
data = None
|
||||||
content_type = api_options.get('Content-Type', 'application/json')
|
if 'body' in api_options:
|
||||||
headers['Content-Type'] = content_type
|
body = self.get_body()
|
||||||
if 'json' in content_type:
|
body['params'].update(api_options['body'])
|
||||||
data = json.dumps(body)
|
content_type = api_options.get('Content-Type', 'application/json')
|
||||||
else:
|
headers['Content-Type'] = content_type
|
||||||
data = "&".join(f"{k}={json.dumps(v) if isinstance(v, dict) else v}" for k, v in body.items())
|
if 'json' in content_type:
|
||||||
headers['Content-Length'] = str(len(data))
|
data = json.dumps(body)
|
||||||
# 如果有额外的URL参数或头部参数,合并到请求中
|
else:
|
||||||
if 'urlObjectParam' in api_options:
|
data = "&".join(f"{k}={json.dumps(v) if isinstance(v, dict) else v}" for k, v in body.items())
|
||||||
# 这里根据需要处理urlObjectParam
|
headers['Content-Length'] = str(len(data))
|
||||||
pass
|
# 如果有额外的URL参数或头部参数,合并到请求中
|
||||||
if 'headerParam' in api_options:
|
if 'urlObjectParam' in api_options:
|
||||||
headers.update(api_options['headerParam'])
|
# 这里根据需要处理urlObjectParam
|
||||||
# 发出请求
|
pass
|
||||||
response = requests.request(method=api_options.get('method', 'GET'), url=full_url, headers=headers,
|
if 'headerParam' in api_options:
|
||||||
data=data, timeout=20,verify=False)
|
headers.update(api_options['headerParam'])
|
||||||
# 打印状态码
|
# 发出请求
|
||||||
if response.status_code != 200:
|
response = requests.request(method=api_options.get('method', 'GET'), url=full_url, headers=headers,
|
||||||
print(f"[{api_options.get('fn', 'unknown function')}]返回[{response.status_code}]")
|
data=data, timeout=20,verify=False)
|
||||||
|
# 打印状态码
|
||||||
# 解析结果
|
if response.status_code != 200:
|
||||||
try:
|
print(f"[{api_options.get('fn', 'unknown function')}]返回[{response.status_code}]")
|
||||||
result = response.json()
|
|
||||||
except ValueError:
|
# 解析结果
|
||||||
result = response.text
|
try:
|
||||||
return result
|
result = response.json()
|
||||||
|
except ValueError:
|
||||||
except Exception as e:
|
result = response.text
|
||||||
print(str(e))
|
return result
|
||||||
return {}
|
|
||||||
|
except Exception as e:
|
||||||
def base_userinfo(self):
|
print(str(e))
|
||||||
try:
|
return {}
|
||||||
api_options = {
|
|
||||||
'fn': 'baseUserinfo',
|
def base_userinfo(self):
|
||||||
'method': 'post',
|
try:
|
||||||
'url': 'https://tm-web.pin-dao.cn/user/base-userinfo',
|
api_options = {
|
||||||
'body': {}
|
'fn': 'baseUserinfo',
|
||||||
}
|
'method': 'post',
|
||||||
response = self.task_api(api_options)
|
'url': 'https://tm-web.pin-dao.cn/user/base-userinfo',
|
||||||
if response['code'] == 0:
|
'body': {}
|
||||||
# 登录成功的逻辑处理
|
}
|
||||||
phone = response['data']['phone']
|
response = self.task_api(api_options)
|
||||||
self.phone = phone[:3] + "*" * 4 + phone[7:]
|
if response['code'] == 0:
|
||||||
self.userId = response['data']['userId']
|
# 登录成功的逻辑处理
|
||||||
self.nickName = response['data']['nickName']
|
phone = response['data']['phone']
|
||||||
Log(f'账号[{self.index}]登录成功!\n手机号:[{self.phone}] ID[{self.userId}]')
|
self.phone = phone[:3] + "*" * 4 + phone[7:]
|
||||||
# print(one_msg)
|
self.userId = response['data']['userId']
|
||||||
return True
|
self.nickName = response['data']['nickName']
|
||||||
else:
|
Log(f'账号[{self.index}]登录成功!\n手机号:[{self.phone}] ID[{self.userId}]')
|
||||||
# 登录失败的逻辑处理
|
# print(one_msg)
|
||||||
Log(f"账号登录失败: {response['message']}")
|
return True
|
||||||
except Exception as e:
|
else:
|
||||||
print(e)
|
# 登录失败的逻辑处理
|
||||||
|
Log(f"账号登录失败: {response['message']}")
|
||||||
def user_account(self):
|
except Exception as e:
|
||||||
try:
|
print(e)
|
||||||
api_options = {
|
|
||||||
'fn': 'userAccount',
|
def user_account(self):
|
||||||
'method': 'post',
|
try:
|
||||||
'url': 'https://tm-web.pin-dao.cn/user/account/user-account',
|
api_options = {
|
||||||
'body': {}
|
'fn': 'userAccount',
|
||||||
}
|
'method': 'post',
|
||||||
response = self.task_api(api_options)
|
'url': 'https://tm-web.pin-dao.cn/user/account/user-account',
|
||||||
if response['code'] == 0:
|
'body': {}
|
||||||
# 查询成功的逻辑处理
|
}
|
||||||
coin = response['data']['coin']
|
response = self.task_api(api_options)
|
||||||
Log(f'账号[{self.index}]当前奈雪币: {coin}')
|
if response['code'] == 0:
|
||||||
else:
|
# 查询成功的逻辑处理
|
||||||
# 查询失败的逻辑处理
|
coin = response['data']['coin']
|
||||||
Log(f'账号[{self.index}]查询失败')
|
Log(f'账号[{self.index}]当前奈雪币: {coin}')
|
||||||
except Exception as e:
|
else:
|
||||||
print(e)
|
# 查询失败的逻辑处理
|
||||||
|
Log(f'账号[{self.index}]查询失败')
|
||||||
def sign_record(self):
|
except Exception as e:
|
||||||
try:
|
print(e)
|
||||||
sign_date = datetime.datetime.now().replace(day=1).strftime('%Y-%m-%d')
|
|
||||||
today_date = datetime.datetime.now().strftime('%Y-%m-%d')
|
def sign_record(self):
|
||||||
api_options = {
|
try:
|
||||||
'fn': 'signRecord',
|
sign_date = datetime.datetime.now().replace(day=1).strftime('%Y-%m-%d')
|
||||||
'method': 'post',
|
today_date = datetime.datetime.now().strftime('%Y-%m-%d')
|
||||||
'url': 'https://tm-web.pin-dao.cn/user/sign/records',
|
api_options = {
|
||||||
'body': {
|
'fn': 'signRecord',
|
||||||
'signDate': sign_date,
|
'method': 'post',
|
||||||
'startDate': today_date
|
'url': 'https://tm-web.pin-dao.cn/user/sign/records',
|
||||||
}
|
'body': {
|
||||||
}
|
'signDate': sign_date,
|
||||||
response = self.task_api(api_options)
|
'startDate': today_date
|
||||||
if response['code'] == 0:
|
}
|
||||||
Log(f"今天{'已' if response['data']['status'] else '未'}签到,已签到{response['data']['signCount']}天")
|
}
|
||||||
if not response['data']['status']:
|
response = self.task_api(api_options)
|
||||||
self.sign_save()
|
if response['code'] == 0:
|
||||||
else:
|
Log(f"今天{'已' if response['data']['status'] else '未'}签到,已签到{response['data']['signCount']}天")
|
||||||
Log(f"查询签到失败: {response['message']}")
|
if not response['data']['status']:
|
||||||
except Exception as e:
|
self.sign_save()
|
||||||
print(e)
|
else:
|
||||||
|
Log(f"查询签到失败: {response['message']}")
|
||||||
def sign_save(self):
|
except Exception as e:
|
||||||
try:
|
print(e)
|
||||||
sign_date = datetime.datetime.now().strftime('%Y-%m-%d')
|
|
||||||
api_options = {
|
def sign_save(self):
|
||||||
'fn': 'signSave',
|
try:
|
||||||
'method': 'post',
|
sign_date = datetime.datetime.now().strftime('%Y-%m-%d')
|
||||||
'url': 'https://tm-web.pin-dao.cn/user/sign/save',
|
api_options = {
|
||||||
'body': {
|
'fn': 'signSave',
|
||||||
'signDate': sign_date
|
'method': 'post',
|
||||||
}
|
'url': 'https://tm-web.pin-dao.cn/user/sign/save',
|
||||||
}
|
'body': {
|
||||||
response = self.task_api(api_options)
|
'signDate': sign_date
|
||||||
if response['code'] == 0:
|
}
|
||||||
if response['data']['flag']:
|
}
|
||||||
Log('签到成功')
|
response = self.task_api(api_options)
|
||||||
else:
|
if response['code'] == 0:
|
||||||
Log('今天已经签到过了')
|
if response['data']['flag']:
|
||||||
else:
|
Log('签到成功')
|
||||||
print(f"签到失败: {response['message']}")
|
else:
|
||||||
except Exception as e:
|
Log('今天已经签到过了')
|
||||||
print(e)
|
else:
|
||||||
|
print(f"签到失败: {response['message']}")
|
||||||
def main(self):
|
except Exception as e:
|
||||||
Log(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
print(e)
|
||||||
base_userinfo_result = self.base_userinfo()
|
|
||||||
if not base_userinfo_result:
|
def main(self):
|
||||||
Log("用户信息无效,请更新CK")
|
Log(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
||||||
return False
|
base_userinfo_result = self.base_userinfo()
|
||||||
self.sign_record()
|
if not base_userinfo_result:
|
||||||
self.user_account()
|
Log("用户信息无效,请更新CK")
|
||||||
self.sendMsg()
|
return False
|
||||||
return True
|
self.sign_record()
|
||||||
|
self.user_account()
|
||||||
def sendMsg(self, help=False):
|
self.sendMsg()
|
||||||
if self.send_UID:
|
return True
|
||||||
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
|
||||||
print(push_res)
|
def sendMsg(self, help=False):
|
||||||
|
if self.send_UID:
|
||||||
|
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
||||||
def down_file(filename, file_url):
|
print(push_res)
|
||||||
print(f'开始下载:{filename},下载地址:{file_url}')
|
|
||||||
try:
|
|
||||||
response = requests.get(file_url, verify=False, timeout=10)
|
def down_file(filename, file_url):
|
||||||
response.raise_for_status()
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
with open(filename + '.tmp', 'wb') as f:
|
try:
|
||||||
f.write(response.content)
|
response = requests.get(file_url, verify=False, timeout=10)
|
||||||
print(f'【{filename}】下载完成!')
|
response.raise_for_status()
|
||||||
|
with open(filename + '.tmp', 'wb') as f:
|
||||||
# 检查临时文件是否存在
|
f.write(response.content)
|
||||||
temp_filename = filename + '.tmp'
|
print(f'【{filename}】下载完成!')
|
||||||
if os.path.exists(temp_filename):
|
|
||||||
# 删除原有文件
|
# 检查临时文件是否存在
|
||||||
if os.path.exists(filename):
|
temp_filename = filename + '.tmp'
|
||||||
os.remove(filename)
|
if os.path.exists(temp_filename):
|
||||||
# 重命名临时文件
|
# 删除原有文件
|
||||||
os.rename(temp_filename, filename)
|
if os.path.exists(filename):
|
||||||
print(f'【{filename}】重命名成功!')
|
os.remove(filename)
|
||||||
return True
|
# 重命名临时文件
|
||||||
else:
|
os.rename(temp_filename, filename)
|
||||||
print(f'【{filename}】临时文件不存在!')
|
print(f'【{filename}】重命名成功!')
|
||||||
return False
|
return True
|
||||||
except Exception as e:
|
else:
|
||||||
print(f'【{filename}】下载失败:{str(e)}')
|
print(f'【{filename}】临时文件不存在!')
|
||||||
return False
|
return False
|
||||||
|
except Exception as e:
|
||||||
def import_Tools():
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
return False
|
||||||
import CHERWIN_TOOLS
|
|
||||||
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
def import_Tools():
|
||||||
|
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
if __name__ == '__main__':
|
import CHERWIN_TOOLS
|
||||||
APP_NAME = '奈雪点单小程序'
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
||||||
ENV_NAME = 'NXDD'
|
|
||||||
CK_NAME = 'Authorization'
|
if __name__ == '__main__':
|
||||||
print(f'''
|
APP_NAME = '奈雪点单小程序'
|
||||||
✨✨✨ {APP_NAME}签到✨✨✨
|
ENV_NAME = 'NXDD'
|
||||||
✨ 功能:
|
CK_NAME = 'Authorization'
|
||||||
积分签到
|
print(f'''
|
||||||
✨ 抓包步骤:
|
✨✨✨ {APP_NAME}签到✨✨✨
|
||||||
打开{APP_NAME}
|
✨ 功能:
|
||||||
授权登陆
|
积分签到
|
||||||
打开抓包工具
|
✨ 抓包步骤:
|
||||||
找请求头带{CK_NAME}的URl
|
打开{APP_NAME}
|
||||||
复制里面的{CK_NAME}参数值【不要】前面的Bearer 【不要】前面的Bearer 【不要】前面的Bearer
|
授权登陆
|
||||||
参数示例:eyJhbGciOiJxxxxxxxxxxxx
|
打开抓包工具
|
||||||
✨ 设置青龙变量:
|
找请求头带{CK_NAME}的URl
|
||||||
export {ENV_NAME}='{CK_NAME}参数值【不要】前面的Bearer'多账号#或&分割
|
复制里面的{CK_NAME}参数值【不要】前面的Bearer 【不要】前面的Bearer 【不要】前面的Bearer
|
||||||
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
参数示例:eyJhbGciOiJxxxxxxxxxxxx
|
||||||
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
✨ 设置青龙变量:
|
||||||
✨ 推荐cron:30 1 * * *
|
export {ENV_NAME}='{CK_NAME}参数值【不要】前面的Bearer'多账号#或&分割
|
||||||
✨✨✨ @Author CHERWIN✨✨✨
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
''')
|
✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
||||||
local_script_name = os.path.basename(__file__)
|
✨ 推荐cron:30 1 * * *
|
||||||
local_version = '2024.04.06'
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
''')
|
||||||
import_Tools()
|
local_script_name = os.path.basename(__file__)
|
||||||
else:
|
local_version = '2024.05.15'
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
import_Tools()
|
||||||
import_Tools()
|
else:
|
||||||
else:
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
import_Tools()
|
||||||
exit()
|
else:
|
||||||
print(TIPS)
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
token = ''
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
token = ENV if ENV else token
|
import_Tools()
|
||||||
if not token:
|
else:
|
||||||
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
exit()
|
exit()
|
||||||
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
print(TIPS)
|
||||||
# print(tokens)
|
token = ''
|
||||||
if len(tokens) > 0:
|
token = ENV if ENV else token
|
||||||
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
if not token:
|
||||||
access_token = []
|
print(f"未填写{ENV_NAME}变量\n青龙可在环境变量设置 {ENV_NAME} 或者在本脚本文件上方将{CK_NAME}填入token =''")
|
||||||
for index, infos in enumerate(tokens):
|
exit()
|
||||||
run_result = RUN(infos, index).main()
|
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
||||||
if not run_result: continue
|
# print(tokens)
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
if len(tokens) > 0:
|
||||||
|
print(f"\n>>>>>>>>>>共获取到{len(tokens)}个账号<<<<<<<<<<")
|
||||||
|
access_token = []
|
||||||
|
for index, infos in enumerate(tokens):
|
||||||
|
run_result = RUN(infos, index).main()
|
||||||
|
if not run_result: continue
|
||||||
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
|
|||||||
367
SFSY.py
367
SFSY.py
@ -13,28 +13,37 @@ from datetime import datetime, timedelta
|
|||||||
from sys import exit
|
from sys import exit
|
||||||
import requests
|
import requests
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
|
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
|
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
|
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
else:
|
else:
|
||||||
print("加载通知服务失败!")
|
print("加载通知服务失败!")
|
||||||
send_msg = ''
|
send_msg = ''
|
||||||
one_msg=''
|
one_msg = ''
|
||||||
|
|
||||||
|
|
||||||
def Log(cont=''):
|
def Log(cont=''):
|
||||||
global send_msg,one_msg
|
global send_msg, one_msg
|
||||||
print(cont)
|
print(cont)
|
||||||
if cont:
|
if cont:
|
||||||
one_msg += f'{cont}\n'
|
one_msg += f'{cont}\n'
|
||||||
send_msg += f'{cont}\n'
|
send_msg += f'{cont}\n'
|
||||||
#1905 #0945 #6332 #6615 2559
|
|
||||||
inviteId=['8C3950A023D942FD93BE9218F5BFB34B','EF94619ED9C84E968C7A88CFB5E0B5DC','9C92BD3D672D4B6EBB7F4A488D020C79','803CF9D1E0734327BDF67CDAE1442B0E','00C81F67BE374041A692FA034847F503']
|
|
||||||
|
|
||||||
|
# 1905 #0945 #6332 #6615 2559
|
||||||
|
inviteId = [
|
||||||
|
'8C3950A023D942FD93BE9218F5BFB34B', 'EF94619ED9C84E968C7A88CFB5E0B5DC', '9C92BD3D672D4B6EBB7F4A488D020C79','803CF9D1E0734327BDF67CDAE1442B0E', '00C81F67BE374041A692FA034847F503']
|
||||||
class RUN:
|
class RUN:
|
||||||
def __init__(self,info,index):
|
def __init__(self, info, index):
|
||||||
global one_msg
|
global one_msg
|
||||||
one_msg = ''
|
one_msg = ''
|
||||||
split_info = info.split('@')
|
split_info = info.split('@')
|
||||||
@ -62,9 +71,12 @@ class RUN:
|
|||||||
|
|
||||||
}
|
}
|
||||||
self.anniversary_black = False
|
self.anniversary_black = False
|
||||||
|
self.member_day_black = False
|
||||||
|
self.member_day_red_packet_drew_today = False
|
||||||
|
self.member_day_red_packet_map = {}
|
||||||
self.login_res = self.login(url)
|
self.login_res = self.login(url)
|
||||||
self.today = datetime.now().strftime('%Y-%m-%d')
|
self.today = datetime.now().strftime('%Y-%m-%d')
|
||||||
self.answer = APP_INFO.get('ANSWER',[]).get(self.today,False)
|
self.answer = APP_INFO.get('ANSWER', []).get(self.today, False)
|
||||||
|
|
||||||
def get_deviceId(self, characters='abcdef0123456789'):
|
def get_deviceId(self, characters='abcdef0123456789'):
|
||||||
result = ''
|
result = ''
|
||||||
@ -77,7 +89,7 @@ class RUN:
|
|||||||
result += char
|
result += char
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def login(self,sfurl):
|
def login(self, sfurl):
|
||||||
ress = self.s.get(sfurl, headers=self.headers)
|
ress = self.s.get(sfurl, headers=self.headers)
|
||||||
# print(ress.text)
|
# print(ress.text)
|
||||||
self.user_id = self.s.cookies.get_dict().get('_login_user_id_', '')
|
self.user_id = self.s.cookies.get_dict().get('_login_user_id_', '')
|
||||||
@ -89,6 +101,7 @@ class RUN:
|
|||||||
else:
|
else:
|
||||||
Log(f'获取用户信息失败')
|
Log(f'获取用户信息失败')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def getSign(self):
|
def getSign(self):
|
||||||
timestamp = str(int(round(time.time() * 1000)))
|
timestamp = str(int(round(time.time() * 1000)))
|
||||||
token = 'wwesldfs29aniversaryvdld29'
|
token = 'wwesldfs29aniversaryvdld29'
|
||||||
@ -102,7 +115,8 @@ class RUN:
|
|||||||
}
|
}
|
||||||
self.headers.update(data)
|
self.headers.update(data)
|
||||||
return data
|
return data
|
||||||
def do_request(self, url, data = {}, req_type = 'post'):
|
|
||||||
|
def do_request(self, url, data={}, req_type='post'):
|
||||||
self.getSign()
|
self.getSign()
|
||||||
try:
|
try:
|
||||||
if req_type.lower() == 'get':
|
if req_type.lower() == 'get':
|
||||||
@ -120,20 +134,19 @@ class RUN:
|
|||||||
print('JSON decoding failed:', e)
|
print('JSON decoding failed:', e)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def sign(self):
|
def sign(self):
|
||||||
print(f'>>>>>>开始执行签到')
|
print(f'>>>>>>开始执行签到')
|
||||||
json_data = {"comeFrom":"vioin","channelFrom":"WEIXIN"}
|
json_data = {"comeFrom": "vioin", "channelFrom": "WEIXIN"}
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~integralTaskSignPlusService~automaticSignFetchPackage'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~integralTaskSignPlusService~automaticSignFetchPackage'
|
||||||
response = self.do_request(url, data=json_data)
|
response = self.do_request(url, data=json_data)
|
||||||
# print(response)
|
# print(response)
|
||||||
if response.get('success') == True:
|
if response.get('success') == True:
|
||||||
count_day = response.get('obj',{}).get('countDay',0)
|
count_day = response.get('obj', {}).get('countDay', 0)
|
||||||
if response.get('obj') and response['obj'].get('integralTaskSignPackageVOList'):
|
if response.get('obj') and response['obj'].get('integralTaskSignPackageVOList'):
|
||||||
packet_name = response["obj"]["integralTaskSignPackageVOList"][0]["packetName"]
|
packet_name = response["obj"]["integralTaskSignPackageVOList"][0]["packetName"]
|
||||||
Log(f'>>>签到成功,获得【{packet_name}】,本周累计签到【{count_day+1}】天')
|
Log(f'>>>签到成功,获得【{packet_name}】,本周累计签到【{count_day + 1}】天')
|
||||||
else:
|
else:
|
||||||
Log(f'今日已签到,本周累计签到【{count_day+1}】天')
|
Log(f'今日已签到,本周累计签到【{count_day + 1}】天')
|
||||||
else:
|
else:
|
||||||
print(f'签到失败!原因:{response.get("errorMessage")}')
|
print(f'签到失败!原因:{response.get("errorMessage")}')
|
||||||
|
|
||||||
@ -143,7 +156,7 @@ class RUN:
|
|||||||
'channel': 'czflqdlhbxcx'
|
'channel': 'czflqdlhbxcx'
|
||||||
}
|
}
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberActLengthy~redPacketActivityService~superWelfare~receiveRedPacket'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberActLengthy~redPacketActivityService~superWelfare~receiveRedPacket'
|
||||||
response = self.do_request(url,data=json_data)
|
response = self.do_request(url, data=json_data)
|
||||||
# print(response)
|
# print(response)
|
||||||
if response.get('success') == True:
|
if response.get('success') == True:
|
||||||
gift_list = response.get('obj', {}).get('giftList', [])
|
gift_list = response.get('obj', {}).get('giftList', [])
|
||||||
@ -157,16 +170,16 @@ class RUN:
|
|||||||
error_message = response.get('errorMessage') or json.dumps(response) or '无返回'
|
error_message = response.get('errorMessage') or json.dumps(response) or '无返回'
|
||||||
print(f'超值福利签到失败: {error_message}')
|
print(f'超值福利签到失败: {error_message}')
|
||||||
|
|
||||||
def get_SignTaskList(self,END=False):
|
def get_SignTaskList(self, END=False):
|
||||||
if not END:print(f'>>>开始获取签到任务列表')
|
if not END: print(f'>>>开始获取签到任务列表')
|
||||||
json_data = {
|
json_data = {
|
||||||
'channelType': '3',
|
'channelType': '3',
|
||||||
'deviceId': self.get_deviceId(),
|
'deviceId': self.get_deviceId(),
|
||||||
}
|
}
|
||||||
url='https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~integralTaskStrategyService~queryPointTaskAndSignFromES'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~integralTaskStrategyService~queryPointTaskAndSignFromES'
|
||||||
response = self.do_request(url,data=json_data)
|
response = self.do_request(url, data=json_data)
|
||||||
# print(response)
|
# print(response)
|
||||||
if response.get('success') == True and response.get('obj') !=[]:
|
if response.get('success') == True and response.get('obj') != []:
|
||||||
totalPoint = response["obj"]["totalPoint"]
|
totalPoint = response["obj"]["totalPoint"]
|
||||||
if END:
|
if END:
|
||||||
Log(f'当前积分:【{totalPoint}】')
|
Log(f'当前积分:【{totalPoint}】')
|
||||||
@ -178,7 +191,7 @@ class RUN:
|
|||||||
self.strategyId = task["strategyId"]
|
self.strategyId = task["strategyId"]
|
||||||
self.title = task["title"]
|
self.title = task["title"]
|
||||||
status = task["status"]
|
status = task["status"]
|
||||||
skip_title = ['用行业模板寄件下单','去新增一个收件偏好','参与积分活动']
|
skip_title = ['用行业模板寄件下单', '去新增一个收件偏好', '参与积分活动']
|
||||||
if status == 3:
|
if status == 3:
|
||||||
print(f'>{self.title}-已完成')
|
print(f'>{self.title}-已完成')
|
||||||
continue
|
continue
|
||||||
@ -198,8 +211,8 @@ class RUN:
|
|||||||
json_data = {
|
json_data = {
|
||||||
'taskCode': self.taskCode,
|
'taskCode': self.taskCode,
|
||||||
}
|
}
|
||||||
url='https://mcs-mimp-web.sf-express.com/mcs-mimp/commonRoutePost/memberEs/taskRecord/finishTask'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonRoutePost/memberEs/taskRecord/finishTask'
|
||||||
response = self.do_request(url,data=json_data)
|
response = self.do_request(url, data=json_data)
|
||||||
if response.get('success') == True:
|
if response.get('success') == True:
|
||||||
print(f'>【{self.title}】任务-已完成')
|
print(f'>【{self.title}】任务-已完成')
|
||||||
else:
|
else:
|
||||||
@ -233,11 +246,11 @@ class RUN:
|
|||||||
def receive_honeyTask(self):
|
def receive_honeyTask(self):
|
||||||
print('>>>执行收取丰蜜任务')
|
print('>>>执行收取丰蜜任务')
|
||||||
# 收取
|
# 收取
|
||||||
self.headers['syscode']='MCS-MIMP-CORE'
|
self.headers['syscode'] = 'MCS-MIMP-CORE'
|
||||||
self.headers['channel']='wxwdsj'
|
self.headers['channel'] = 'wxwdsj'
|
||||||
self.headers['accept']='application/json, text/plain, */*'
|
self.headers['accept'] = 'application/json, text/plain, */*'
|
||||||
self.headers['content-type']='application/json;charset=UTF-8'
|
self.headers['content-type'] = 'application/json;charset=UTF-8'
|
||||||
self.headers['platform']='MINI_PROGRAM'
|
self.headers['platform'] = 'MINI_PROGRAM'
|
||||||
json_data = {"taskType": self.taskType}
|
json_data = {"taskType": self.taskType}
|
||||||
# print(json_data)
|
# print(json_data)
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~receiveExchangeIndexService~receiveHoney'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~receiveExchangeIndexService~receiveHoney'
|
||||||
@ -295,8 +308,8 @@ class RUN:
|
|||||||
print('>>>开始获取采蜜换大礼任务列表')
|
print('>>>开始获取采蜜换大礼任务列表')
|
||||||
# 任务列表
|
# 任务列表
|
||||||
json_data = {}
|
json_data = {}
|
||||||
self.headers['channel']='wxwdsj'
|
self.headers['channel'] = 'wxwdsj'
|
||||||
url ='https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~receiveExchangeIndexService~taskDetail'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~receiveExchangeIndexService~taskDetail'
|
||||||
|
|
||||||
response = self.do_request(url, data=json_data)
|
response = self.do_request(url, data=json_data)
|
||||||
# print(response)
|
# print(response)
|
||||||
@ -323,11 +336,11 @@ class RUN:
|
|||||||
print('>>>执行大冒险任务')
|
print('>>>执行大冒险任务')
|
||||||
# 大冒险
|
# 大冒险
|
||||||
gameNum = 5
|
gameNum = 5
|
||||||
for i in range(1,gameNum):
|
for i in range(1, gameNum):
|
||||||
json_data = {
|
json_data = {
|
||||||
'gatherHoney': 20,
|
'gatherHoney': 20,
|
||||||
}
|
}
|
||||||
if gameNum < 0 :break
|
if gameNum < 0: break
|
||||||
print(f'>>开始第{i}次大冒险')
|
print(f'>>开始第{i}次大冒险')
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~receiveExchangeGameService~gameReport'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~receiveExchangeGameService~gameReport'
|
||||||
response = self.do_request(url, data=json_data)
|
response = self.do_request(url, data=json_data)
|
||||||
@ -342,8 +355,8 @@ class RUN:
|
|||||||
print(f'>大冒险失败!【{response.get("errorMessage")}】')
|
print(f'>大冒险失败!【{response.get("errorMessage")}】')
|
||||||
break
|
break
|
||||||
|
|
||||||
def honey_indexData(self,END=False):
|
def honey_indexData(self, END=False):
|
||||||
if not END:print('\n>>>>>>>开始执行采蜜换大礼任务')
|
if not END: print('\n>>>>>>>开始执行采蜜换大礼任务')
|
||||||
# 邀请
|
# 邀请
|
||||||
random_invite = random.choice([invite for invite in inviteId if invite != self.user_id])
|
random_invite = random.choice([invite for invite in inviteId if invite != self.user_id])
|
||||||
self.headers['channel'] = 'wxwdsj'
|
self.headers['channel'] = 'wxwdsj'
|
||||||
@ -357,7 +370,7 @@ class RUN:
|
|||||||
return
|
return
|
||||||
Log(f'执行前丰蜜:【{usableHoney}】')
|
Log(f'执行前丰蜜:【{usableHoney}】')
|
||||||
taskDetail = response.get('obj').get('taskDetail')
|
taskDetail = response.get('obj').get('taskDetail')
|
||||||
activityEndTime = response.get('obj').get('activityEndTime','')
|
activityEndTime = response.get('obj').get('activityEndTime', '')
|
||||||
activity_end_time = datetime.strptime(activityEndTime, "%Y-%m-%d %H:%M:%S")
|
activity_end_time = datetime.strptime(activityEndTime, "%Y-%m-%d %H:%M:%S")
|
||||||
current_time = datetime.now()
|
current_time = datetime.now()
|
||||||
|
|
||||||
@ -372,8 +385,6 @@ class RUN:
|
|||||||
self.receive_honeyTask()
|
self.receive_honeyTask()
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def EAR_END_2023_TaskList(self):
|
def EAR_END_2023_TaskList(self):
|
||||||
print('\n>>>>>>开始年终集卡任务')
|
print('\n>>>>>>开始年终集卡任务')
|
||||||
# 任务列表
|
# 任务列表
|
||||||
@ -381,11 +392,11 @@ class RUN:
|
|||||||
"activityCode": "YEAR_END_2023",
|
"activityCode": "YEAR_END_2023",
|
||||||
"channelType": "MINI_PROGRAM"
|
"channelType": "MINI_PROGRAM"
|
||||||
}
|
}
|
||||||
self.headers['channel']='xcx23nz'
|
self.headers['channel'] = 'xcx23nz'
|
||||||
self.headers['platform']='MINI_PROGRAM'
|
self.headers['platform'] = 'MINI_PROGRAM'
|
||||||
self.headers['syscode']='MCS-MIMP-CORE'
|
self.headers['syscode'] = 'MCS-MIMP-CORE'
|
||||||
|
|
||||||
url ='https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~activityTaskService~taskList'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~activityTaskService~taskList'
|
||||||
|
|
||||||
response = self.do_request(url, data=json_data)
|
response = self.do_request(url, data=json_data)
|
||||||
# print(response)
|
# print(response)
|
||||||
@ -476,7 +487,7 @@ class RUN:
|
|||||||
print(f'>>>开始抽卡')
|
print(f'>>>开始抽卡')
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~yearEnd2023GardenPartyService~getAward'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~yearEnd2023GardenPartyService~getAward'
|
||||||
for l in range(10):
|
for l in range(10):
|
||||||
for i in range(0,3):
|
for i in range(0, 3):
|
||||||
json_data = {
|
json_data = {
|
||||||
"cardType": i
|
"cardType": i
|
||||||
}
|
}
|
||||||
@ -497,7 +508,7 @@ class RUN:
|
|||||||
def EAR_END_2023_GuessIdiom(self):
|
def EAR_END_2023_GuessIdiom(self):
|
||||||
print(f'>>>开始猜成语')
|
print(f'>>>开始猜成语')
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~yearEnd2023GuessIdiomService~win'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~yearEnd2023GuessIdiomService~win'
|
||||||
for i in range(1,11):
|
for i in range(1, 11):
|
||||||
json_data = {
|
json_data = {
|
||||||
"index": i
|
"index": i
|
||||||
}
|
}
|
||||||
@ -545,6 +556,7 @@ class RUN:
|
|||||||
print(f'查询每周领券失败: {error_message}')
|
print(f'查询每周领券失败: {error_message}')
|
||||||
if '系统繁忙' in error_message or '用户手机号校验未通过' in error_message:
|
if '系统繁忙' in error_message or '用户手机号校验未通过' in error_message:
|
||||||
self.anniversary_black = True
|
self.anniversary_black = True
|
||||||
|
|
||||||
def anniversary2024_receive_weekly_gift(self):
|
def anniversary2024_receive_weekly_gift(self):
|
||||||
print(f'>>>开始领取每周领券')
|
print(f'>>>开始领取每周领券')
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2024IndexService~receiveWeeklyGift'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2024IndexService~receiveWeeklyGift'
|
||||||
@ -554,7 +566,7 @@ class RUN:
|
|||||||
print(f'每周领券: {product_names}')
|
print(f'每周领券: {product_names}')
|
||||||
else:
|
else:
|
||||||
error_message = response.get('errorMessage') or json.dumps(response) or '无返回'
|
error_message = response.get('errorMessage') or json.dumps(response) or '无返回'
|
||||||
print( f'每周领券失败: {error_message}')
|
print(f'每周领券失败: {error_message}')
|
||||||
if '系统繁忙' in error_message or '用户手机号校验未通过' in error_message:
|
if '系统繁忙' in error_message or '用户手机号校验未通过' in error_message:
|
||||||
self.anniversary_black = True
|
self.anniversary_black = True
|
||||||
|
|
||||||
@ -581,13 +593,17 @@ class RUN:
|
|||||||
pass
|
pass
|
||||||
elif task['taskType'] == 'FOLLOW_SFZHUNONG_VEDIO_ID':
|
elif task['taskType'] == 'FOLLOW_SFZHUNONG_VEDIO_ID':
|
||||||
pass
|
pass
|
||||||
elif task['taskType'] in ['BROWSE_VIP_CENTER', 'GUESS_GAME_TIP', 'CREATE_SFID', 'CLICK_MY_SETTING', 'CLICK_TEMPLATE', 'REAL_NAME', 'SEND_SUCCESS_RECALL', 'OPEN_SVIP', 'OPEN_FAST_CARD', 'FIRST_CHARGE_NEW_EXPRESS_CARD', 'CHARGE_NEW_EXPRESS_CARD', 'INTEGRAL_EXCHANGE']:
|
elif task['taskType'] in ['BROWSE_VIP_CENTER', 'GUESS_GAME_TIP', 'CREATE_SFID', 'CLICK_MY_SETTING',
|
||||||
|
'CLICK_TEMPLATE', 'REAL_NAME', 'SEND_SUCCESS_RECALL', 'OPEN_SVIP',
|
||||||
|
'OPEN_FAST_CARD', 'FIRST_CHARGE_NEW_EXPRESS_CARD', 'CHARGE_NEW_EXPRESS_CARD',
|
||||||
|
'INTEGRAL_EXCHANGE']:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
for _ in range(task['restFinishTime']):
|
for _ in range(task['restFinishTime']):
|
||||||
if self.anniversary_black:
|
if self.anniversary_black:
|
||||||
break
|
break
|
||||||
self.anniversary2024_finishTask(task)
|
self.anniversary2024_finishTask(task)
|
||||||
|
|
||||||
def anniversary2024_finishTask(self, task):
|
def anniversary2024_finishTask(self, task):
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonRoutePost/memberEs/taskRecord/finishTask'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonRoutePost/memberEs/taskRecord/finishTask'
|
||||||
data = {'taskCode': task['taskCode']}
|
data = {'taskCode': task['taskCode']}
|
||||||
@ -597,7 +613,8 @@ class RUN:
|
|||||||
# 完成任务后获取任务奖励的逻辑
|
# 完成任务后获取任务奖励的逻辑
|
||||||
self.anniversary2024_fetchMixTaskReward(task)
|
self.anniversary2024_fetchMixTaskReward(task)
|
||||||
else:
|
else:
|
||||||
print('完成任务[%s]失败: %s' % (task['taskName'], response.get('errorMessage') or (json.dumps(response) if response else '无返回')))
|
print('完成任务[%s]失败: %s' % (
|
||||||
|
task['taskName'], response.get('errorMessage') or (json.dumps(response) if response else '无返回')))
|
||||||
|
|
||||||
def anniversary2024_fetchMixTaskReward(self, task):
|
def anniversary2024_fetchMixTaskReward(self, task):
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2024TaskService~fetchMixTaskReward'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2024TaskService~fetchMixTaskReward'
|
||||||
@ -885,7 +902,7 @@ class RUN:
|
|||||||
self.cards[currency_key] = int(card.get('balance'))
|
self.cards[currency_key] = int(card.get('balance'))
|
||||||
card_info.append('[' + card.get('currency') + ']X' + str(card.get('balance')))
|
card_info.append('[' + card.get('currency') + ']X' + str(card.get('balance')))
|
||||||
|
|
||||||
Log(f'已收集拼图: {card_info}' )
|
Log(f'已收集拼图: {card_info}')
|
||||||
cards_li.sort(key=lambda x: x.get('balance'), reverse=True)
|
cards_li.sort(key=lambda x: x.get('balance'), reverse=True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -896,11 +913,11 @@ class RUN:
|
|||||||
|
|
||||||
def do_draw(self, cards):
|
def do_draw(self, cards):
|
||||||
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2024CardService~collectDrawAward'
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~anniversary2024CardService~collectDrawAward'
|
||||||
data = {"accountList":cards}
|
data = {"accountList": cards}
|
||||||
response = self.do_request(url, data)
|
response = self.do_request(url, data)
|
||||||
if response and response.get('success'):
|
if response and response.get('success'):
|
||||||
data = response.get('obj',{})
|
data = response.get('obj', {})
|
||||||
productName = data.get('productName','')
|
productName = data.get('productName', '')
|
||||||
Log(f'抽奖成功,获得{productName}')
|
Log(f'抽奖成功,获得{productName}')
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
@ -908,7 +925,7 @@ class RUN:
|
|||||||
print(f'抽奖失败: {error_message}')
|
print(f'抽奖失败: {error_message}')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def convert_common_card(self,cards, target_card):
|
def convert_common_card(self, cards, target_card):
|
||||||
# 如果共通卡(COMMON_CARD)的数量大于0,转化成目标卡
|
# 如果共通卡(COMMON_CARD)的数量大于0,转化成目标卡
|
||||||
if cards['COMMON_CARD'] > 0:
|
if cards['COMMON_CARD'] > 0:
|
||||||
cards['COMMON_CARD'] -= 1
|
cards['COMMON_CARD'] -= 1
|
||||||
@ -916,13 +933,12 @@ class RUN:
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def can_draw(self,cards, n):
|
def can_draw(self, cards, n):
|
||||||
# 判断是否有足够的不同卡进行抽奖
|
# 判断是否有足够的不同卡进行抽奖
|
||||||
distinct_cards = sum(1 for card, amount in cards.items() if card != 'COMMON_CARD' and amount > 0)
|
distinct_cards = sum(1 for card, amount in cards.items() if card != 'COMMON_CARD' and amount > 0)
|
||||||
return distinct_cards >= n
|
return distinct_cards >= n
|
||||||
|
|
||||||
|
def draw(self, cards, n):
|
||||||
def draw(self,cards, n):
|
|
||||||
drawn_cards = []
|
drawn_cards = []
|
||||||
for card, amount in sorted(cards.items(), key=lambda item: item[1]):
|
for card, amount in sorted(cards.items(), key=lambda item: item[1]):
|
||||||
if card != 'COMMON_CARD' and amount > 0:
|
if card != 'COMMON_CARD' and amount > 0:
|
||||||
@ -937,7 +953,7 @@ class RUN:
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def simulate_lottery(self,cards):
|
def simulate_lottery(self, cards):
|
||||||
while self.can_draw(cards, 9):
|
while self.can_draw(cards, 9):
|
||||||
used_cards = self.draw(cards, 9)
|
used_cards = self.draw(cards, 9)
|
||||||
print("进行了一次9卡抽奖,消耗卡片: ", used_cards)
|
print("进行了一次9卡抽奖,消耗卡片: ", used_cards)
|
||||||
@ -973,15 +989,210 @@ class RUN:
|
|||||||
else:
|
else:
|
||||||
print('未到自动抽奖时间')
|
print('未到自动抽奖时间')
|
||||||
|
|
||||||
|
def member_day_index(self):
|
||||||
|
try:
|
||||||
|
invite_user_id = random.choice([invite for invite in inviteId if invite != self.user_id])
|
||||||
|
payload = {'inviteUserId': invite_user_id}
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~memberDayIndexService~index'
|
||||||
|
|
||||||
|
response = self.do_request(url, data=payload)
|
||||||
|
if response.get('success'):
|
||||||
|
lottery_num = response.get('obj', {}).get('lotteryNum', 0)
|
||||||
|
can_receive_invite_award = response.get('obj', {}).get('canReceiveInviteAward', False)
|
||||||
|
if can_receive_invite_award:
|
||||||
|
self.member_day_receive_invite_award(invite_user_id)
|
||||||
|
self.member_day_red_packet_status()
|
||||||
|
Log(f'会员日可以抽奖{lottery_num}次')
|
||||||
|
for _ in range(lottery_num):
|
||||||
|
self.member_day_lottery()
|
||||||
|
if self.member_day_black:
|
||||||
|
return
|
||||||
|
self.member_day_task_list()
|
||||||
|
if self.member_day_black:
|
||||||
|
return
|
||||||
|
self.member_day_red_packet_status()
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log(f'查询会员日失败: {error_message}')
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_receive_invite_award(self, invite_user_id):
|
||||||
|
try:
|
||||||
|
payload = {'inviteUserId': invite_user_id}
|
||||||
|
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~memberDayIndexService~receiveInviteAward'
|
||||||
|
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
product_name = response.get('obj', {}).get('productName', '空气')
|
||||||
|
Log(f'会员日奖励: {product_name}')
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log(f'领取会员日奖励失败: {error_message}')
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_lottery(self):
|
||||||
|
try:
|
||||||
|
payload = {}
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~memberDayLotteryService~lottery'
|
||||||
|
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
product_name = response.get('obj', {}).get('productName', '空气')
|
||||||
|
Log(f'会员日抽奖: {product_name}')
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log(f'会员日抽奖失败: {error_message}')
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_task_list(self):
|
||||||
|
try:
|
||||||
|
payload = {'activityCode': 'MEMBER_DAY', 'channelType': 'MINI_PROGRAM'}
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~activityTaskService~taskList'
|
||||||
|
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
task_list = response.get('obj', [])
|
||||||
|
for task in task_list:
|
||||||
|
if task['status'] == 1:
|
||||||
|
if self.member_day_black:
|
||||||
|
return
|
||||||
|
self.member_day_fetch_mix_task_reward(task)
|
||||||
|
for task in task_list:
|
||||||
|
if task['status'] == 2:
|
||||||
|
if self.member_day_black:
|
||||||
|
return
|
||||||
|
if task['taskType'] in ['SEND_SUCCESS', 'INVITEFRIENDS_PARTAKE_ACTIVITY', 'OPEN_SVIP',
|
||||||
|
'OPEN_NEW_EXPRESS_CARD', 'OPEN_FAMILY_CARD', 'CHARGE_NEW_EXPRESS_CARD',
|
||||||
|
'INTEGRAL_EXCHANGE']:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
for _ in range(task['restFinishTime']):
|
||||||
|
if self.member_day_black:
|
||||||
|
return
|
||||||
|
self.member_day_finish_task(task)
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log('查询会员日任务失败: ' + error_message)
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_finish_task(self, task):
|
||||||
|
try:
|
||||||
|
payload = {'taskCode': task['taskCode']}
|
||||||
|
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberEs~taskRecord~finishTask'
|
||||||
|
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
Log('完成会员日任务[' + task['taskName'] + ']成功')
|
||||||
|
self.member_day_fetch_mix_task_reward(task)
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log('完成会员日任务[' + task['taskName'] + ']失败: ' + error_message)
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_fetch_mix_task_reward(self, task):
|
||||||
|
try:
|
||||||
|
payload = {'taskType': task['taskType'], 'activityCode': 'MEMBER_DAY', 'channelType': 'MINI_PROGRAM'}
|
||||||
|
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~activityTaskService~fetchMixTaskReward'
|
||||||
|
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
Log('领取会员日任务[' + task['taskName'] + ']奖励成功')
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log('领取会员日任务[' + task['taskName'] + ']奖励失败: ' + error_message)
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_receive_red_packet(self, hour):
|
||||||
|
try:
|
||||||
|
payload = {'receiveHour': hour}
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~memberDayTaskService~receiveRedPacket'
|
||||||
|
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
Log(f'会员日领取{hour}点红包成功')
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log(f'会员日领取{hour}点红包失败: {error_message}')
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_red_packet_status(self):
|
||||||
|
try:
|
||||||
|
payload = {}
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~memberDayPacketService~redPacketStatus'
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
packet_list = response.get('obj', {}).get('packetList', [])
|
||||||
|
for packet in packet_list:
|
||||||
|
self.member_day_red_packet_map[packet['level']] = packet['count']
|
||||||
|
# Rest of the logic to process packet list
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log(f'查询会员日合成失败: {error_message}')
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
|
def member_day_red_packet_merge(self, level):
|
||||||
|
try:
|
||||||
|
payload = {'level': level, 'num': 2}
|
||||||
|
url = 'https://mcs-mimp-web.sf-express.com/mcs-mimp/commonPost/~memberNonactivity~memberDayPacketService~redPacketMerge'
|
||||||
|
|
||||||
|
response = self.do_request(url, payload)
|
||||||
|
if response.get('success'):
|
||||||
|
Log(f'会员日合成: [{level}级]红包X2 -> [{level + 1}级]红包')
|
||||||
|
self.member_day_red_packet_map[level] -= 2
|
||||||
|
if not self.member_day_red_packet_map.get(level + 1):
|
||||||
|
self.member_day_red_packet_map[level + 1] = 0
|
||||||
|
self.member_day_red_packet_map[level + 1] += 1
|
||||||
|
else:
|
||||||
|
error_message = response.get('errorMessage', '无返回')
|
||||||
|
Log(f'会员日合成两个[{level}级]红包失败: {error_message}')
|
||||||
|
if '没有资格参与活动' in error_message:
|
||||||
|
self.member_day_black = True
|
||||||
|
Log('会员日任务风控')
|
||||||
|
except Exception as e:
|
||||||
|
print(e)
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
global one_msg
|
global one_msg
|
||||||
wait_time = random.randint(1000, 3000) / 1000.0 # 转换为秒
|
wait_time = random.randint(1000, 3000) / 1000.0 # 转换为秒
|
||||||
time.sleep(wait_time) # 等待
|
time.sleep(wait_time) # 等待
|
||||||
one_msg = ''
|
one_msg = ''
|
||||||
if not self.login_res:return False
|
if not self.login_res: return False
|
||||||
# 执行签到任务
|
执行签到任务
|
||||||
self.sign()
|
self.sign()
|
||||||
self.superWelfare_receiveRedPacket()
|
self.superWelfare_receiveRedPacket()
|
||||||
self.get_SignTaskList()
|
self.get_SignTaskList()
|
||||||
@ -992,17 +1203,25 @@ class RUN:
|
|||||||
#获取任务列表并执行任务
|
#获取任务列表并执行任务
|
||||||
self.get_honeyTaskListStart()
|
self.get_honeyTaskListStart()
|
||||||
self.honey_indexData(True)
|
self.honey_indexData(True)
|
||||||
|
#######################################
|
||||||
# # 获取当前季度结束日期
|
# # 获取当前季度结束日期
|
||||||
# activity_end_date = get_quarter_end_date()
|
# activity_end_date = get_quarter_end_date()
|
||||||
# if is_activity_end_date(activity_end_date):
|
# if is_activity_end_date(activity_end_date):
|
||||||
# Log("今天采蜜活动截止兑换,请及时进行兑换")
|
# Log("今天采蜜活动截止兑换,请及时进行兑换")
|
||||||
# send('顺丰速运挂机通知', "今天采蜜活动截止兑换,请及时进行兑换")
|
# send('顺丰速运挂机通知', "今天采蜜活动截止兑换,请及时进行兑换")
|
||||||
target_time = datetime(2024, 4, 8, 19, 0)
|
# target_time = datetime(2024, 4, 8, 19, 0)
|
||||||
if datetime.now() < target_time:
|
# if datetime.now() < target_time:
|
||||||
# self.EAR_END_2023_TaskList()
|
# # self.EAR_END_2023_TaskList()
|
||||||
self.anniversary2024_task()
|
# self.anniversary2024_task()
|
||||||
|
# else:
|
||||||
|
# print('周年庆活动已结束')
|
||||||
|
#######################################
|
||||||
|
self.member_day_index()
|
||||||
|
current_date = datetime.now().day
|
||||||
|
if 26 <= current_date <= 28:
|
||||||
|
self.member_day_index()
|
||||||
else:
|
else:
|
||||||
print('周年庆活动已结束')
|
print('未到指定时间不执行会员日任务')
|
||||||
self.sendMsg()
|
self.sendMsg()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -1012,7 +1231,6 @@ class RUN:
|
|||||||
print(push_res)
|
print(push_res)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_quarter_end_date():
|
def get_quarter_end_date():
|
||||||
current_date = datetime.now()
|
current_date = datetime.now()
|
||||||
current_month = current_date.month
|
current_month = current_date.month
|
||||||
@ -1026,6 +1244,7 @@ def get_quarter_end_date():
|
|||||||
|
|
||||||
return quarter_end_date.strftime("%Y-%m-%d")
|
return quarter_end_date.strftime("%Y-%m-%d")
|
||||||
|
|
||||||
|
|
||||||
def is_activity_end_date(end_date):
|
def is_activity_end_date(end_date):
|
||||||
current_date = datetime.now().date()
|
current_date = datetime.now().date()
|
||||||
end_date = datetime.strptime(end_date, "%Y-%m-%d").date()
|
end_date = datetime.strptime(end_date, "%Y-%m-%d").date()
|
||||||
@ -1033,7 +1252,6 @@ def is_activity_end_date(end_date):
|
|||||||
return current_date == end_date
|
return current_date == end_date
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def down_file(filename, file_url):
|
def down_file(filename, file_url):
|
||||||
print(f'开始下载:{filename},下载地址:{file_url}')
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
try:
|
try:
|
||||||
@ -1060,10 +1278,13 @@ def down_file(filename, file_url):
|
|||||||
print(f'【{filename}】下载失败:{str(e)}')
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def import_Tools():
|
def import_Tools():
|
||||||
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
global CHERWIN_TOOLS, ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
import CHERWIN_TOOLS
|
import CHERWIN_TOOLS
|
||||||
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,
|
||||||
|
local_version)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
APP_NAME = '顺丰速运'
|
APP_NAME = '顺丰速运'
|
||||||
@ -1094,16 +1315,19 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
''')
|
''')
|
||||||
|
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.16'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
@ -1118,4 +1342,3 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
run_result = RUN(infos, index).main()
|
run_result = RUN(infos, index).main()
|
||||||
if not run_result: continue
|
if not run_result: continue
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
|
|
||||||
|
|||||||
56
TBHYZX.py
Normal file → Executable file
56
TBHYZX.py
Normal file → Executable file
@ -15,8 +15,10 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
#
|
#
|
||||||
if os.path.isfile('/DEV_ENV.py'):
|
IS_DEV = False
|
||||||
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -36,8 +38,7 @@ class RUN:
|
|||||||
global one_msg
|
global one_msg
|
||||||
one_msg = ''
|
one_msg = ''
|
||||||
split_info = info.split('@')
|
split_info = info.split('@')
|
||||||
|
self.token = json.loads(split_info[0])
|
||||||
self.token = split_info[0]
|
|
||||||
# print(self.token)
|
# print(self.token)
|
||||||
len_split_info = len(split_info)
|
len_split_info = len(split_info)
|
||||||
last_info = split_info[len_split_info - 1]
|
last_info = split_info[len_split_info - 1]
|
||||||
@ -69,6 +70,8 @@ class RUN:
|
|||||||
}
|
}
|
||||||
#
|
#
|
||||||
# print(self.headers)
|
# print(self.headers)
|
||||||
|
for key, value in self.token.items():
|
||||||
|
self.headers[key] = value
|
||||||
self.baseUrl = 'https://wxa-tp.ezrpro.com/myvip/'
|
self.baseUrl = 'https://wxa-tp.ezrpro.com/myvip/'
|
||||||
|
|
||||||
|
|
||||||
@ -120,17 +123,30 @@ class RUN:
|
|||||||
def WxAppOnLoginNew(self):
|
def WxAppOnLoginNew(self):
|
||||||
Log('>>>>>>登陆')
|
Log('>>>>>>登陆')
|
||||||
url = "https://wxa-tp.ezrpro.com/myvip/Base/User/WxAppOnLoginNew"
|
url = "https://wxa-tp.ezrpro.com/myvip/Base/User/WxAppOnLoginNew"
|
||||||
|
# data = {
|
||||||
|
# "code": self.token,
|
||||||
|
# "CommonIdType": "VipWxUnionId",
|
||||||
|
# "CommonId": "124948229",
|
||||||
|
# "ShopId": 0,
|
||||||
|
# "CommonIdSource": 47,
|
||||||
|
# "Latitude": 0,
|
||||||
|
# "Longitude": 0,
|
||||||
|
# "InviteActObj": "{\"ActId\":50726}",
|
||||||
|
# "PingId": "peLXqZCQAAD-C3PrZ36DkaE98NoLjuqQ",
|
||||||
|
# # "PingDate": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
# "PingDate": '2024-03-19 22:23:01'
|
||||||
|
# }
|
||||||
data = {
|
data = {
|
||||||
"code": self.token,
|
"CommonIdType": "VipWxUnionId",
|
||||||
"CommonIdType": "VipId",
|
"CommonId": "",
|
||||||
"CommonId": "124948229",
|
|
||||||
"ShopId": 0,
|
"ShopId": 0,
|
||||||
"CommonIdSource": 98,
|
"CommonIdSource": 47,
|
||||||
"Latitude": 0,
|
"Latitude": 0,
|
||||||
"Longitude": 0,
|
"Longitude": 0,
|
||||||
"InviteActObj": "{\"ActId\":50726}",
|
"InviteActObj": "{\"ActId\":50726}",
|
||||||
"PingId": "peLXqZCQAA3W2G4d-pEZ8FRPEjxKdzoQ",
|
"code": "0c1QVUFa1bogqH0W87Ga1ZHjjG3QVUFP",
|
||||||
"PingDate": datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
"PingId": "peLXqZCQAAD-C3PrZ36DkaE98NoLjuqQ",
|
||||||
|
"PingDate": "2024-03-19 22:23:01"
|
||||||
}
|
}
|
||||||
response = s.post(url, headers=self.headers,json=data)
|
response = s.post(url, headers=self.headers,json=data)
|
||||||
response = response.json()
|
response = response.json()
|
||||||
@ -187,8 +203,9 @@ class RUN:
|
|||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
Log(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
Log(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
||||||
if self.WxAppOnLoginNew():
|
# if self.WxAppOnLoginNew():
|
||||||
self.GetVipCardInfoByVipId()
|
if self.GetVipCardInfoByVipId():
|
||||||
|
# self.GetVipCardInfoByVipId()
|
||||||
self.GetSignInDtlInfo()
|
self.GetSignInDtlInfo()
|
||||||
self.BonusClassify()
|
self.BonusClassify()
|
||||||
self.sendMsg()
|
self.sendMsg()
|
||||||
@ -261,16 +278,19 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.05.08'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print('脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
@ -287,4 +307,4 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
s.verify = False
|
s.verify = False
|
||||||
run_result = RUN(infos, index).main()
|
run_result = RUN(infos, index).main()
|
||||||
if not run_result: continue
|
if not run_result: continue
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
825
TYQH_JK.py
Normal file → Executable file
825
TYQH_JK.py
Normal file → Executable file
@ -1,426 +1,399 @@
|
|||||||
# !/usr/bin/python3
|
# !/usr/bin/python3
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# @Author : cherwin
|
# @Author : cherwin
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "59 9 * 2-6 * *" script-path=xxx.py,tag=匹配cron用
|
# cron "59 9 * 2-6 * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('统一茄皇监控')
|
# const $ = new Env('统一茄皇监控')
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from os import environ, path
|
from os import environ, path
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
|
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
IS_DEV = False
|
||||||
import DEV_ENV
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
|
import DEV_ENV
|
||||||
if os.path.isfile('notify.py'):
|
IS_DEV = True
|
||||||
from notify import send
|
|
||||||
print("加载通知服务成功!")
|
if os.path.isfile('notify.py'):
|
||||||
else:
|
from notify import send
|
||||||
print("加载通知服务失败!")
|
print("加载通知服务成功!")
|
||||||
send_msg = ''
|
else:
|
||||||
one_msg=''
|
print("加载通知服务失败!")
|
||||||
def Log(cont=''):
|
send_msg = ''
|
||||||
global send_msg,one_msg
|
one_msg=''
|
||||||
print(cont)
|
def Log(cont=''):
|
||||||
if cont:
|
global send_msg,one_msg
|
||||||
one_msg += f'{cont}\n'
|
print(cont)
|
||||||
send_msg += f'{cont}\n'
|
if cont:
|
||||||
|
one_msg += f'{cont}\n'
|
||||||
USER_INFO = {}
|
send_msg += f'{cont}\n'
|
||||||
|
|
||||||
class RUN:
|
USER_INFO = {}
|
||||||
def __init__(self, info,index):
|
|
||||||
global one_msg
|
class RUN:
|
||||||
one_msg = ''
|
def __init__(self, info,index):
|
||||||
split_info = info.split('@')
|
global one_msg
|
||||||
self.third_id = split_info[0]
|
one_msg = ''
|
||||||
self.wid = split_info[1]
|
split_info = info.split('@')
|
||||||
len_split_info = len(split_info)
|
self.third_id = split_info[0]
|
||||||
last_info = split_info[len_split_info - 1]
|
self.wid = split_info[1]
|
||||||
self.send_UID = None
|
len_split_info = len(split_info)
|
||||||
if len_split_info > 0 and "UID_" in last_info:
|
last_info = split_info[len_split_info - 1]
|
||||||
self.send_UID = last_info
|
self.send_UID = None
|
||||||
|
if len_split_info > 0 and "UID_" in last_info:
|
||||||
self.user_index = index + 1
|
self.send_UID = last_info
|
||||||
print(f"\n---------开始执行第{self.user_index}个账号>>>>>")
|
|
||||||
self.s = requests.session()
|
self.user_index = index + 1
|
||||||
self.s.verify = False
|
print(f"\n---------开始执行第{self.user_index}个账号>>>>>")
|
||||||
|
self.s = requests.session()
|
||||||
self.UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x6309080f) XWEB/8555'
|
self.s.verify = False
|
||||||
|
|
||||||
self.headers = {
|
self.UA = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x6309080f) XWEB/8555'
|
||||||
'User-Agent': self.UA,
|
|
||||||
'Sec-Fetch-Site': 'cross-site',
|
self.headers = {
|
||||||
'Sec-Fetch-Mode': 'cors',
|
'User-Agent': self.UA,
|
||||||
'Sec-Fetch-Dest': 'empty',
|
'Sec-Fetch-Site': 'cross-site',
|
||||||
'Accept-Encoding': 'gzip, deflate, br',
|
'Sec-Fetch-Mode': 'cors',
|
||||||
'Accept-Language': 'zh-CN,zh;q=0.9',
|
'Sec-Fetch-Dest': 'empty',
|
||||||
'Origin': 'https://thekingoftomato.ioutu.cn',
|
'Accept-Encoding': 'gzip, deflate, br',
|
||||||
'Referer': 'https://thekingoftomato.ioutu.cn/'
|
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||||
|
'Origin': 'https://thekingoftomato.ioutu.cn',
|
||||||
}
|
'Referer': 'https://thekingoftomato.ioutu.cn/'
|
||||||
self.base_url = 'https://qiehuang-apig.xiaoyisz.com/qiehuangsecond/ga'
|
|
||||||
self.goodsid = None
|
}
|
||||||
self.Login_res = self.login()
|
self.base_url = 'https://qiehuang-apig.xiaoyisz.com/qiehuangsecond/ga'
|
||||||
|
self.goodsid = None
|
||||||
def load_json(self):
|
self.Login_res = self.login()
|
||||||
try:
|
|
||||||
with open(f"INVITE_CODE/{ENV_NAME}_INVITE_CODE.json", 'r', encoding='utf-8') as file:
|
def load_json(self):
|
||||||
data = json.load(file)
|
try:
|
||||||
return data
|
with open(f"INVITE_CODE/{ENV_NAME}_INVITE_CODE.json", 'r', encoding='utf-8') as file:
|
||||||
except FileNotFoundError:
|
data = json.load(file)
|
||||||
print("未找到文件,返回空字典")
|
return data
|
||||||
return {}
|
except FileNotFoundError:
|
||||||
except Exception as e:
|
print("未找到文件,返回空字典")
|
||||||
print(f"发生错误:{e}")
|
return {}
|
||||||
return {}
|
except Exception as e:
|
||||||
|
print(f"发生错误:{e}")
|
||||||
def make_request(self, url, method='post', headers={}, params={}):
|
return {}
|
||||||
if headers == {}:
|
|
||||||
headers = self.headers
|
def make_request(self, url, method='post', headers={}, params={}):
|
||||||
if params == {}:
|
if headers == {}:
|
||||||
params = self.params
|
headers = self.headers
|
||||||
try:
|
if params == {}:
|
||||||
if method.lower() == 'get':
|
params = self.params
|
||||||
response = requests.get(url, headers=headers, verify=False)
|
try:
|
||||||
|
if method.lower() == 'get':
|
||||||
elif method.lower() == 'post':
|
response = requests.get(url, headers=headers, verify=False)
|
||||||
response = requests.post(url, headers=headers, json=params, verify=False)
|
|
||||||
else:
|
elif method.lower() == 'post':
|
||||||
raise ValueError("不支持的请求方法: " + method)
|
response = requests.post(url, headers=headers, json=params, verify=False)
|
||||||
return response.json()
|
else:
|
||||||
except requests.exceptions.RequestException as e:
|
raise ValueError("不支持的请求方法: " + method)
|
||||||
print("请求异常:", e)
|
return response.json()
|
||||||
except ValueError as e:
|
except requests.exceptions.RequestException as e:
|
||||||
print("值错误或不支持的请求方法:", e)
|
print("请求异常:", e)
|
||||||
except Exception as e:
|
except ValueError as e:
|
||||||
print("发生了未知错误:", e)
|
print("值错误或不支持的请求方法:", e)
|
||||||
|
except Exception as e:
|
||||||
def gen_sign(self, parameters={}, body=None):
|
print("发生了未知错误:", e)
|
||||||
sorted_keys = sorted(parameters.keys())
|
|
||||||
parameter_strings = []
|
def gen_sign(self, parameters={}, body=None):
|
||||||
for key in sorted_keys:
|
sign_header=CHERWIN_TOOLS.TYQH_SIGN(parameters,body)
|
||||||
if isinstance(parameters[key], dict):
|
self.headers.update(sign_header)
|
||||||
parameter_strings.append(f"{key}={json.dumps(parameters[key])}")
|
return self.headers
|
||||||
else:
|
|
||||||
parameter_strings.append(f"{key}={parameters[key]}")
|
def login(self):
|
||||||
|
login_successful = False
|
||||||
current_time = int(datetime.now().timestamp() * 1000)
|
try:
|
||||||
secret_chars = list('BxzTx45uIGT25TTHIIBU2')
|
login_params = {
|
||||||
last_three_digits = str(current_time)[-3:]
|
'thirdId': self.third_id,
|
||||||
for digit in last_three_digits:
|
'wid': self.wid
|
||||||
secret_chars.insert(int(digit), digit)
|
}
|
||||||
|
sign_header = self.gen_sign({}, login_params)
|
||||||
secret = hashlib.md5(''.join(secret_chars).encode()).hexdigest()
|
# print(self.headers)
|
||||||
nonce_str = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
|
# Hypothetically speaking, this is how you might perform a POST request in Python with the requests library.
|
||||||
|
response = self.s.post(f'{self.base_url}/public/api/login', json=login_params, headers=sign_header)
|
||||||
sign_data = {
|
if response.status_code == 200:
|
||||||
'client_id': 'game',
|
response_data = response.json()
|
||||||
'nonstr': nonce_str,
|
if response_data.get('code', -1) == 0:
|
||||||
'timestamp': current_time,
|
auth = response_data['data']['token'] or ''
|
||||||
'body': json.dumps(body) if body else '',
|
if auth:
|
||||||
'query': '&'.join(parameter_strings) if parameter_strings else '',
|
login_successful = True
|
||||||
'secret': secret
|
print(f'账号【{self.user_index}】登录成功')
|
||||||
}
|
Authorization = {'Authorization': auth}
|
||||||
|
self.headers.update(Authorization)
|
||||||
sign_string = '|'.join([str(v) for v in sign_data.values()])
|
else:
|
||||||
sign = hashlib.md5(sign_string.encode()).hexdigest().upper()
|
print(f'账号【{self.user_index}】登录获取auth失败')
|
||||||
sign_header = {
|
else:
|
||||||
'client_id': 'game',
|
print(f"登录获取auth失败[{response_data['code']}]: {response_data['message']}")
|
||||||
'timestamp': str(current_time),
|
elif response.status_code == 403:
|
||||||
'nonstr': sign_data['nonstr'],
|
print('登录失败[403]: 黑IP了, 换个IP试试吧')
|
||||||
'sign': sign
|
except Exception as e:
|
||||||
}
|
print(e)
|
||||||
self.headers.update(sign_header)
|
finally:
|
||||||
return self.headers
|
return login_successful
|
||||||
|
|
||||||
def login(self):
|
def get_CapCode(self, slideImgInfo):
|
||||||
login_successful = False
|
slidingImage = slideImgInfo.get('slidingImage', None)
|
||||||
try:
|
backImage = slideImgInfo.get('backImage', None)
|
||||||
login_params = {
|
dddddocr_api = os.environ.get('OCR_API',False)
|
||||||
'thirdId': self.third_id,
|
if not dddddocr_api:
|
||||||
'wid': self.wid
|
print('未定义变量【OCR_API】\n取消验证码识别\n搭建方式:https://github.com/CHERWING/CHERWIN_SCRIPTS')
|
||||||
}
|
return False
|
||||||
sign_header = self.gen_sign({}, login_params)
|
if slidingImage and backImage:
|
||||||
# print(self.headers)
|
data = {
|
||||||
# Hypothetically speaking, this is how you might perform a POST request in Python with the requests library.
|
"slidingImage": slidingImage,
|
||||||
response = self.s.post(f'{self.base_url}/public/api/login', json=login_params, headers=sign_header)
|
"backImage": backImage
|
||||||
if response.status_code == 200:
|
}
|
||||||
response_data = response.json()
|
response = requests.post(f"{dddddocr_api}/capcode", data=json.dumps(data),headers={'Content-Type': 'application/json'})
|
||||||
if response_data.get('code', -1) == 0:
|
print(response.json())
|
||||||
auth = response_data['data']['token'] or ''
|
self.capcode = response.json().get('result','')
|
||||||
if auth:
|
if self.capcode:
|
||||||
login_successful = True
|
return True
|
||||||
print(f'账号【{self.user_index}】登录成功')
|
else:
|
||||||
Authorization = {'Authorization': auth}
|
return False
|
||||||
self.headers.update(Authorization)
|
|
||||||
else:
|
def get_CapCode_local(self, slideImgInfo):
|
||||||
print(f'账号【{self.user_index}】登录获取auth失败')
|
slidingImage = slideImgInfo.get('slidingImage', None)
|
||||||
else:
|
backImage = slideImgInfo.get('backImage', None)
|
||||||
print(f"登录获取auth失败[{response_data['code']}]: {response_data['message']}")
|
if slidingImage and backImage:
|
||||||
elif response.status_code == 403:
|
self.capcode =CHERWIN_TOOLS.CAPCODE(slidingImage,backImage)
|
||||||
print('登录失败[403]: 黑IP了, 换个IP试试吧')
|
if self.capcode:
|
||||||
except Exception as e:
|
return True
|
||||||
print(e)
|
else:
|
||||||
finally:
|
return False
|
||||||
return login_successful
|
|
||||||
|
def checkUserCapCode(self):
|
||||||
def get_CapCode(self, slideImgInfo):
|
print(f'提交验证码--->>>')
|
||||||
slidingImage = slideImgInfo.get('slidingImage', None)
|
# try:
|
||||||
backImage = slideImgInfo.get('backImage', None)
|
print(f'验证码:{self.capcode}')
|
||||||
dddddocr_api = os.environ.get('OCR_API',False)
|
params = {'xpos':self.capcode}
|
||||||
if not dddddocr_api:
|
print(params)
|
||||||
print('未定义变量【OCR_API】\n取消验证码识别\n搭建方式:https://github.com/CHERWING/CHERWIN_SCRIPTS')
|
sign_header = self.gen_sign(body=params)
|
||||||
return False
|
url = f'{self.base_url}/checkUserCapCode'
|
||||||
if slidingImage and backImage:
|
response = self.s.post(url, headers=sign_header, json=params)
|
||||||
data = {
|
data = response.json()
|
||||||
"slidingImage": slidingImage,
|
code = data.get('code', -1)
|
||||||
"backImage": backImage
|
if code == 0:
|
||||||
}
|
data = data.get('data', 0)
|
||||||
response = requests.post(f"{dddddocr_api}/capcode", data=json.dumps(data),headers={'Content-Type': 'application/json'})
|
print(f"验证码正确,获取到[{data}]")
|
||||||
print(response.json())
|
return True
|
||||||
self.capcode = response.json().get('result','')
|
else:
|
||||||
if self.capcode:
|
message = data.get('message', '')
|
||||||
return True
|
print(f"验证码错误[{message}]")
|
||||||
else:
|
return False
|
||||||
return False
|
# except Exception as e:
|
||||||
|
# print(e)
|
||||||
def get_CapCode_local(self, slideImgInfo):
|
|
||||||
slidingImage = slideImgInfo.get('slidingImage', None)
|
def exchange_find(self):
|
||||||
backImage = slideImgInfo.get('backImage', None)
|
print(f'获取兑换列表--->>>')
|
||||||
if slidingImage and backImage:
|
try:
|
||||||
self.capcode =CHERWIN_TOOLS.CAPCODE(slidingImage,backImage)
|
sign_header = self.gen_sign()
|
||||||
if self.capcode:
|
url = f'{self.base_url}/exchange/find'
|
||||||
return True
|
response = self.s.get(url, headers=sign_header)
|
||||||
else:
|
data = response.json()
|
||||||
return False
|
code = data.get('code', -1)
|
||||||
|
if code == 0:
|
||||||
def checkUserCapCode(self):
|
data = data.get('data', {})[1]
|
||||||
print(f'提交验证码--->>>')
|
num = data.get('num',0)
|
||||||
# try:
|
if num < 0 :
|
||||||
print(f'验证码:{self.capcode}')
|
Log('兑换上限,跳过')
|
||||||
params = {'xpos':self.capcode}
|
return False
|
||||||
print(params)
|
# print(f"兑换列表:{data}")
|
||||||
sign_header = self.gen_sign(body=params)
|
exchangePrizeVoList = data.get('exchangePrizeVoList',None)
|
||||||
url = f'{self.base_url}/checkUserCapCode'
|
if exchangePrizeVoList:
|
||||||
response = self.s.post(url, headers=sign_header, json=params)
|
for goods in exchangePrizeVoList:
|
||||||
data = response.json()
|
name = goods.get('name','')
|
||||||
code = data.get('code', -1)
|
self.goodsid = goods.get('id','')
|
||||||
if code == 0:
|
usableStock = goods.get('usableStock','')
|
||||||
data = data.get('data', 0)
|
if usableStock >0:
|
||||||
print(f"验证码正确,获取到[{data}]")
|
Log(f'ID:【{self.goodsid}】 【{name}】 当前剩余:{usableStock}【可兑换】')
|
||||||
return True
|
self.sendMsg()
|
||||||
else:
|
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
||||||
message = data.get('message', '')
|
if TYQH_DHID and TYQH_DHID == self.goodsid:
|
||||||
print(f"验证码错误[{message}]")
|
self.exchange_reward(TYQH_DHID)
|
||||||
return False
|
elif TYQH_DHID == '0':
|
||||||
# except Exception as e:
|
self.exchange_reward(self.goodsid)
|
||||||
# print(e)
|
else:
|
||||||
|
continue
|
||||||
def exchange_find(self):
|
else:
|
||||||
print(f'获取兑换列表--->>>')
|
print(f'ID:【{self.goodsid}】【{name}】 当前剩余:{usableStock}【不可兑换】')
|
||||||
try:
|
else:
|
||||||
sign_header = self.gen_sign()
|
message = data.get('message', '')
|
||||||
url = f'{self.base_url}/exchange/find'
|
print(f'{message}')
|
||||||
response = self.s.get(url, headers=sign_header)
|
except Exception as e:
|
||||||
data = response.json()
|
print(e)
|
||||||
code = data.get('code', -1)
|
|
||||||
if code == 0:
|
def exchange_reward(self, reward_id):
|
||||||
data = data.get('data', {})[1]
|
print(f'尝试兑换--->>>')
|
||||||
num = data.get('num',0)
|
try:
|
||||||
if num < 0 :
|
params = {'id': reward_id}
|
||||||
Log('兑换上限,跳过')
|
sign_header = self.gen_sign(params)
|
||||||
return False
|
url = f'{self.base_url}/exchange/reward'
|
||||||
# print(f"兑换列表:{data}")
|
response = self.s.get(url, headers=sign_header, params=params)
|
||||||
exchangePrizeVoList = data.get('exchangePrizeVoList',None)
|
data = response.json()
|
||||||
if exchangePrizeVoList:
|
code = data.get('code', -1)
|
||||||
for goods in exchangePrizeVoList:
|
if code == 0:
|
||||||
name = goods.get('name','')
|
data = data.get('data', {}).get('name') or ''
|
||||||
self.goodsid = goods.get('id','')
|
Log(f"兑换[{data}]成功")
|
||||||
usableStock = goods.get('usableStock','')
|
elif code == 4000:
|
||||||
if usableStock >0:
|
slideImgInfo = data.get('data', {}).get('slideImgInfo', None)
|
||||||
Log(f'ID:【{self.goodsid}】 【{name}】 当前剩余:{usableStock}【可兑换】')
|
validateCount = data.get('data', {}).get('validateCount', None)
|
||||||
self.sendMsg()
|
if slideImgInfo and validateCount:
|
||||||
if send: send(f'{APP_NAME}挂机通知', send_msg + TIPS_HTML)
|
print(f"兑换需要滑块验证")
|
||||||
if TYQH_DHID and TYQH_DHID == self.goodsid:
|
if self.get_CapCode(slideImgInfo):
|
||||||
self.exchange_reward(TYQH_DHID)
|
if self.checkUserCapCode():
|
||||||
elif TYQH_DHID == '0':
|
self.exchange_reward(reward_id)
|
||||||
self.exchange_reward(self.goodsid)
|
else:
|
||||||
else:
|
print(f"兑换验证码上限")
|
||||||
continue
|
else:
|
||||||
else:
|
message = data.get('message', '')
|
||||||
print(f'ID:【{self.goodsid}】【{name}】 当前剩余:{usableStock}【不可兑换】')
|
print(f'兑换[id={reward_id}]: {message}')
|
||||||
else:
|
except Exception as e:
|
||||||
message = data.get('message', '')
|
print(e)
|
||||||
print(f'{message}')
|
|
||||||
except Exception as e:
|
def userTask(self):
|
||||||
print(e)
|
print('\n--------------- 开始日常任务 ---------------')
|
||||||
|
wait_time = random.randint(1000, 3000) / 1000.0 # 转换为秒
|
||||||
def exchange_reward(self, reward_id):
|
if not self.Login_res:
|
||||||
print(f'尝试兑换--->>>')
|
return False
|
||||||
try:
|
self.exchange_find()
|
||||||
params = {'id': reward_id}
|
|
||||||
sign_header = self.gen_sign(params)
|
return True
|
||||||
url = f'{self.base_url}/exchange/reward'
|
|
||||||
response = self.s.get(url, headers=sign_header, params=params)
|
|
||||||
data = response.json()
|
def sendMsg(self, help=False):
|
||||||
code = data.get('code', -1)
|
if self.send_UID:
|
||||||
if code == 0:
|
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
||||||
data = data.get('data', {}).get('name') or ''
|
print(push_res)
|
||||||
Log(f"兑换[{data}]成功")
|
|
||||||
elif code == 4000:
|
|
||||||
slideImgInfo = data.get('data', {}).get('slideImgInfo', None)
|
def down_file(filename, file_url):
|
||||||
validateCount = data.get('data', {}).get('validateCount', None)
|
print(f'开始下载:{filename},下载地址:{file_url}')
|
||||||
if slideImgInfo and validateCount:
|
try:
|
||||||
print(f"兑换需要滑块验证")
|
response = requests.get(file_url, verify=False, timeout=10)
|
||||||
if self.get_CapCode(slideImgInfo):
|
response.raise_for_status()
|
||||||
if self.checkUserCapCode():
|
with open(filename + '.tmp', 'wb') as f:
|
||||||
self.exchange_reward(reward_id)
|
f.write(response.content)
|
||||||
else:
|
print(f'【{filename}】下载完成!')
|
||||||
print(f"兑换验证码上限")
|
|
||||||
else:
|
# 检查临时文件是否存在
|
||||||
message = data.get('message', '')
|
temp_filename = filename + '.tmp'
|
||||||
print(f'兑换[id={reward_id}]: {message}')
|
if os.path.exists(temp_filename):
|
||||||
except Exception as e:
|
# 删除原有文件
|
||||||
print(e)
|
if os.path.exists(filename):
|
||||||
|
os.remove(filename)
|
||||||
def userTask(self):
|
# 重命名临时文件
|
||||||
print('\n--------------- 开始日常任务 ---------------')
|
os.rename(temp_filename, filename)
|
||||||
wait_time = random.randint(1000, 3000) / 1000.0 # 转换为秒
|
print(f'【{filename}】重命名成功!')
|
||||||
if not self.Login_res:
|
return True
|
||||||
return False
|
else:
|
||||||
self.exchange_find()
|
print(f'【{filename}】临时文件不存在!')
|
||||||
|
return False
|
||||||
return True
|
except Exception as e:
|
||||||
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
|
return False
|
||||||
def sendMsg(self, help=False):
|
|
||||||
if self.send_UID:
|
def import_Tools():
|
||||||
push_res = CHERWIN_TOOLS.wxpusher(self.send_UID, one_msg, APP_NAME, help)
|
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
print(push_res)
|
import CHERWIN_TOOLS
|
||||||
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
||||||
|
import threading
|
||||||
def down_file(filename, file_url):
|
|
||||||
print(f'开始下载:{filename},下载地址:{file_url}')
|
def execute_task(infos, index):
|
||||||
try:
|
run_result = RUN(infos, index).userTask()
|
||||||
response = requests.get(file_url, verify=False, timeout=10)
|
if not run_result:
|
||||||
response.raise_for_status()
|
return
|
||||||
with open(filename + '.tmp', 'wb') as f:
|
|
||||||
f.write(response.content)
|
if __name__ == '__main__':
|
||||||
print(f'【{filename}】下载完成!')
|
APP_NAME = '统一茄皇监控'
|
||||||
|
ENV_NAME = 'TYQH_JK'
|
||||||
# 检查临时文件是否存在
|
print(f'''
|
||||||
temp_filename = filename + '.tmp'
|
✨✨✨ {APP_NAME}脚本 ✨✨✨
|
||||||
if os.path.exists(temp_filename):
|
✨ 功能:
|
||||||
# 删除原有文件
|
奖品监控
|
||||||
if os.path.exists(filename):
|
✨ 设置青龙变量:
|
||||||
os.remove(filename)
|
export TYQH= '' 使用相同TYQH变量
|
||||||
# 重命名临时文件
|
export TYQH_DHID= '112' 设置兑换ID则开启自动兑换,设置为0遍历兑换全部可兑换商品
|
||||||
os.rename(temp_filename, filename)
|
export OCR_API= 'http://localhost:3721'
|
||||||
print(f'【{filename}】重命名成功!')
|
✨ 由于青龙python版本问题无法直接使用dddocr需要自行搭建API,搭建方式:https://github.com/CHERWING/CHERWIN_OCR
|
||||||
return True
|
✨ 如果你的环境可以安装dddocr库则可以替换代码内的【self.get_CapCode】为【self.get_CapCode_local】
|
||||||
else:
|
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
||||||
print(f'【{filename}】临时文件不存在!')
|
✨ 推荐定时:*/10 9:59 1-31 2-6 * * 2-6月每月1日9点55到10点1分,每10秒执行一次
|
||||||
return False
|
✨ 第一个账号助力作者,其余互助
|
||||||
except Exception as e:
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
print(f'【{filename}】下载失败:{str(e)}')
|
''')
|
||||||
return False
|
local_script_name = os.path.basename(__file__)
|
||||||
|
local_version = '2024.05.15'
|
||||||
def import_Tools():
|
if IS_DEV:
|
||||||
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
import_Tools()
|
||||||
import CHERWIN_TOOLS
|
else:
|
||||||
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
import threading
|
import_Tools()
|
||||||
|
else:
|
||||||
def execute_task(infos, index):
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
run_result = RUN(infos, index).userTask()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
if not run_result:
|
import_Tools()
|
||||||
return
|
else:
|
||||||
|
print(
|
||||||
if __name__ == '__main__':
|
'脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
APP_NAME = '统一茄皇监控'
|
exit()
|
||||||
ENV_NAME = 'TYQH_JK'
|
print(TIPS)
|
||||||
print(f'''
|
token = ''
|
||||||
✨✨✨ {APP_NAME}脚本 ✨✨✨
|
ENV = os.environ.get('TYQH','')
|
||||||
✨ 功能:
|
TYQH_DHID = os.environ.get('TYQH_DHID',None)
|
||||||
奖品监控
|
if TYQH_DHID == '0':
|
||||||
✨ 设置青龙变量:
|
Log(f'\n当前已设置TYQH_DHID变量,将自动遍历兑换商品')
|
||||||
export TYQH= '' 使用相同TYQH变量
|
elif TYQH_DHID:
|
||||||
export TYQH_DHID= '112' 设置兑换ID则开启自动兑换,设置为0遍历兑换全部可兑换商品
|
Log(f'\n当前已设置TYQH_DHID变量,将自动兑换id【{TYQH_DHID}】商品')
|
||||||
export OCR_API= 'http://localhost:3721'
|
else:
|
||||||
✨ 由于青龙python版本问题无法直接使用dddocr需要自行搭建API,搭建方式:https://github.com/CHERWING/CHERWIN_OCR
|
Log('\n未定义TYQH_DHID变量,取消自动兑换')
|
||||||
✨ 如果你的环境可以安装dddocr库则可以替换代码内的【self.get_CapCode】为【self.get_CapCode_local】
|
token = ENV if ENV else token
|
||||||
export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
if not token:
|
||||||
✨ 推荐定时:*/10 9:59 1-31 2-6 * * 2-6月每月1日9点55到10点1分,每10秒执行一次
|
print(f"未填写TYQH变量\n青龙可在环境变量设置TYQH 或者在本脚本文件上方将ck填入token =''")
|
||||||
✨ 第一个账号助力作者,其余互助
|
exit()
|
||||||
✨✨✨ @Author CHERWIN✨✨✨
|
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
||||||
''')
|
# print(tokens)
|
||||||
local_script_name = os.path.basename(__file__)
|
if len(tokens) > 0:
|
||||||
local_version = '2024.05.04'
|
print(f"\n>>>>>>>>>> 共获取到{len(tokens)} 个账号 <<<<<<<<<<")
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
# access_token = []
|
||||||
import_Tools()
|
# threads = []
|
||||||
else:
|
# for index, infos in enumerate(tokens):
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
# thread = threading.Thread(target=execute_task, args=(infos, index))
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
# threads.append(thread)
|
||||||
import_Tools()
|
# thread.start()
|
||||||
else:
|
#
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
# for thread in threads:
|
||||||
exit()
|
# thread.join()
|
||||||
print(TIPS)
|
while True:
|
||||||
token = ''
|
current_time = time.localtime()
|
||||||
ENV = os.environ.get('TYQH','')
|
if (current_time.tm_hour == 9 and current_time.tm_min == 59 and current_time.tm_sec >= 59) or \
|
||||||
TYQH_DHID = os.environ.get('TYQH_DHID',None)
|
(current_time.tm_hour == 10 and current_time.tm_min == 1 and current_time.tm_sec <= 59):
|
||||||
if TYQH_DHID == '0':
|
if len(tokens) > 0:
|
||||||
Log(f'\n当前已设置TYQH_DHID变量,将自动遍历兑换商品')
|
print(f"\n>>>>>>>>>> 共获取到{len(tokens)} 个账号 <<<<<<<<<<")
|
||||||
elif TYQH_DHID:
|
access_token = []
|
||||||
Log(f'\n当前已设置TYQH_DHID变量,将自动兑换id【{TYQH_DHID}】商品')
|
threads = []
|
||||||
else:
|
for index, infos in enumerate(tokens):
|
||||||
Log('\n未定义TYQH_DHID变量,取消自动兑换')
|
thread = threading.Thread(target=execute_task, args=(infos, index))
|
||||||
token = ENV if ENV else token
|
threads.append(thread)
|
||||||
if not token:
|
thread.start()
|
||||||
print(f"未填写TYQH变量\n青龙可在环境变量设置TYQH 或者在本脚本文件上方将ck填入token =''")
|
|
||||||
exit()
|
for thread in threads:
|
||||||
tokens = CHERWIN_TOOLS.ENV_SPLIT(token)
|
thread.join()
|
||||||
# print(tokens)
|
elif current_time.tm_hour == 10 and current_time.tm_min > 5:
|
||||||
if len(tokens) > 0:
|
break
|
||||||
print(f"\n>>>>>>>>>> 共获取到{len(tokens)} 个账号 <<<<<<<<<<")
|
else:
|
||||||
# access_token = []
|
time.sleep(1)
|
||||||
# threads = []
|
|
||||||
# for index, infos in enumerate(tokens):
|
|
||||||
# thread = threading.Thread(target=execute_task, args=(infos, index))
|
|
||||||
# threads.append(thread)
|
|
||||||
# thread.start()
|
|
||||||
#
|
|
||||||
# for thread in threads:
|
|
||||||
# thread.join()
|
|
||||||
while True:
|
|
||||||
current_time = time.localtime()
|
|
||||||
if (current_time.tm_hour == 9 and current_time.tm_min == 59 and current_time.tm_sec >= 59) or \
|
|
||||||
(current_time.tm_hour == 10 and current_time.tm_min == 1 and current_time.tm_sec <= 59):
|
|
||||||
if len(tokens) > 0:
|
|
||||||
print(f"\n>>>>>>>>>> 共获取到{len(tokens)} 个账号 <<<<<<<<<<")
|
|
||||||
access_token = []
|
|
||||||
threads = []
|
|
||||||
for index, infos in enumerate(tokens):
|
|
||||||
thread = threading.Thread(target=execute_task, args=(infos, index))
|
|
||||||
threads.append(thread)
|
|
||||||
thread.start()
|
|
||||||
|
|
||||||
for thread in threads:
|
|
||||||
thread.join()
|
|
||||||
elif current_time.tm_hour == 10 and current_time.tm_min > 5:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
|
|||||||
18
TYYP.py
18
TYYP.py
@ -16,8 +16,10 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
# import CHERWIN_TOOLS
|
# import CHERWIN_TOOLS
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -251,16 +253,20 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.06'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
'脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
|
|||||||
18
YDKD.py
18
YDKD.py
@ -32,8 +32,10 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
|||||||
# import CHERWIN_TOOLS
|
# import CHERWIN_TOOLS
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
|
IS_DEV = False
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
if os.path.isfile('DEV_ENV.py'):
|
||||||
import DEV_ENV
|
import DEV_ENV
|
||||||
|
IS_DEV = True
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
@ -339,16 +341,20 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.04.06'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
'脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
|
|||||||
149
ZTKD.py
149
ZTKD.py
@ -1,56 +1,42 @@
|
|||||||
# !/usr/bin/python3
|
# !/usr/bin/python3
|
||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# ✨✨✨ 中通快递小程序签到✨✨✨
|
|
||||||
# ✨ 功能:
|
|
||||||
# 积分签到
|
|
||||||
# ✨ 抓包步骤:
|
|
||||||
# 打开中通快递小程序
|
|
||||||
# 授权登陆
|
|
||||||
# 打开抓包工具
|
|
||||||
# 找URl请求头带[x-token或者token]
|
|
||||||
# 复制里面的[x-token或者token]参数值
|
|
||||||
# 参数示例:eyJhbGciOiJIUzUxMiJ9.eyJnZW5lcmF0ZVRpbWUixxxxxx
|
|
||||||
# ✨ 设置青龙变量:
|
|
||||||
# export YDKD='x-token或者token参数值'多账号#或&分割
|
|
||||||
# export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|
||||||
# ✨ ✨ 注意:抓完CK没事儿别打开小程序,重新打开小程序请重新抓包
|
|
||||||
# ✨ 推荐cron:0 6 * * *
|
|
||||||
# ✨✨✨ @Author CHERWIN✨✨✨
|
# ✨✨✨ @Author CHERWIN✨✨✨
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "0 6 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "0 6 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('中通快递小程序签到')
|
# const $ = new Env('中通快递小程序签到')
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import random
|
|
||||||
import time
|
import time
|
||||||
from datetime import datetime, date
|
from datetime import datetime, date
|
||||||
from os import path
|
|
||||||
import requests
|
import requests
|
||||||
import hashlib
|
|
||||||
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||||
# import CHERWIN_TOOLS
|
|
||||||
# 禁用安全请求警告
|
# 禁用安全请求警告
|
||||||
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
|
||||||
#
|
|
||||||
if os.path.isfile('DEV_ENV.py'):
|
IS_DEV = True
|
||||||
import DEV_ENV
|
|
||||||
if os.path.isfile('notify.py'):
|
if os.path.isfile('notify.py'):
|
||||||
from notify import send
|
from notify import send
|
||||||
|
|
||||||
print("加载通知服务成功!")
|
print("加载通知服务成功!")
|
||||||
else:
|
else:
|
||||||
print("加载通知服务失败!")
|
print("加载通知服务失败!")
|
||||||
send_msg = ''
|
send_msg = ''
|
||||||
one_msg=''
|
one_msg = ''
|
||||||
|
|
||||||
|
|
||||||
def Log(cont=''):
|
def Log(cont=''):
|
||||||
global send_msg,one_msg
|
global send_msg, one_msg
|
||||||
print(cont)
|
print(cont)
|
||||||
if cont:
|
if cont:
|
||||||
one_msg += f'{cont}\n'
|
one_msg += f'{cont}\n'
|
||||||
send_msg += f'{cont}\n'
|
send_msg += f'{cont}\n'
|
||||||
|
|
||||||
|
|
||||||
class RUN:
|
class RUN:
|
||||||
def __init__(self,info,index):
|
def __init__(self, info, index):
|
||||||
global one_msg
|
global one_msg
|
||||||
one_msg = ''
|
one_msg = ''
|
||||||
split_info = info.split('@')
|
split_info = info.split('@')
|
||||||
@ -83,18 +69,18 @@ class RUN:
|
|||||||
self.list_index = 0
|
self.list_index = 0
|
||||||
self.isFirstTask = True
|
self.isFirstTask = True
|
||||||
|
|
||||||
def get_point(self,END=False):
|
def get_point(self, END=False):
|
||||||
Log('>>>>>>获取积分信息')
|
Log('>>>>>>获取积分信息')
|
||||||
json_data = {}
|
json_data = {}
|
||||||
response = s.post(f'{self.baseUrl}user/point/get', headers=self.headers,json=json_data)
|
response = s.post(f'{self.baseUrl}user/point/get', headers=self.headers, json=json_data)
|
||||||
point_info = response.json()
|
point_info = response.json()
|
||||||
# print(point_info)
|
# print(point_info)
|
||||||
code = point_info.get('code',-1)
|
code = point_info.get('code', -1)
|
||||||
if point_info.get('success',False) == True and code == 10000:
|
if point_info.get('success', False) == True and code == 10000:
|
||||||
data = point_info.get('data',[{}])
|
data = point_info.get('data', [{}])
|
||||||
point=data.get('point',0)
|
point = data.get('point', 0)
|
||||||
mobile=data.get('mobile','')
|
mobile = data.get('mobile', '')
|
||||||
mobile=mobile[:3] + "*" * 4 + mobile[7:]
|
mobile = mobile[:3] + "*" * 4 + mobile[7:]
|
||||||
if END:
|
if END:
|
||||||
Log(f'>>执行后积分:【{point}】')
|
Log(f'>>执行后积分:【{point}】')
|
||||||
else:
|
else:
|
||||||
@ -106,43 +92,42 @@ class RUN:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def Check_sign(self):
|
def Check_sign(self):
|
||||||
Log('>>>>>>查询签到')
|
Log('>>>>>>查询签到')
|
||||||
json_data = {"calendarType":0}
|
json_data = {"calendarType": 0}
|
||||||
response = s.post(f'{self.baseUrl}member/sign/v2/calendar', headers=self.headers,json=json_data)
|
response = s.post(f'{self.baseUrl}member/sign/v2/calendar', headers=self.headers, json=json_data)
|
||||||
response = response.json()
|
response = response.json()
|
||||||
# print(point_info)
|
# print(point_info)
|
||||||
code = response.get('code', -1)
|
code = response.get('code', -1)
|
||||||
if response['success']== True and response['data'] != None and code == 10000:
|
if response['success'] == True and response['data'] != None and code == 10000:
|
||||||
data=response.get('data',{})
|
data = response.get('data', {})
|
||||||
dayList=data.get('dayList',[{}])
|
dayList = data.get('dayList', [{}])
|
||||||
signDays=data.get('signDays',0)
|
signDays = data.get('signDays', 0)
|
||||||
for day in dayList:
|
for day in dayList:
|
||||||
dates = day.get('date','')
|
dates = day.get('date', '')
|
||||||
point = day.get('point','')
|
point = day.get('point', '')
|
||||||
signFlag = day.get('signFlag','')
|
signFlag = day.get('signFlag', '')
|
||||||
current_date = date.today()
|
current_date = date.today()
|
||||||
parsed_date = datetime.strptime(dates, '%Y-%m-%d').date()
|
parsed_date = datetime.strptime(dates, '%Y-%m-%d').date()
|
||||||
if parsed_date == current_date:
|
if parsed_date == current_date:
|
||||||
if signFlag == 1:
|
if signFlag == 1:
|
||||||
Log(f'>>今日已签到,连续签到【{signDays}】天,获得【{point}】积分')
|
Log(f'>>今日已签到,连续签到【{signDays}】天,获得【{point}】积分')
|
||||||
else:
|
else:
|
||||||
self.sign()
|
self.sign()
|
||||||
else:
|
else:
|
||||||
Log(f"查询签到失败,{response['msg']}")
|
Log(f"查询签到失败,{response['msg']}")
|
||||||
|
|
||||||
def sign(self):
|
def sign(self):
|
||||||
Log('>>>签到')
|
Log('>>>签到')
|
||||||
json_data = {}
|
json_data = {}
|
||||||
response = s.post(f'{self.baseUrl}member/sign/v2/userSignIn', headers=self.headers,json=json_data)
|
response = s.post(f'{self.baseUrl}member/sign/v2/userSignIn', headers=self.headers, json=json_data)
|
||||||
point_info = response.json()
|
point_info = response.json()
|
||||||
# print(point_info)
|
# print(point_info)
|
||||||
code = point_info.get('code', -1)
|
code = point_info.get('code', -1)
|
||||||
if point_info['success']== True and point_info['data'] != None and code == 10000:
|
if point_info['success'] == True and point_info['data'] != None and code == 10000:
|
||||||
point=point_info['data']['point']
|
point = point_info['data']['point']
|
||||||
Log(f'>>签到成功获得:【{point}】积分')
|
Log(f'>>签到成功获得:【{point}】积分')
|
||||||
else:
|
else:
|
||||||
Log(f">>签到失败,{point_info['msg']}")
|
Log(f">>签到失败,{point_info['msg']}")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
print(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
print(f"\n开始执行第{self.index}个账号--------------->>>>>")
|
||||||
@ -186,15 +171,17 @@ def down_file(filename, file_url):
|
|||||||
print(f'【{filename}】下载失败:{str(e)}')
|
print(f'【{filename}】下载失败:{str(e)}')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
def import_Tools():
|
def import_Tools():
|
||||||
global CHERWIN_TOOLS,ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
global CHERWIN_TOOLS, ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode
|
||||||
import CHERWIN_TOOLS
|
import CHERWIN_TOOLS
|
||||||
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
ENV, APP_INFO, TIPS, TIPS_HTML, AuthorCode = CHERWIN_TOOLS.main(APP_NAME, local_script_name, ENV_NAME,local_version)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
APP_NAME = '中通快递小程序'
|
APP_NAME = '中通快递小程序'
|
||||||
ENV_NAME = 'ZTKD'
|
ENV_NAME = 'ZTKD'
|
||||||
CK_NAME = 'x-token或者token'
|
CK_NAME = 'token'
|
||||||
print(f'''
|
print(f'''
|
||||||
✨✨✨ {APP_NAME}签到✨✨✨
|
✨✨✨ {APP_NAME}签到✨✨✨
|
||||||
✨ 功能:
|
✨ 功能:
|
||||||
@ -203,7 +190,7 @@ if __name__ == '__main__':
|
|||||||
打开{APP_NAME}
|
打开{APP_NAME}
|
||||||
授权登陆
|
授权登陆
|
||||||
打开抓包工具
|
打开抓包工具
|
||||||
找URl请求头带[{CK_NAME}]
|
找https://api.ztomember.com/api/user/point/get请求头里的[{CK_NAME}]
|
||||||
复制里面的[{CK_NAME}]参数值
|
复制里面的[{CK_NAME}]参数值
|
||||||
参数示例:eyJhbGciOiJIUzUxMiJ9.eyJnZW5lcmF0ZVRpbWUixxxxxx
|
参数示例:eyJhbGciOiJIUzUxMiJ9.eyJnZW5lcmF0ZVRpbWUixxxxxx
|
||||||
✨ 设置青龙变量:
|
✨ 设置青龙变量:
|
||||||
@ -214,16 +201,20 @@ export SCRIPT_UPDATE = 'False' 关闭脚本自动更新,默认开启
|
|||||||
✨✨✨ @Author CHERWIN✨✨✨
|
✨✨✨ @Author CHERWIN✨✨✨
|
||||||
''')
|
''')
|
||||||
local_script_name = os.path.basename(__file__)
|
local_script_name = os.path.basename(__file__)
|
||||||
local_version = '2024.05.08'
|
local_version = '2024.05.15'
|
||||||
if os.path.isfile('CHERWIN_TOOLS.py'):
|
if IS_DEV:
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
if down_file('CHERWIN_TOOLS.py', 'https://py.cherwin.cn/CHERWIN_TOOLS.py'):
|
if os.path.isfile('CHERWIN_TOOLS.py'):
|
||||||
print('脚本依赖下载完成请重新运行脚本')
|
|
||||||
import_Tools()
|
import_Tools()
|
||||||
else:
|
else:
|
||||||
print('脚本依赖下载失败,请到https://py.cherwin.cn/CHERWIN_TOOLS.py下载最新版本依赖')
|
if down_file('CHERWIN_TOOLS.py', 'https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py'):
|
||||||
exit()
|
print('脚本依赖下载完成请重新运行脚本')
|
||||||
|
import_Tools()
|
||||||
|
else:
|
||||||
|
print(
|
||||||
|
'脚本依赖下载失败,请到https://github.com/CHERWING/CHERWIN_SCRIPTS/raw/main/CHERWIN_TOOLS.py下载最新版本依赖')
|
||||||
|
exit()
|
||||||
print(TIPS)
|
print(TIPS)
|
||||||
token = ''
|
token = ''
|
||||||
token = ENV if ENV else token
|
token = ENV if ENV else token
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user