mirror of
https://github.com/smallfawn/QLScriptPublic.git
synced 2026-11-05 22:36:53 +08:00
fix some code
This commit is contained in:
1 parent
0d4198ba95
commit
2afb6a7666
18 files changed
+129
-2325
No files matched your search
@@ -5,9 +5,11 @@ on:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'daily/**' # 仅监控 daily 目录下的变更
|
||||
- 'daily/**' # 监控 daily 目录
|
||||
- '!daily/notify.py' # 排除 notify.py
|
||||
- '!daily/**/*.md' # 排除 md 文件
|
||||
- 'wxapp/**' # 监控 wxapp 目录
|
||||
- '!wxapp/**/*.md' # 排除 wxapp 下的 md 文件
|
||||
|
||||
jobs:
|
||||
update-readme:
|
||||
@@ -36,7 +38,7 @@ jobs:
|
||||
import datetime
|
||||
import subprocess
|
||||
|
||||
# 1. 获取本次 Push 更改的文件列表
|
||||
# 获取本次 Push 更改的文件列表
|
||||
try:
|
||||
diff_cmd = ['git', 'diff', '--name-only', 'HEAD~1', 'HEAD']
|
||||
result = subprocess.run(diff_cmd, capture_output=True, text=True, check=True)
|
||||
@@ -51,30 +53,58 @@ jobs:
|
||||
|
||||
now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
# 2. 提取变更文件中的 Env 名称及更新时间
|
||||
updates = {}
|
||||
# ========== 1. 收集更新信息 ==========
|
||||
daily_updates = {} # 脚本名 -> 更新时间
|
||||
wxapp_updates = {} # 脚本名 -> 更新时间
|
||||
|
||||
for f in changed_files:
|
||||
# 处理 daily 目录
|
||||
if f.startswith('daily/') and os.path.exists(f):
|
||||
filename = os.path.basename(f)
|
||||
if filename != 'notify.py' and not f.endswith('.md'):
|
||||
with open(f, 'r', encoding='utf-8') as file:
|
||||
match = re.search(r'Env\s*\(\s*["\']([^"\']+)["\']\s*\)', file.read())
|
||||
content = file.read()
|
||||
match = re.search(r'Env\s*\(\s*["\']([^"\']+)["\']\s*\)', content)
|
||||
if match:
|
||||
updates[match.group(1)] = now
|
||||
daily_updates[match.group(1)] = now
|
||||
|
||||
# 3. 遍历 daily 目录获取所有的 Env(用于找出表格中缺失的)
|
||||
all_envs = set()
|
||||
# 处理 wxapp 目录(同样使用 Env 提取)
|
||||
elif f.startswith('wxapp/') and os.path.exists(f):
|
||||
if f.endswith('.js') or f.endswith('.py'):
|
||||
with open(f, 'r', encoding='utf-8') as file:
|
||||
content = file.read()
|
||||
match = re.search(r'Env\s*\(\s*["\']([^"\']+)["\']\s*\)', content)
|
||||
if match:
|
||||
wxapp_updates[match.group(1)] = now
|
||||
|
||||
# ========== 2. 扫描目录获取所有现有脚本 ==========
|
||||
# daily 所有 Env 名称
|
||||
all_daily_scripts = set()
|
||||
if os.path.exists('daily'):
|
||||
for root, _, files in os.walk('daily'):
|
||||
for file in files:
|
||||
if file != 'notify.py' and not file.endswith('.md'):
|
||||
fpath = os.path.join(root, file).replace('\\', '/')
|
||||
with open(fpath, 'r', encoding='utf-8') as f:
|
||||
match = re.search(r'Env\s*\(\s*["\']([^"\']+)["\']\s*\)', f.read())
|
||||
content = f.read()
|
||||
match = re.search(r'Env\s*\(\s*["\']([^"\']+)["\']\s*\)', content)
|
||||
if match:
|
||||
all_envs.add(match.group(1))
|
||||
all_daily_scripts.add(match.group(1))
|
||||
|
||||
# 4. 修改 README.md
|
||||
# wxapp 所有 Env 名称
|
||||
all_wxapp_scripts = set()
|
||||
if os.path.exists('wxapp'):
|
||||
for root, _, files in os.walk('wxapp'):
|
||||
for file in files:
|
||||
if file.endswith('.js') or file.endswith('.py'):
|
||||
fpath = os.path.join(root, file).replace('\\', '/')
|
||||
with open(fpath, 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
match = re.search(r'Env\s*\(\s*["\']([^"\']+)["\']\s*\)', content)
|
||||
if match:
|
||||
all_wxapp_scripts.add(match.group(1))
|
||||
|
||||
# ========== 3. 更新 README 中的两个表格 ==========
|
||||
readme_path = 'README.md'
|
||||
if not os.path.exists(readme_path):
|
||||
print("README.md 不存在!")
|
||||
@@ -83,23 +113,24 @@ jobs:
|
||||
with open(readme_path, 'r', encoding='utf-8') as f:
|
||||
full_text = f.read()
|
||||
|
||||
start_tag = "<!-- README_TABLE_START -->"
|
||||
end_tag = "<!-- README_TABLE_END -->"
|
||||
# ---------- 3.1 更新 daily 表格 ----------
|
||||
start_daily = "<!-- README_TABLE_START -->"
|
||||
end_daily = "<!-- README_TABLE_END -->"
|
||||
|
||||
if start_tag not in full_text or end_tag not in full_text:
|
||||
print("错误:未找到锚点标记!")
|
||||
if start_daily not in full_text or end_daily not in full_text:
|
||||
print("错误:未找到 daily 表格的锚点标记!")
|
||||
exit(1)
|
||||
|
||||
pre_part, temp = full_text.split(start_tag)
|
||||
table_section, post_part = temp.split(end_tag)
|
||||
pre_part, temp = full_text.split(start_daily)
|
||||
daily_table_section, post_part = temp.split(end_daily)
|
||||
|
||||
lines = table_section.strip().split('\n')
|
||||
lines = daily_table_section.strip().split('\n')
|
||||
header, separator, body_lines = [], [], []
|
||||
mode = 'header'
|
||||
|
||||
for line in lines:
|
||||
l_s = line.strip()
|
||||
if not l_s.startswith('|'): continue
|
||||
if not l_s.startswith('|'):
|
||||
continue
|
||||
if '脚本名称' in l_s:
|
||||
header.append(line)
|
||||
mode = 'separator'
|
||||
@@ -109,34 +140,84 @@ jobs:
|
||||
elif mode == 'body':
|
||||
body_lines.append(line)
|
||||
|
||||
existing_names = set()
|
||||
new_body_lines = []
|
||||
|
||||
# A. 处理表格中已存在的脚本
|
||||
existing_daily = set()
|
||||
new_daily_body = []
|
||||
for line in body_lines:
|
||||
parts = [p.strip() for p in line.split('|')]
|
||||
if len(parts) >= 4:
|
||||
name = parts[1]
|
||||
existing_names.add(name)
|
||||
# 如果该脚本在本次 push 中被修改,更新时间
|
||||
if name in updates:
|
||||
line = f"| {name} | {updates[name]} | ✅ |"
|
||||
new_body_lines.append(line)
|
||||
existing_daily.add(name)
|
||||
if name in daily_updates:
|
||||
line = f"| {name} | {daily_updates[name]} | ✅ |"
|
||||
new_daily_body.append(line)
|
||||
|
||||
# B. 添加本次修改引发的新增脚本
|
||||
for name, tm in updates.items():
|
||||
if name not in existing_names:
|
||||
new_body_lines.append(f"| {name} | {tm} | ✅ |")
|
||||
existing_names.add(name)
|
||||
for name, tm in daily_updates.items():
|
||||
if name not in existing_daily:
|
||||
new_daily_body.append(f"| {name} | {tm} | ✅ |")
|
||||
existing_daily.add(name)
|
||||
|
||||
# C. 添加存在于 daily 目录但 README 表格中缺失的脚本
|
||||
for name in all_envs:
|
||||
if name not in existing_names:
|
||||
new_body_lines.append(f"| {name} | {now} | ✅ |")
|
||||
existing_names.add(name)
|
||||
for name in all_daily_scripts:
|
||||
if name not in existing_daily:
|
||||
new_daily_body.append(f"| {name} | {now} | ✅ |")
|
||||
|
||||
final_table = "\n".join(header + separator + new_body_lines)
|
||||
final_content = f"{pre_part}{start_tag}\n{final_table}\n{end_tag}{post_part}"
|
||||
final_daily_table = "\n".join(header + separator + new_daily_body)
|
||||
|
||||
# ---------- 3.2 更新 wxapp 表格 ----------
|
||||
start_wxapp = "<!-- WXAPP_TABLE_START -->"
|
||||
end_wxapp = "<!-- WXAPP_TABLE_END -->"
|
||||
|
||||
if start_wxapp not in full_text or end_wxapp not in full_text:
|
||||
print("错误:未找到 wxapp 表格的锚点标记!")
|
||||
exit(1)
|
||||
|
||||
# 从 post_part 中提取 wxapp 表格(因为 daily 表格已被切出)
|
||||
wxapp_pre, wxapp_temp = post_part.split(start_wxapp)
|
||||
wxapp_table_section, final_post = wxapp_temp.split(end_wxapp)
|
||||
|
||||
lines_wx = wxapp_table_section.strip().split('\n')
|
||||
header_wx, separator_wx, body_lines_wx = [], [], []
|
||||
mode_wx = 'header'
|
||||
for line in lines_wx:
|
||||
l_s = line.strip()
|
||||
if not l_s.startswith('|'):
|
||||
continue
|
||||
if '脚本名称' in l_s:
|
||||
header_wx.append(line)
|
||||
mode_wx = 'separator'
|
||||
elif '---' in l_s and mode_wx == 'separator':
|
||||
separator_wx.append(line)
|
||||
mode_wx = 'body'
|
||||
elif mode_wx == 'body':
|
||||
body_lines_wx.append(line)
|
||||
|
||||
existing_wxapp = set()
|
||||
new_wxapp_body = []
|
||||
for line in body_lines_wx:
|
||||
parts = [p.strip() for p in line.split('|')]
|
||||
if len(parts) >= 4:
|
||||
name = parts[1]
|
||||
existing_wxapp.add(name)
|
||||
if name in wxapp_updates:
|
||||
line = f"| {name} | {wxapp_updates[name]} | ✅ |"
|
||||
new_wxapp_body.append(line)
|
||||
|
||||
for name, tm in wxapp_updates.items():
|
||||
if name not in existing_wxapp:
|
||||
new_wxapp_body.append(f"| {name} | {tm} | ✅ |")
|
||||
existing_wxapp.add(name)
|
||||
|
||||
for name in all_wxapp_scripts:
|
||||
if name not in existing_wxapp:
|
||||
new_wxapp_body.append(f"| {name} | {now} | ✅ |")
|
||||
|
||||
final_wxapp_table = "\n".join(header_wx + separator_wx + new_wxapp_body)
|
||||
|
||||
# 重新组合整个 README
|
||||
final_content = (
|
||||
pre_part + start_daily + "\n" + final_daily_table + "\n" + end_daily +
|
||||
wxapp_pre + start_wxapp + "\n" + final_wxapp_table + "\n" + end_wxapp +
|
||||
final_post
|
||||
)
|
||||
|
||||
with open(readme_path, 'w', encoding='utf-8') as f:
|
||||
f.write(final_content)
|
||||
@@ -151,7 +232,7 @@ jobs:
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git add README.md
|
||||
if ! git diff --staged --quiet; then
|
||||
git commit -m "docs: 自动更新 daily 脚本状态 [skip ci]"
|
||||
git commit -m "docs: 自动更新 daily 和 wxapp 脚本状态 [skip ci]"
|
||||
git push
|
||||
else
|
||||
echo "无变更需推送。"
|
||||
|
||||
@@ -53,7 +53,13 @@
|
||||
| 立乐家会员俱乐部 | 2026-04-08 13:57:03 | ✅ |
|
||||
| 益禾堂 | 2026-04-12 14:09:41 | ✅ |
|
||||
<!-- README_TABLE_END -->
|
||||
## 微信小程序脚本 需要wechat code server
|
||||
|
||||
| 脚本名称 | 更新时间 | 状态 |
|
||||
| --- | --- | --- |
|
||||
<!-- WXAPP_TABLE_START -->
|
||||
|
||||
<!-- WXAPP_TABLE_END -->
|
||||
# 青龙面板拉库命令
|
||||
|
||||
`ql repo https://github.com/smallfawn/QLScriptPublic.git backup main`
|
||||
|
||||
-706
@@ -1,706 +0,0 @@
|
||||
/**
|
||||
* mys 米忽悠 米游社 原神签到
|
||||
* scriptVersionNow = "0.0.4"
|
||||
* cron 12 5 * * * mys.js
|
||||
* 23-06-13 过渡更新V0.0.4
|
||||
* # 青龙面板 -- 配置文件
|
||||
* =>配置文件 export mys='cookie1&cookie2'
|
||||
* =>环境变量 变量名mys 变量值(如下)
|
||||
* 多账号用 @ 分割
|
||||
* ====================================
|
||||
* 打开https://www.miyoushe.com/ys/
|
||||
* ALook浏览器打开登录后点击下方导航栏最下面三条杠往左滑 点击工具箱-开发者工具-cookie-拷贝
|
||||
* 打开http://user.mihoyo.com/
|
||||
* ALook浏览器打开登录后点击下方导航栏最下面三条杠往左滑 点击工具箱-开发者工具-cookie-拷贝
|
||||
* 两个拷贝下来拼接到一起 拼接字符& 拼接字符& 拼接字符&
|
||||
* 示例:
|
||||
* cookie_token_v2=xxx; account_mid_v2=xxx; account_id_v2=xxx; ltoken_v2=xxx; ltmid_v2=xxx; ltuid_v2=xxx & login_uid=xxx; login_ticket=xxx;
|
||||
* 必要参数 cookie_token_v2 ltoken_v2 login_ticket
|
||||
* 二选一参数 ltmid_v2或者account_mid_v2 and account_id_v2或者ltuid_v2或者login_id
|
||||
* 请确保上面5个参数都存在
|
||||
*/
|
||||
const $ = new Env("米游社 原神签到");
|
||||
const ckName = "mys";
|
||||
//-------------------- 一般不动变量区域 -------------------------------------
|
||||
const { log } = require("console");
|
||||
const Notify = 1; //0为关闭通知,1为打开通知,默认为1
|
||||
const notify = $.isNode() ? require("./sendNotify") : "";
|
||||
let envSplitor = ["@"]; //多账号分隔符
|
||||
let msg = "";
|
||||
let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || "";
|
||||
let userList = [];
|
||||
let userIdx = 0;
|
||||
let userCount = 0;
|
||||
let scriptVersionLatest; //最新版本
|
||||
let scriptVersionNow = "0.0.4"; //现在版本
|
||||
/////////////////////
|
||||
let jiangliArr = [];
|
||||
const fs = require('fs');
|
||||
let strShare = './Mihoyo_Account.json';//指定文件目录
|
||||
let Fileexists = fs.existsSync(strShare);//检测文件是否存在
|
||||
let TempAccount = [];
|
||||
if (Fileexists) {//如果存在
|
||||
console.log("检测到米哈游缓存文件Mihoyo_Account.json,载入...");
|
||||
TempAccount = fs.readFileSync(strShare, 'utf-8');
|
||||
if (TempAccount) {
|
||||
TempAccount = TempAccount.toString();
|
||||
TempAccount = JSON.parse(TempAccount);
|
||||
}
|
||||
}
|
||||
//# 米游社的版本 # Salt和Version相互对应
|
||||
const mihoyobbs_version = "2.49.1";
|
||||
//# 米游社的客户端类型 # 1为ios 2为安卓
|
||||
const mihoyobbs_Client_type = "2";
|
||||
//# 4为pc web 5为mobile web
|
||||
const mihoyobbs_Client_type_web = "5";
|
||||
//# 云原神版本
|
||||
const cloudgenshin_Version = "3.0.0";
|
||||
//# 米游社的分区列表
|
||||
const mihoyobbs_List = [
|
||||
{
|
||||
id: "1",
|
||||
forumId: "1",
|
||||
name: "崩坏3",
|
||||
url: "https://bbs.mihoyo.com/bh3/",
|
||||
}, {
|
||||
id: "2",
|
||||
forumId: "26",
|
||||
name: "原神",
|
||||
url: "https://bbs.mihoyo.com/ys/",
|
||||
}, {
|
||||
id: "3",
|
||||
forumId: "30",
|
||||
name: "崩坏2",
|
||||
url: "https://bbs.mihoyo.com/bh2/",
|
||||
}, {
|
||||
id: "4",
|
||||
forumId: "37",
|
||||
name: "未定事件簿",
|
||||
url: "https://bbs.mihoyo.com/wd/",
|
||||
}, {
|
||||
id: "5",
|
||||
forumId: "34",
|
||||
name: "大别野",
|
||||
url: "https://bbs.mihoyo.com/dby/",
|
||||
}, {
|
||||
id: "6",
|
||||
forumId: "52",
|
||||
name: "崩坏:星穹铁道",
|
||||
url: "https://bbs.mihoyo.com/sr/",
|
||||
}, {
|
||||
id: "8",
|
||||
forumId: "57",
|
||||
name: "绝区零",
|
||||
url: "https://bbs.mihoyo.com/zzz/",
|
||||
},
|
||||
];
|
||||
|
||||
const game_id2name = {
|
||||
bh2_cn: "崩坏2",
|
||||
bh3_cn: "崩坏3",
|
||||
nxx_cn: "未定事件簿",
|
||||
hk4e_cn: "原神",
|
||||
hkrpg_cn: "崩坏: 星穹铁道",
|
||||
};
|
||||
|
||||
const game_id2config = {
|
||||
bh2_cn: "honkai2",
|
||||
bh3_cn: "honkai3rd",
|
||||
nxx_cn: "tears_of_themis",
|
||||
hk4e_cn: "genshin",
|
||||
hkrpg_cn: "honkaisr",
|
||||
};
|
||||
|
||||
//# 游戏签到的请求头
|
||||
const sign_headers = {
|
||||
Accept: "application/json, text/plain, */*",
|
||||
DS: "",
|
||||
"x-rpc-channel": "miyousheluodi",
|
||||
Origin: "https://webstatic.mihoyo.com",
|
||||
"x-rpc-app_version": mihoyobbs_version,
|
||||
"User-Agent":
|
||||
`Mozilla/5.0 (Linux; Android 12; Unspecified Device) AppleWebKit/537.36 (KHTML, like Gecko) ` +
|
||||
`Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36 miHoYoBBS/${mihoyobbs_version}`,
|
||||
"x-rpc-client_type": mihoyobbs_Client_type_web,
|
||||
Referer: "",
|
||||
"Accept-Encoding": "gzip, deflate",
|
||||
"Accept-Language": "zh-CN,en-US;q=0.8",
|
||||
"X-Requested-With": "com.mihoyo.hyperion",
|
||||
Cookie: "",
|
||||
"x-rpc-device_id": "",
|
||||
};
|
||||
|
||||
//# 通用设置
|
||||
const bbs_api = "https://bbs-api.mihoyo.com";
|
||||
const web_api = "https://api-takumi.mihoyo.com";
|
||||
const account_Info_url = web_api + "/binding/api/getUserGameRolesByCookie?game_biz=";
|
||||
const act_id_list = {
|
||||
genshin_Act_id: "e202009291139501", //# 原神自动签到相关的设置
|
||||
honkai_sr_Act_id: "e202304121516551", //# 星穹铁道自动签到相关设置
|
||||
honkai2_Act_id: "e202203291431091", //# 崩坏2自动签到相关的相关设置
|
||||
honkai3rd_Act_id: "e202207181446311", //# 崩坏3自动签到相关的设置
|
||||
tearsofthemis_Act_id: "e202202251749321", //# 未定事件簿自动签到相关设置
|
||||
}
|
||||
//# 米游社的API列表
|
||||
const bbs_api_list = {
|
||||
bbs_cookie_url: "https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket={}",
|
||||
bbs_cookie_url2: web_api + "/auth/api/getMultiTokenByLoginTicket?login_ticket={}&token_types=3&uid={}",
|
||||
bbs_tasks_list: bbs_api + "/apihub/sapi/getUserMissionsState", //# 获取任务列表
|
||||
bbs_sign_url: bbs_api + "/apihub/app/api/signIn", //# post
|
||||
bbs_post_list_url: bbs_api + "/post/api/getForumPostList?forum_id={}&is_good=false&is_hot=false&page_size=20&sort_type=1",
|
||||
bbs_detail_url: bbs_api + "/post/api/getPostFull?post_id={}",
|
||||
bbs_share_url: bbs_api + "/apihub/api/getShareConf?entity_id={}&entity_type=1",
|
||||
bbs_like_url: bbs_api + "/apihub/sapi/upvotePost", //# post json
|
||||
bbs_get_captcha: bbs_api + "/misc/api/createVerification?is_high=true",
|
||||
bbs_captcha_verify: bbs_api + "/misc/api/verifyVerification",
|
||||
};
|
||||
//# 通用游戏签到API
|
||||
const any_checkin_rewards = web_api + "/event/luna/home?lang=zh-cn&act_id={}";
|
||||
const any_is_signurl = web_api + "/event/luna/info?lang=zh-cn&act_id={}®ion={}&uid={}";
|
||||
const any_sign_url = web_api + "/event/luna/sign";
|
||||
//# 原神相关API
|
||||
const genshin_checkin_rewards = `${web_api}/event/bbs_sign_reward/home?act_id=${act_id_list['genshin_Act_id']}`;
|
||||
const genshin_Is_signurl = web_api + "/event/bbs_sign_reward/info?act_id={}®ion={}&uid={}";
|
||||
const genshin_Signurl = web_api + "/event/bbs_sign_reward/sign";
|
||||
//# 云原神相关api
|
||||
const cloud_genshin_Api = "https://api-cloudgame.mihoyo.com";
|
||||
const cloud_genshin_sgin = cloud_genshin_Api + "/hk4e_cg_cn/wallet/wallet/get";
|
||||
//# 接下来是国际服的内容
|
||||
const os_lang = "zh-cn";
|
||||
const os_referer_url = "https://act.hoyolab.com/";
|
||||
|
||||
// SaltConfig 对象,存储生成 Headers 所用的 salt 值
|
||||
const SaltConfig = {
|
||||
//# 米游社的Salt
|
||||
mihoyobbs_salt: "egBrFMO1BPBG0UX5XOuuwMRLZKwTVKRV",
|
||||
mihoyobbs_salt_x4: "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs",
|
||||
mihoyobbs_salt_x6: "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",
|
||||
mihoyobbs_salt_web: "DG8lqMyc9gquwAUFc7zBS62ijQRX9XF7",
|
||||
};
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
async function start() {
|
||||
//await getVersion("smallfawn/QLScriptPublic/main/mys.js");
|
||||
log(`todoList:此次版本更新为过渡版本,以后将增加米游币的任务`)
|
||||
log(`tips:更新双变量模式,两个网址获取的两个cookie用&分割`)
|
||||
log(`\n====== 当前版本:${scriptVersionNow} 📌 最新版本:${scriptVersionLatest} ======`);
|
||||
//await getNotice();
|
||||
let taskall;
|
||||
log("\n==========> 获取当月奖励详情 <==========\n");
|
||||
taskall = [];
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
if (user.index == 1) {
|
||||
taskall.push(await user.getAwards(act_id_list['genshin_Act_id']))//原神奖励列表
|
||||
}
|
||||
taskall.push(await user.main());
|
||||
await $.wait(1000);
|
||||
await Promise.all(taskall);
|
||||
} else {
|
||||
log(`账号[${user.index}] cookie参数不全,停止执行!所有任务`)
|
||||
}
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
|
||||
}
|
||||
//新接口APP签到COOKIE
|
||||
//ltuid=296874595; login_ticket=iMBL8bwpaiCiKqjzhbmzLBp9xL5fuGn8uDF0k3Y1; account_id=296874595; ltoken=UJhY0UQQNt0kwagQNGXTZu73WfIjUHLviHPxiliV; cookie_token=kT4pb3rkmMiK0Biaec9KlfKu1zFop2C0Dcv0hCpL;
|
||||
//ltoken通过verifyToken接口获得 Cookie必须含有account_id和cookie_token 返回Set-Cookie 中包含 ltoken
|
||||
class UserInfo {
|
||||
constructor(str) {
|
||||
this.index = ++userIdx;
|
||||
this.cookieStr = str.split("&")[0];
|
||||
this.cookieStr_login = str.split("&")[1];
|
||||
this.cookieStr_login = this.cookieStr_login.replace(/\s/g, '');
|
||||
this.cookieStr_login += ";"
|
||||
this.ckStatus = true;
|
||||
|
||||
this.cookie_token_v2 = "";
|
||||
this.account_mid_v2 = "";
|
||||
this.account_id_v2 = "";
|
||||
this.ltoken_v2 = "";
|
||||
this.ltmid_v2 = "";
|
||||
this.ltuid_v2 = "";
|
||||
this.login_uid = "";
|
||||
this.login_ticket = "";
|
||||
|
||||
this.stuid = "";
|
||||
this.stoken = "";
|
||||
this.device_id = "";
|
||||
|
||||
this.region = "";
|
||||
this.uid_ys = "";
|
||||
this.isLoginApp = false
|
||||
}
|
||||
async getCookie() {
|
||||
this.cookieStr = this.cookieStr.replace(/\s/g, '');
|
||||
//log(this.cookieStr)
|
||||
const cookieMustValues1 = ['cookie_token_v2', 'ltoken_v2'];
|
||||
for (const cookieName of cookieMustValues1) {
|
||||
const match = new RegExp(`${cookieName}=([^;]+)`).exec(this.cookieStr);
|
||||
if (match !== null) {
|
||||
this[cookieName] = match[1];
|
||||
} else {
|
||||
log(`账号[${this.index}] ${cookieName} cookie参数不全,停止执行!所有任务`)
|
||||
this.ckStatus = false
|
||||
return
|
||||
}
|
||||
}
|
||||
const cookieMustValues2 = ['account_mid_v2', 'account_id_v2', 'ltmid_v2', 'ltuid_v2'];
|
||||
for (const cookieName of cookieMustValues2) {
|
||||
const match = new RegExp(`${cookieName}=([^;]+)`).exec(this.cookieStr);
|
||||
if (match !== null) {
|
||||
this[cookieName] = match[1];
|
||||
} else {
|
||||
this[cookieName] = match;
|
||||
}
|
||||
}
|
||||
/*if (/cookie_token_v2=([^;]+)/.exec(this.cookieStr) !== null) {
|
||||
this.cookie_token_v2 = /cookie_token_v2=([^;]+)/.exec(this.cookieStr)[1];
|
||||
}
|
||||
if (/account_mid_v2=([^;]+)/.exec(this.cookieStr) !== null) {
|
||||
this.account_mid_v2 = /account_mid_v2=([^;]+)/.exec(this.cookieStr)[1];
|
||||
}
|
||||
|
||||
}
|
||||
this.cookie_token_v2 = /cookie_token_v2=([^;]+)/.exec(this.cookieStr)[1];
|
||||
this.account_mid_v2 = /account_mid_v2=([^;]+)/.exec(this.cookieStr)[1];*/
|
||||
if (/login_ticket=([^;]+)/.exec(this.cookieStr_login)) {
|
||||
this.login_ticket = /login_ticket=([^;]+)/.exec(this.cookieStr_login)[1]
|
||||
this.isLoginApp = true;
|
||||
} else {
|
||||
this.login_ticket == "";
|
||||
this.isLoginApp = false;
|
||||
}
|
||||
//this.stuid = "";
|
||||
//this.stoken = "";
|
||||
this.setValues('UID')//设置UID和MID
|
||||
this.setValues('MID')//设置UID和MID
|
||||
this.checkCookie()
|
||||
if (this.ckStatus) {
|
||||
await this.GetCollect()
|
||||
}
|
||||
//使用获取到的Cookie
|
||||
if (this.isLoginApp) {
|
||||
this.cookieAll = `cookie_token_v2=${this.cookie_token_v2}; account_mid_v2=${this.account_mid_v2}; account_id_v2=${this.account_id_v2}; ltoken_v2=${this.ltoken_v2}; ltmid_v2=${this.ltmid_v2}; ltuid_v2=${this.ltuid_v2}; login_uid=${this.login_uid}; login_ticket=${this.login_ticket};`
|
||||
} else {
|
||||
this.cookieAll = `cookie_token_v2=${this.cookie_token_v2}; account_mid_v2=${this.account_mid_v2}; account_id_v2=${this.account_id_v2}; ltoken_v2=${this.ltoken_v2}; ltmid_v2=${this.ltmid_v2}; ltuid_v2=${this.ltuid_v2};`
|
||||
}
|
||||
}
|
||||
checkCookie() {
|
||||
if (this.cookie_token_v2 && this.account_mid_v2 && this.account_id_v2 && this.ltoken_v2 && this.ltmid_v2 && this.ltuid_v2 && this.login_uid) {
|
||||
this.ckStatus = true;
|
||||
} else {
|
||||
this.ckStatus = false;
|
||||
log(`缺少参数 设置false`)
|
||||
}
|
||||
}
|
||||
setValues(str) {
|
||||
if (str == 'UID') {
|
||||
this.account_id_v2 = this.account_id_v2 || this.ltuid_v2 || this.login_uid;
|
||||
this.ltuid_v2 = this.ltuid_v2 || this.account_id_v2 || this.login_uid;
|
||||
//log(`this.ltuid_v2` + this.ltuid_v2)
|
||||
//log(`this.account_id_v2` + this.account_id_v2)
|
||||
|
||||
this.login_uid = this.login_uid || this.account_id_v2 || this.ltuid_v2;
|
||||
//log(`this.login_uid` + this.login_uid)
|
||||
} else if (str == 'MID') {
|
||||
this.account_mid_v2 = this.account_mid_v2 || this.ltmid_v2
|
||||
this.ltmid_v2 = this.ltmid_v2 || this.account_mid_v2
|
||||
}
|
||||
}
|
||||
async GetCollect() {
|
||||
let boolneedUpdate = false;
|
||||
let isIn = false;
|
||||
if (TempAccount) {
|
||||
for (let j = 0; j < TempAccount.length; j++) {
|
||||
if (TempAccount[j]["uid"] == this.account_id_v2 || TempAccount[j]["uid"] == this.ltuid_v2 || TempAccount[j]["uid"] == this.login_uid) {
|
||||
isIn = true;
|
||||
this.cookie_token_v2 = TempAccount[j]['cookie_token_v2'];
|
||||
this.account_mid_v2 = TempAccount[j]['mid'];
|
||||
this.account_id_v2 = TempAccount[j]['uid'];
|
||||
this.ltoken_v2 = TempAccount[j]['ltoken_v2'];
|
||||
this.ltmid_v2 = TempAccount[j]['mid'];
|
||||
this.ltuid_v2 = TempAccount[j]['uid'];
|
||||
this.login_uid = TempAccount[j]['uid'];
|
||||
this.login_ticket = TempAccount[j]['login_ticket'];
|
||||
this.stuid = TempAccount[j]['stuid']
|
||||
this.stoken = TempAccount[j]['stoken'];
|
||||
this.device_id = TempAccount[j]['device_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isIn) {
|
||||
console.log(`账号[${this.index}] 该账号无缓存,尝试联网获取stoken.....`);
|
||||
if (this.isLoginApp) {
|
||||
await this.task_login();
|
||||
} else {
|
||||
console.log(`账号[${this.index}] 缺少login_ticket参数,不执行米游币任务`);
|
||||
}
|
||||
if (this.stoken == "" || this.stoken !== "") {
|
||||
var tempAddCooKie = {};
|
||||
tempAddCooKie = {
|
||||
"uid": this.account_id_v2,
|
||||
"mid": this.account_mid_v2,
|
||||
"cookie_token_v2": this.cookie_token_v2,
|
||||
"ltoken_v2": this.ltoken_v2,
|
||||
"login_ticket": this.login_ticket,
|
||||
"stoken": this.stoken,
|
||||
"device_id": getUUID()
|
||||
};
|
||||
TempAccount.push(tempAddCooKie);
|
||||
//标识,需要更新缓存文件
|
||||
boolneedUpdate = true;
|
||||
} else {
|
||||
boolneedUpdate = true
|
||||
}
|
||||
}
|
||||
if (boolneedUpdate) {
|
||||
var str = JSON.stringify(TempAccount, null, 2);
|
||||
//var str = JSON.stringify(TempAccount);
|
||||
//log(TempAccount)
|
||||
fs.writeFile(strShare, str, function (err) {
|
||||
if (err) {
|
||||
console.log(err);
|
||||
console.log("\n【缓存文件Mihoyo_Account.json更新失败!】\n");
|
||||
} else {
|
||||
console.log("\n【缓存文件Mihoyo_Account.json更新成功!】\n");
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
async getHeaders() {
|
||||
await this.GetCollect()
|
||||
const headers = sign_headers;
|
||||
headers['Cookie'] = this.cookieAll;
|
||||
headers['DS'] = this.getDS(true)
|
||||
headers['x-rpc-device_id'] = this.device_id//getUUID();
|
||||
headers['User-Agent'] = `Mozilla/5.0 (Linux; Android 12; Unspecified Device) AppleWebKit/537.36 (KHTML, like Gecko) ` +
|
||||
`Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36 miHoYoBBS/${mihoyobbs_version}`
|
||||
return headers;
|
||||
}
|
||||
//# 获取请求Header里的DS 当web为true则生成网页端的DS
|
||||
getDS(web) {
|
||||
let salt;
|
||||
if (web) {
|
||||
salt = SaltConfig.mihoyobbs_salt_web;
|
||||
} else {
|
||||
salt = SaltConfig.mihoyobbs_salt;
|
||||
}
|
||||
const timestamp = Math.floor(Date.now() / 1e3);
|
||||
const random = Math.random().toString(36).slice(-6);
|
||||
const result = MD5_Encrypt(`salt=${salt}&t=${timestamp}&r=${random}`);
|
||||
return `${timestamp},${random},${result}`;
|
||||
}
|
||||
/**
|
||||
* # 获取请求Header里的DS(版本2) 这个版本ds之前见到都是查询接口里的
|
||||
* @param {*} q
|
||||
* @param {*} b
|
||||
* @returns
|
||||
*/
|
||||
getDS2(q, b) {
|
||||
const salt = SaltConfig.mihoyobbs_salt_x6;
|
||||
const timestamp = Math.floor(Date.now() / 1e3);
|
||||
const random = Math.floor(Math.random() * (200000 - 100001 + 1) + 100001).toString();
|
||||
const add = `&b=${b}&q=${q}`;
|
||||
const result = MD5_Encrypt(`salt=${salt}&t=${timestamp}&r=${random}${add}`);
|
||||
return `${timestamp},${random},${result}`;
|
||||
}
|
||||
|
||||
async getAwards(act_id) {
|
||||
let options = {
|
||||
url: `https://api-takumi.mihoyo.com/event/bbs_sign_reward/home?act_id=${act_id}`,
|
||||
headers: {}
|
||||
}
|
||||
let result = await httpRequest(options)
|
||||
for (let i in result.data.awards) {
|
||||
jiangliArr.push(`${result.data.awards[i].name} * ${result.data.awards[i].cnt}`);
|
||||
}
|
||||
DoubleLog(jiangliArr);
|
||||
}
|
||||
async main() {
|
||||
try {
|
||||
await this.getCookie()//获取stuid以及stoken 且保存 以JSON格式 mihoyoConfig.json{存放 stuid为键 其他为值}
|
||||
if (this.ckStatus) {
|
||||
await this.get_info_ys()
|
||||
await this.get_sign_info(act_id_list['genshin_Act_id'])
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async task_login() {//获取米哈游的APP stuid以及stoken
|
||||
try {
|
||||
let options, result
|
||||
options = {
|
||||
url: `https://webapi.account.mihoyo.com/Api/cookie_accountinfo_by_loginticket?login_ticket=${this.login_ticket}`,
|
||||
headers: {}
|
||||
}, result = await httpRequest(options);
|
||||
//log(options)
|
||||
//log(result)
|
||||
if (result.data.msg == '成功') {
|
||||
this.stuid = result.data.cookie_info.account_id
|
||||
options = {
|
||||
url: `https://api-takumi.mihoyo.com/auth/api/getMultiTokenByLoginTicket?login_ticket=${this.login_ticket}&token_types=3&uid=${this.stuid}`,
|
||||
headers: {}
|
||||
}, result = await httpRequest(options);
|
||||
if (result.message == 'OK') {
|
||||
this.stoken = result.data.list[0].token
|
||||
//log(this.stoken)
|
||||
//log(result)
|
||||
//DoubleLog('保存STUID和STOKEN success')
|
||||
}
|
||||
} else {
|
||||
DoubleLog(`账号[${this.index}] login_ticket已失效`);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async get_info_ys() {
|
||||
let headers = await this.getHeaders()
|
||||
try {
|
||||
let options = {
|
||||
url: `https://api-takumi.mihoyo.com/binding/api/getUserGameRolesByCookie?game_biz=hk4e_cn`,
|
||||
headers: headers,
|
||||
},
|
||||
result = await httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.retcode == 0) {
|
||||
//log(`账号[${this.index}] 获取原神信息成功`);
|
||||
//let game_biz = result.data.list[0].game_biz;
|
||||
let region = result.data.list[0].region;
|
||||
let game_uid = result.data.list[0].game_uid;
|
||||
let nickname = result.data.list[0].nickname;
|
||||
let region_name = result.data.list[0].region_name;
|
||||
this.region = region;
|
||||
this.uid_ys = game_uid;
|
||||
//log(game_biz, region, game_uid, nickname, region_name);
|
||||
DoubleLog(`账号[${this.index}] 游戏昵称${nickname},${region_name}`);
|
||||
} else {
|
||||
DoubleLog(`账号[${this.index}] 获取原神信息:失败 ❌ ,原因未知!`);
|
||||
log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 签到信息
|
||||
*/
|
||||
async get_sign_info(act_id) {
|
||||
let tmpHeaders = await this.getHeaders()
|
||||
tmpHeaders['Referer'] = `https://webstatic.mihoyo.com/bbs/event/signin-ys/index.html?bbs_auth_required=true&act_id=${act_id}&utm_source=bbs&utm_medium=mys&utm_campaign=icon`
|
||||
try {
|
||||
let options = {
|
||||
url: `https://api-takumi.mihoyo.com/event/bbs_sign_reward/info?act_id=${act_id}®ion=${this.region}&uid=${this.uid_ys}`,
|
||||
headers: tmpHeaders
|
||||
}, result = await httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.retcode == 0) {
|
||||
//DoubleLog(`账号[${this.index}] 获取签到信息成功`);
|
||||
DoubleLog(`账号[${this.index}] 签到天数${result.data.total_sign_day},今天${result.data.today},是否签到${result.data.is_sign}`);
|
||||
if (result.data.is_sign == false) {
|
||||
DoubleLog(`账号[${this.index}] 执行签到`);
|
||||
await this.task_sign(act_id);
|
||||
}
|
||||
} else {
|
||||
DoubleLog(`账号[${this.index}] 获取签到信息:失败 ❌ ,原因未知!`);
|
||||
log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
async task_sign(act_id) {
|
||||
let tmpHeaders = await this.getHeaders()
|
||||
tmpHeaders['Referer'] = `https://webstatic.mihoyo.com/bbs/event/signin-ys/index.html?bbs_auth_required=true&act_id=${act_id}&utm_source=bbs&utm_medium=mys&utm_campaign=icon`
|
||||
try {
|
||||
let options = {
|
||||
url: `https://api-takumi.mihoyo.com/event/bbs_sign_reward/sign`,
|
||||
headers: tmpHeaders,
|
||||
body: $.toStr({ act_id: act_id, region: this.region, uid: this.uid_ys, })
|
||||
}, result = await httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.retcode == 0 && 'gt' in result.data) {
|
||||
DoubleLog(`账号[${this.index}] 签到:失败,原因有点选验证请手动签到🎉`);
|
||||
} else if (result.retcode == 0 && !('gt' in result.data)) {
|
||||
DoubleLog(`账号[${this.index}] 签到:${result.message} ❌ 了呢,原因未知!`);
|
||||
console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
!(async () => {
|
||||
if (!(await checkEnv())) return;
|
||||
if (userList.length > 0) {
|
||||
await start();
|
||||
}
|
||||
await SendMsg(msg);
|
||||
})()
|
||||
.catch((e) => console.log(e))
|
||||
.finally(() => $.done());
|
||||
|
||||
//********************************************************
|
||||
// 变量检查与处理
|
||||
async function checkEnv() {
|
||||
if (userCookie) {
|
||||
// console.log(userCookie);
|
||||
let e = envSplitor[0];
|
||||
for (let o of envSplitor)
|
||||
if (userCookie.indexOf(o) > -1) {
|
||||
e = o;
|
||||
break;
|
||||
}
|
||||
for (let n of userCookie.split(e)) n && userList.push(new UserInfo(n));
|
||||
userCount = userList.length;
|
||||
} else {
|
||||
console.log("未找到CK");
|
||||
return;
|
||||
}
|
||||
return console.log(`共找到${userCount}个账号`), true; //true == !0
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
function httpRequest(options, method) {
|
||||
method = options.method ? options.method.toLowerCase() : options.body ? "post" : "get";
|
||||
return new Promise((resolve) => {
|
||||
$[method](options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${method}请求失败`);
|
||||
$.logErr(err);
|
||||
} else {
|
||||
if (data) {
|
||||
typeof JSON.parse(data) == "object" ? (data = JSON.parse(data)) : (data = data);
|
||||
resolve(data);
|
||||
} else {
|
||||
console.log(`请求api返回数据为空,请检查自身原因`);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getUUID() {
|
||||
return Array.from({ length: 32 }, () => Math.floor(Math.random() * 16).toString(16)).map((value, index) => [7, 11, 15, 19].includes(index) ? `-${value}` : value).join("");
|
||||
}
|
||||
/**
|
||||
* 获取远程版本
|
||||
*/
|
||||
function getVersion(scriptUrl, timeout = 3 * 1000) {
|
||||
return new Promise((resolve) => {
|
||||
let options = {
|
||||
url: `https://ghproxy.com/https://raw.githubusercontent.com/${scriptUrl}`,
|
||||
};
|
||||
$.get(
|
||||
options,
|
||||
async (err, resp, data) => {
|
||||
try {
|
||||
let regex = /scriptVersionNow\s*=\s*(["'`])([\d.]+)\1/;
|
||||
let match = data.match(regex);
|
||||
scriptVersionLatest = match ? match[2] : "";
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
timeout
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
async function getNotice() {
|
||||
try {
|
||||
let options = {
|
||||
url: `https://ghproxy.com/https://raw.githubusercontent.com/smallfawn/Note/main/Notice.json`,
|
||||
headers: { "User-Agent": "" },
|
||||
},
|
||||
result = await httpRequest(options);
|
||||
if (!result || !("notice" in result)) {
|
||||
options.url = `https://ghproxy.net/https://raw.githubusercontent.com/smallfawn/Note/refs/heads/main/Notice.json`;
|
||||
result = await httpRequest(options);
|
||||
}
|
||||
if (result && "notice" in result) {
|
||||
DoubleLog(`${result.notice}`);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async function hitokoto(timeout = 3 * 1000) {
|
||||
// 随机一言
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
let options = {
|
||||
url: "https://v1.hitokoto.cn/",
|
||||
headers: {},
|
||||
}; //, //result = await httpRequest(options);
|
||||
$.get(
|
||||
options,
|
||||
async (err, resp, data) => {
|
||||
try {
|
||||
data = JSON.parse(data);
|
||||
resolve(data.hitokoto);
|
||||
} catch (e) {
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
},
|
||||
timeout
|
||||
);
|
||||
//return result.hitokoto
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
// 双平台log输出
|
||||
function DoubleLog(data) {
|
||||
if ($.isNode()) {
|
||||
if (data) {
|
||||
console.log(`${data}`);
|
||||
msg += `\n${data}`;
|
||||
}
|
||||
} else {
|
||||
console.log(`${data}`);
|
||||
msg += `\n${data}`;
|
||||
}
|
||||
}
|
||||
// 发送消息
|
||||
async function SendMsg(message) {
|
||||
if (!message) return;
|
||||
if (Notify > 0) {
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify($.name, message);
|
||||
} else {
|
||||
$.msg($.name, "", message);
|
||||
}
|
||||
} else {
|
||||
console.log(message);
|
||||
}
|
||||
}
|
||||
|
||||
// 完整 Env
|
||||
function MD5_Encrypt(a) { function b(a, b) { return (a << b) | (a >>> (32 - b)); } function c(a, b) { var c, d, e, f, g; return ((e = 2147483648 & a), (f = 2147483648 & b), (c = 1073741824 & a), (d = 1073741824 & b), (g = (1073741823 & a) + (1073741823 & b)), c & d ? 2147483648 ^ g ^ e ^ f : c | d ? 1073741824 & g ? 3221225472 ^ g ^ e ^ f : 1073741824 ^ g ^ e ^ f : g ^ e ^ f); } function d(a, b, c) { return (a & b) | (~a & c); } function e(a, b, c) { return (a & c) | (b & ~c); } function f(a, b, c) { return a ^ b ^ c; } function g(a, b, c) { return b ^ (a | ~c); } function h(a, e, f, g, h, i, j) { return (a = c(a, c(c(d(e, f, g), h), j))), c(b(a, i), e); } function i(a, d, f, g, h, i, j) { return (a = c(a, c(c(e(d, f, g), h), j))), c(b(a, i), d); } function j(a, d, e, g, h, i, j) { return (a = c(a, c(c(f(d, e, g), h), j))), c(b(a, i), d); } function k(a, d, e, f, h, i, j) { return (a = c(a, c(c(g(d, e, f), h), j))), c(b(a, i), d); } function l(a) { for (var b, c = a.length, d = c + 8, e = (d - (d % 64)) / 64, f = 16 * (e + 1), g = new Array(f - 1), h = 0, i = 0; c > i;) (b = (i - (i % 4)) / 4), (h = (i % 4) * 8), (g[b] = g[b] | (a.charCodeAt(i) << h)), i++; return ((b = (i - (i % 4)) / 4), (h = (i % 4) * 8), (g[b] = g[b] | (128 << h)), (g[f - 2] = c << 3), (g[f - 1] = c >>> 29), g); } function m(a) { var b, c, d = "", e = ""; for (c = 0; 3 >= c; c++) (b = (a >>> (8 * c)) & 255), (e = "0" + b.toString(16)), (d += e.substr(e.length - 2, 2)); return d; } function n(a) { a = a.replace(/\r\n/g, "\n"); for (var b = "", c = 0; c < a.length; c++) { var d = a.charCodeAt(c); 128 > d ? (b += String.fromCharCode(d)) : d > 127 && 2048 > d ? ((b += String.fromCharCode((d >> 6) | 192)), (b += String.fromCharCode((63 & d) | 128))) : ((b += String.fromCharCode((d >> 12) | 224)), (b += String.fromCharCode(((d >> 6) & 63) | 128)), (b += String.fromCharCode((63 & d) | 128))); } return b; } var o, p, q, r, s, t, u, v, w, x = [], y = 7, z = 12, A = 17, B = 22, C = 5, D = 9, E = 14, F = 20, G = 4, H = 11, I = 16, J = 23, K = 6, L = 10, M = 15, N = 21; for (a = n(a), x = l(a), t = 1732584193, u = 4023233417, v = 2562383102, w = 271733878, o = 0; o < x.length; o += 16) (p = t), (q = u), (r = v), (s = w), (t = h(t, u, v, w, x[o + 0], y, 3614090360)), (w = h(w, t, u, v, x[o + 1], z, 3905402710)), (v = h(v, w, t, u, x[o + 2], A, 606105819)), (u = h(u, v, w, t, x[o + 3], B, 3250441966)), (t = h(t, u, v, w, x[o + 4], y, 4118548399)), (w = h(w, t, u, v, x[o + 5], z, 1200080426)), (v = h(v, w, t, u, x[o + 6], A, 2821735955)), (u = h(u, v, w, t, x[o + 7], B, 4249261313)), (t = h(t, u, v, w, x[o + 8], y, 1770035416)), (w = h(w, t, u, v, x[o + 9], z, 2336552879)), (v = h(v, w, t, u, x[o + 10], A, 4294925233)), (u = h(u, v, w, t, x[o + 11], B, 2304563134)), (t = h(t, u, v, w, x[o + 12], y, 1804603682)), (w = h(w, t, u, v, x[o + 13], z, 4254626195)), (v = h(v, w, t, u, x[o + 14], A, 2792965006)), (u = h(u, v, w, t, x[o + 15], B, 1236535329)), (t = i(t, u, v, w, x[o + 1], C, 4129170786)), (w = i(w, t, u, v, x[o + 6], D, 3225465664)), (v = i(v, w, t, u, x[o + 11], E, 643717713)), (u = i(u, v, w, t, x[o + 0], F, 3921069994)), (t = i(t, u, v, w, x[o + 5], C, 3593408605)), (w = i(w, t, u, v, x[o + 10], D, 38016083)), (v = i(v, w, t, u, x[o + 15], E, 3634488961)), (u = i(u, v, w, t, x[o + 4], F, 3889429448)), (t = i(t, u, v, w, x[o + 9], C, 568446438)), (w = i(w, t, u, v, x[o + 14], D, 3275163606)), (v = i(v, w, t, u, x[o + 3], E, 4107603335)), (u = i(u, v, w, t, x[o + 8], F, 1163531501)), (t = i(t, u, v, w, x[o + 13], C, 2850285829)), (w = i(w, t, u, v, x[o + 2], D, 4243563512)), (v = i(v, w, t, u, x[o + 7], E, 1735328473)), (u = i(u, v, w, t, x[o + 12], F, 2368359562)), (t = j(t, u, v, w, x[o + 5], G, 4294588738)), (w = j(w, t, u, v, x[o + 8], H, 2272392833)), (v = j(v, w, t, u, x[o + 11], I, 1839030562)), (u = j(u, v, w, t, x[o + 14], J, 4259657740)), (t = j(t, u, v, w, x[o + 1], G, 2763975236)), (w = j(w, t, u, v, x[o + 4], H, 1272893353)), (v = j(v, w, t, u, x[o + 7], I, 4139469664)), (u = j(u, v, w, t, x[o + 10], J, 3200236656)), (t = j(t, u, v, w, x[o + 13], G, 681279174)), (w = j(w, t, u, v, x[o + 0], H, 3936430074)), (v = j(v, w, t, u, x[o + 3], I, 3572445317)), (u = j(u, v, w, t, x[o + 6], J, 76029189)), (t = j(t, u, v, w, x[o + 9], G, 3654602809)), (w = j(w, t, u, v, x[o + 12], H, 3873151461)), (v = j(v, w, t, u, x[o + 15], I, 530742520)), (u = j(u, v, w, t, x[o + 2], J, 3299628645)), (t = k(t, u, v, w, x[o + 0], K, 4096336452)), (w = k(w, t, u, v, x[o + 7], L, 1126891415)), (v = k(v, w, t, u, x[o + 14], M, 2878612391)), (u = k(u, v, w, t, x[o + 5], N, 4237533241)), (t = k(t, u, v, w, x[o + 12], K, 1700485571)), (w = k(w, t, u, v, x[o + 3], L, 2399980690)), (v = k(v, w, t, u, x[o + 10], M, 4293915773)), (u = k(u, v, w, t, x[o + 1], N, 2240044497)), (t = k(t, u, v, w, x[o + 8], K, 1873313359)), (w = k(w, t, u, v, x[o + 15], L, 4264355552)), (v = k(v, w, t, u, x[o + 6], M, 2734768916)), (u = k(u, v, w, t, x[o + 13], N, 1309151649)), (t = kLine truncated
|
||||
function Env(t, e) { class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, a) => { s.call(this, t, (t, s, r) => { t ? a(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.encoding = "utf-8", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`) } getEnv() { return "undefined" != typeof $environment && $environment["surge-version"] ? "Surge" : "undefined" != typeof $environment && $environment["stash-version"] ? "Stash" : "undefined" != typeof module && module.exports ? "Node.js" : "undefined" != typeof $task ? "Quantumult X" : "undefined" != typeof $loon ? "Loon" : "undefined" != typeof $rocket ? "Shadowrocket" : void 0 } isNode() { return "Node.js" === this.getEnv() } isQuanX() { return "Quantumult X" === this.getEnv() } isSurge() { return "Surge" === this.getEnv() } isLoon() { return "Loon" === this.getEnv() } isShadowrocket() { return "Shadowrocket" === this.getEnv() } isStash() { return "Stash" === this.getEnv() } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const a = this.getdata(t); if (a) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, a) => e(a)) }) } runScript(t, e) { return new Promise(s => { let a = this.getdata("@chavy_boxjs_userCfgs.httpapi"); a = a ? a.replace(/\n/g, "").trim() : a; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [i, o] = a.split("@"), n = { url: `http://${o}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": i, Accept: "*/*" }, timeout: r }; this.post(n, (t, e, a) => s(a)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), a = !s && this.fs.existsSync(e); if (!s && !a) return {}; { const a = s ? t : e; try { return JSON.parse(this.fs.readFileSync(a)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), a = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : a ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const a = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of a) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, a) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[a + 1]) >> 0 == +e[a + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, a] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, a, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, a, r] = /^@(.*?)\.(.*?)$/.exec(e), i = this.getval(a), o = a ? "null" === i ? null : i || "{}" : "{}"; try { const e = JSON.parse(o); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), a) } catch (e) { const i = {}; this.lodash_set(i, r, t), s = this.setval(JSON.stringify(i), a) } } else s = this.setval(t, e); return s } getval(t) { switch (this.getEnv()) { case "Surge": case "Loon": case "Stash": case "Shadowrocket": return $persistentStore.read(t); case "Quantumult X": return $prefs.valueForKey(t); case "Node.js": return this.data = this.loaddata(), this.data[t]; default: return this.data && this.data[t] || null } } setval(t, e) { switch (this.getEnv()) { case "Surge": case "Loon": case "Stash": case "Shadowrocket": return $persistentStore.write(t, e); case "Quantumult X": return $prefs.setValueForKey(t, e); case "Node.js": return this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0; default: return this.data && this.data[e] || null } } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = tLine truncated
|
||||
File renamed without changes.
-332
@@ -1,332 +0,0 @@
|
||||
/*
|
||||
------------------------------------------
|
||||
@Author: sm
|
||||
@Date: 2024.06.07 19:15
|
||||
@Description: 测试
|
||||
------------------------------------------
|
||||
#Notice:
|
||||
安慕希小程序 变量名anmuxi
|
||||
抓wx-amxshop.msxapi.digitalyili.com/api headers中accessToken值 多账户&分隔
|
||||
⚠️【免责声明】
|
||||
------------------------------------------
|
||||
1、此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。
|
||||
2、由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。
|
||||
3、请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。
|
||||
4、此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。
|
||||
5、本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。
|
||||
6、如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。
|
||||
7、所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此脚本,即视为您已接受此免责声明。
|
||||
*/
|
||||
|
||||
const $ = new Env("安慕希小程序");
|
||||
let ckName = `anmuxi`;
|
||||
const strSplitor = "#";
|
||||
const envSplitor = ["&", "\n"];
|
||||
const notify = $.isNode() ? require("../sendNotify") : "";
|
||||
const axios = require("axios");
|
||||
const defaultUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.31(0x18001e31) NetType/WIFI Language/zh_CN miniProgram"
|
||||
|
||||
class Public {
|
||||
request(options) {
|
||||
return axios.request(options);
|
||||
}
|
||||
}
|
||||
class Task extends Public {
|
||||
constructor(env) {
|
||||
|
||||
super();
|
||||
this.index = $.userIdx++
|
||||
let user = env.split("#");
|
||||
this.token = user[0];
|
||||
this.signed = true
|
||||
|
||||
}
|
||||
|
||||
async daily_sign() {
|
||||
let options = {
|
||||
method: "GET",
|
||||
|
||||
url: `https://wx-amxshop.msxapi.digitalyili.com/api/user/daily/sign?exParams=false`,
|
||||
headers: {
|
||||
"accept": "*/*",
|
||||
"accept-language": "zh-CN,zh;q=0.9",
|
||||
"accesstoken": "" + this.token,
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
"scene": "1256",
|
||||
"sec-fetch-dest": "empty",
|
||||
"sec-fetch-mode": "cors",
|
||||
"sec-fetch-site": "cross-site",
|
||||
"xweb_xhr": "1"
|
||||
}
|
||||
}
|
||||
try {
|
||||
let { data: res } = await this.request(options);
|
||||
if (res.code == 200) {
|
||||
$.log(`签到成功 获得【${res.data.dailySign.bonusPoints}】分`)
|
||||
} else {
|
||||
$.log(`签到失败`)
|
||||
console.log(res);
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(`签到失败`)
|
||||
}
|
||||
}
|
||||
async daily_sign_status() {
|
||||
let options = {
|
||||
method: "GET",
|
||||
|
||||
url: `https://wx-amxshop.msxapi.digitalyili.com/api/user/sign/status`,
|
||||
headers: {
|
||||
"accept": "*/*",
|
||||
"accept-language": "zh-CN,zh;q=0.9",
|
||||
"accesstoken": "" + this.token,
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
"scene": "1256",
|
||||
"sec-fetch-dest": "empty",
|
||||
"sec-fetch-mode": "cors",
|
||||
"sec-fetch-site": "cross-site",
|
||||
"xweb_xhr": "1"
|
||||
}
|
||||
}
|
||||
try {
|
||||
let { data: res } = await this.request(options);
|
||||
if (res.code == 200) {
|
||||
if (res.data.signed == false) {
|
||||
this.signed = false
|
||||
$.log(`已签到 【${res.data.signDays}】天 检测到今日未签到`)
|
||||
} else {
|
||||
$.log(`已签到 【${res.data.signDays}】天 检测到今日已签到`)
|
||||
this.signed = true
|
||||
}
|
||||
|
||||
} else {
|
||||
$.log(`获取签到状态失败`)
|
||||
console.log(res);
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(`签到失败`)
|
||||
}
|
||||
}
|
||||
async user_score() {
|
||||
let options = {
|
||||
method: "GET",
|
||||
|
||||
url: `https://wx-amxshop.msxapi.digitalyili.com/api/user/score`,
|
||||
headers: {
|
||||
"accept": "*/*",
|
||||
"accept-language": "zh-CN,zh;q=0.9",
|
||||
"accesstoken": "" + this.token,
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
"scene": "1256",
|
||||
"sec-fetch-dest": "empty",
|
||||
"sec-fetch-mode": "cors",
|
||||
"sec-fetch-site": "cross-site",
|
||||
"xweb_xhr": "1"
|
||||
}
|
||||
}
|
||||
try {
|
||||
let { data: res } = await this.request(options);
|
||||
if (res.code == 200) {
|
||||
$.log(`当前积分【${res.data}】天`)
|
||||
} else {
|
||||
$.log(`获取积分失败`)
|
||||
console.log(res);
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(`签到失败`)
|
||||
}
|
||||
}
|
||||
|
||||
async run() {
|
||||
await this.user_score();
|
||||
|
||||
await this.daily_sign_status();
|
||||
if (this.signed == false) {
|
||||
await this.daily_sign();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
!(async () => {
|
||||
await getNotice()
|
||||
$.checkEnv(ckName);
|
||||
|
||||
for (let user of $.userList) {
|
||||
//
|
||||
|
||||
await new Task(user).run();
|
||||
|
||||
}
|
||||
|
||||
|
||||
})()
|
||||
.catch((e) => console.log(e))
|
||||
.finally(() => $.done());
|
||||
|
||||
async function getNotice() {
|
||||
let options = {
|
||||
url: `https://ghproxy.net/https://raw.githubusercontent.com/smallfawn/Note/refs/heads/main/Notice.json`,
|
||||
headers: {
|
||||
"User-Agent": defaultUserAgent,
|
||||
}
|
||||
}
|
||||
let { data: res } = await new Public().request(options);
|
||||
$.log(res)
|
||||
return res
|
||||
}
|
||||
|
||||
|
||||
// prettier-ignore
|
||||
function Env(t, s) {
|
||||
return new (class {
|
||||
constructor(t, s) {
|
||||
this.userIdx = 1;
|
||||
this.userList = [];
|
||||
this.userCount = 0;
|
||||
this.name = t;
|
||||
this.notifyStr = [];
|
||||
this.logSeparator = "\n";
|
||||
this.startTime = new Date().getTime();
|
||||
Object.assign(this, s);
|
||||
this.log(`\ud83d\udd14${this.name},\u5f00\u59cb!`);
|
||||
}
|
||||
checkEnv(ckName) {
|
||||
let userCookie = (this.isNode() ? process.env[ckName] : "") || "";
|
||||
this.userList = userCookie.split(envSplitor.find((o) => userCookie.includes(o)) || "&").filter((n) => n);
|
||||
this.userCount = this.userList.length;
|
||||
this.log(`共找到${this.userCount}个账号`);
|
||||
}
|
||||
async sendMsg() {
|
||||
this.log("==============📣Center 通知📣==============")
|
||||
for (let i = 0; i < this.notifyStr.length; i++) {
|
||||
if (Object.prototype.toString.call(this.notifyStr[i]) === '[object Object]' ||
|
||||
Object.prototype.toString.call(this.notifyStr[i]) === '[object Array]') {
|
||||
this.notifyStr[i] = JSON.stringify(this.notifyStr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
let message = this.notifyStr.join(this.logSeparator);
|
||||
if (this.isNode()) {
|
||||
await notify.sendNotify(this.name, message);
|
||||
} else {
|
||||
}
|
||||
}
|
||||
isNode() {
|
||||
return "undefined" != typeof module && !!module.exports;
|
||||
}
|
||||
|
||||
queryStr(options) {
|
||||
return Object.entries(options)
|
||||
.map(
|
||||
([key, value]) =>
|
||||
`${key}=${typeof value === "object" ? JSON.stringify(value) : value
|
||||
}`
|
||||
)
|
||||
.join("&");
|
||||
}
|
||||
getURLParams(url) {
|
||||
const params = {};
|
||||
const queryString = url.split("?")[1];
|
||||
if (queryString) {
|
||||
const paramPairs = queryString.split("&");
|
||||
paramPairs.forEach((pair) => {
|
||||
const [key, value] = pair.split("=");
|
||||
params[key] = value;
|
||||
});
|
||||
}
|
||||
return params;
|
||||
}
|
||||
isJSONString(str) {
|
||||
try {
|
||||
return JSON.parse(str) && typeof JSON.parse(str) === "object";
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
isJson(obj) {
|
||||
var isjson =
|
||||
typeof obj == "object" &&
|
||||
Object.prototype.toString.call(obj).toLowerCase() ==
|
||||
"[object object]" &&
|
||||
!obj.length;
|
||||
return isjson;
|
||||
}
|
||||
|
||||
randomNumber(length) {
|
||||
const characters = "0123456789";
|
||||
return Array.from(
|
||||
{ length },
|
||||
() => characters[Math.floor(Math.random() * characters.length)]
|
||||
).join("");
|
||||
}
|
||||
randomString(length) {
|
||||
const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
return Array.from(
|
||||
{ length },
|
||||
() => characters[Math.floor(Math.random() * characters.length)]
|
||||
).join("");
|
||||
}
|
||||
uuid() {
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
||||
/[xy]/g,
|
||||
function (c) {
|
||||
var r = (Math.random() * 16) | 0,
|
||||
v = c == "x" ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
}
|
||||
);
|
||||
}
|
||||
time(t) {
|
||||
let s = {
|
||||
"M+": new Date().getMonth() + 1,
|
||||
"d+": new Date().getDate(),
|
||||
"H+": new Date().getHours(),
|
||||
"m+": new Date().getMinutes(),
|
||||
"s+": new Date().getSeconds(),
|
||||
"q+": Math.floor((new Date().getMonth() + 3) / 3),
|
||||
S: new Date().getMilliseconds(),
|
||||
};
|
||||
/(y+)/.test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
(new Date().getFullYear() + "").substr(4 - RegExp.$1.length)
|
||||
));
|
||||
for (let e in s) {
|
||||
new RegExp("(" + e + ")").test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
1 == RegExp.$1.length
|
||||
? s[e]
|
||||
: ("00" + s[e]).substr(("" + s[e]).length)
|
||||
));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
log(content) {
|
||||
this.notifyStr.push(content)
|
||||
console.log(content)
|
||||
}
|
||||
wait(t) {
|
||||
return new Promise((s) => setTimeout(s, t));
|
||||
}
|
||||
async done(t = {}) {
|
||||
await this.sendMsg();
|
||||
const s = new Date().getTime(),
|
||||
e = (s - this.startTime) / 1e3;
|
||||
this.log(
|
||||
`\ud83d\udd14${this.name},\u7ed3\u675f!\ud83d\udd5b ${e}\u79d2`
|
||||
);
|
||||
if (this.isNode()) {
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
})(t, s);
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
-334
@@ -1,334 +0,0 @@
|
||||
/*
|
||||
------------------------------------------
|
||||
@Author: sm
|
||||
@Date: 2024.06.07 19:15
|
||||
@Description: 微信小程序泡泡玛特
|
||||
------------------------------------------
|
||||
抓user_id和openid和 分别在请求头和请求参数里面 用#连接 多账号&或换行 分开 或新建同名变量
|
||||
https://popvip.paquapp.com/miniapp/v2/wechat/getUserInfo/
|
||||
[Script]
|
||||
http-response
|
||||
|
||||
[MITM]
|
||||
hostname =
|
||||
|
||||
⚠️【免责声明】
|
||||
------------------------------------------
|
||||
1、此脚本仅用于学习研究,不保证其合法性、准确性、有效性,请根据情况自行判断,本人对此不承担任何保证责任。
|
||||
2、由于此脚本仅用于学习研究,您必须在下载后 24 小时内将所有内容从您的计算机或手机或任何存储设备中完全删除,若违反规定引起任何事件本人对此均不负责。
|
||||
3、请勿将此脚本用于任何商业或非法目的,若违反规定请自行对此负责。
|
||||
4、此脚本涉及应用与本人无关,本人对因此引起的任何隐私泄漏或其他后果不承担任何责任。
|
||||
5、本人对任何脚本引发的问题概不负责,包括但不限于由脚本错误引起的任何损失和损害。
|
||||
6、如果任何单位或个人认为此脚本可能涉嫌侵犯其权利,应及时通知并提供身份证明,所有权证明,我们将在收到认证文件确认后删除此脚本。
|
||||
7、所有直接或间接使用、查看此脚本的人均应该仔细阅读此声明。本人保留随时更改或补充此声明的权利。一旦您使用或复制了此脚本,即视为您已接受此免责声明。
|
||||
*/
|
||||
|
||||
const $ = new Env("微信小程序泡泡玛特");
|
||||
let ckName = `paopaomate`
|
||||
let userCookie = checkEnv($.isNode() ? process.env[ckName] : "");
|
||||
const notify = $.isNode() ? require("../sendNotify") : "";
|
||||
|
||||
|
||||
|
||||
!(async () => {
|
||||
console.log(
|
||||
`==================================================\n 脚本执行 - 北京时间(UTC+8): ${new Date(
|
||||
new Date().getTime() +
|
||||
new Date().getTimezoneOffset() * 60 * 1000 +
|
||||
8 * 60 * 60 * 1000
|
||||
).toLocaleString()} \n==================================================`
|
||||
);
|
||||
//console.log(userCookie)
|
||||
if (!userCookie?.length) return console.log(`没有找到CK哦`)
|
||||
let index = 0;
|
||||
let strSplitor = "#";
|
||||
|
||||
for (let user of userCookie) {
|
||||
$.log(`\n🚀 user:【${index || ++index}】 start work\n`)
|
||||
$.id = user.split(strSplitor)[0]
|
||||
$.openid = user.split(strSplitor)[1]
|
||||
$.ckStatus = false
|
||||
await UserInfo($.id, $.openid)
|
||||
if ($.ckStatus) {
|
||||
await SignIn($.openid)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
await $.sendMsg($.logs.join("\n"));
|
||||
})().catch((e) => console.log(e)).finally(() => $.done());
|
||||
function base64Encode(data) {
|
||||
const buffer = Buffer.from(data);
|
||||
return buffer.toString('base64');
|
||||
}
|
||||
function getSign(t, e, n) {
|
||||
function md5(data) {
|
||||
const crypto = require('crypto');
|
||||
return crypto.createHash('md5').update(data).digest('hex');
|
||||
}
|
||||
function d(t, e, n) {
|
||||
var o = {};
|
||||
Object.keys(t).sort().forEach((function (n) {
|
||||
o[n] = "POST" === e ? t[n] : t[n].toString()
|
||||
}
|
||||
)),
|
||||
o.version = "5.0.34";
|
||||
var s = (new Date).getTime().toString()
|
||||
, c = JSON.stringify(o) + "PopMartminiApp1117" + s
|
||||
, u = md5(c);
|
||||
return t.sign = n ? md5(base64Encode(u + "PopMartminiApp0314")) : u,
|
||||
t.time = s,
|
||||
t.version = "5.0.34",
|
||||
t
|
||||
}
|
||||
|
||||
return d(t, e, n)
|
||||
}
|
||||
async function SignIn() {
|
||||
let { sign: sign, time: time, version: version } = getSign({
|
||||
openid: $.openid
|
||||
}, 'GET', false)
|
||||
let { data: result } = await Request({
|
||||
method: 'GET',
|
||||
url: 'https://popvip.paquapp.com/miniapp/v2/sign_in/everySignDay/?openid=' + $.openid + '&sign=' + sign + '&time=' + time + '&version=' + version,
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/122.0.6261.120 Mobile Safari/537.36 XWEB/1220067 MMWEBSDK/20240404 MMWEBID/8150 MicroMessenger/8.0.49.2600(0x28003156) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android',
|
||||
'Accept-Encoding': 'gzip,compress,br,deflate',
|
||||
'identity_code': $.openid,
|
||||
'charset': 'utf-8',
|
||||
'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
|
||||
'Referer': 'https://servicewechat.com/wx9627eb7f4b1c69d5/638/page-frame.html'
|
||||
}
|
||||
})
|
||||
result?.code == 1 ? $.log(`签到状态:${result.data.sign}`) : ""
|
||||
}
|
||||
async function UserInfo() {
|
||||
let { sign: sign, time: time, version: version } = getSign({
|
||||
user_id: $.id
|
||||
}, 'GET', false)
|
||||
let { data: result } = await Request({
|
||||
method: 'GET',
|
||||
url: 'https://popvip.paquapp.com/miniapp/v2/wechat/getUserInfo/?user_id=' + $.id + '&sign=' + sign + '&time=' + time + '&version=' + version,
|
||||
headers: {
|
||||
'User-Agent': 'Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/122.0.6261.120 Mobile Safari/537.36 XWEB/1220067 MMWEBSDK/20240404 MMWEBID/8150 MicroMessenger/8.0.49.2600(0x28003156) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android',
|
||||
'Accept-Encoding': 'gzip,compress,br,deflate',
|
||||
'identity_code': $.openid,
|
||||
'charset': 'utf-8',
|
||||
'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
|
||||
'Referer': 'https://servicewechat.com/wx9627eb7f4b1c69d5/638/page-frame.html'
|
||||
}
|
||||
})
|
||||
result?.code == 1 ? ($.log(`${result.data.nickname} 积分【${result.data.points}】`), $.ckStatus = true) : $.ckStatus = false
|
||||
}
|
||||
|
||||
function checkEnv(userCookie) {
|
||||
const envSplitor = ["&", "\n"];
|
||||
let userList = userCookie.split(envSplitor.find(o => userCookie.includes(o)) || "&").filter(n => n);
|
||||
console.log(`共找到${userList.length}个账号`);
|
||||
return userList;
|
||||
}
|
||||
//Env Api =============================
|
||||
/*
|
||||
* @modifyAuthor @smallfawn
|
||||
* @modifyTime 2024-05-01
|
||||
* @modifyInfo 抽离操作文件的函数
|
||||
*/
|
||||
function Env(t, s) {
|
||||
return new (class {
|
||||
constructor(t, s) {
|
||||
this.name = t;
|
||||
this.logs = [];
|
||||
this.logSeparator = "\n";
|
||||
this.startTime = new Date().getTime();
|
||||
Object.assign(this, s);
|
||||
this.log("", `\ud83d\udd14${this.name},\u5f00\u59cb!`);
|
||||
}
|
||||
isNode() {
|
||||
return "undefined" != typeof module && !!module.exports;
|
||||
}
|
||||
isQuanX() {
|
||||
return "undefined" != typeof $task;
|
||||
}
|
||||
|
||||
queryStr(options) {
|
||||
return Object.entries(options)
|
||||
.map(
|
||||
([key, value]) =>
|
||||
`${key}=${typeof value === "object" ? JSON.stringify(value) : value
|
||||
}`
|
||||
)
|
||||
.join("&");
|
||||
}
|
||||
getURLParams(url) {
|
||||
const params = {};
|
||||
const queryString = url.split("?")[1];
|
||||
if (queryString) {
|
||||
const paramPairs = queryString.split("&");
|
||||
paramPairs.forEach((pair) => {
|
||||
const [key, value] = pair.split("=");
|
||||
params[key] = value;
|
||||
});
|
||||
}
|
||||
return params;
|
||||
}
|
||||
isJSONString(str) {
|
||||
try {
|
||||
return JSON.parse(str) && typeof JSON.parse(str) === "object";
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
isJson(obj) {
|
||||
var isjson =
|
||||
typeof obj == "object" &&
|
||||
Object.prototype.toString.call(obj).toLowerCase() ==
|
||||
"[object object]" &&
|
||||
!obj.length;
|
||||
return isjson;
|
||||
}
|
||||
async sendMsg(message) {
|
||||
if (!message) return;
|
||||
if (this.isNode()) {
|
||||
await notify.sendNotify(this.name, message);
|
||||
} else {
|
||||
this.msg(this.name, "", message);
|
||||
}
|
||||
}
|
||||
randomNumber(length) {
|
||||
const characters = "0123456789";
|
||||
return Array.from(
|
||||
{ length },
|
||||
() => characters[Math.floor(Math.random() * characters.length)]
|
||||
).join("");
|
||||
}
|
||||
randomString(length) {
|
||||
const characters = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
return Array.from(
|
||||
{ length },
|
||||
() => characters[Math.floor(Math.random() * characters.length)]
|
||||
).join("");
|
||||
}
|
||||
uuid() {
|
||||
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(
|
||||
/[xy]/g,
|
||||
function (c) {
|
||||
var r = (Math.random() * 16) | 0,
|
||||
v = c == "x" ? r : (r & 0x3) | 0x8;
|
||||
return v.toString(16);
|
||||
}
|
||||
);
|
||||
}
|
||||
time(t) {
|
||||
let s = {
|
||||
"M+": new Date().getMonth() + 1,
|
||||
"d+": new Date().getDate(),
|
||||
"H+": new Date().getHours(),
|
||||
"m+": new Date().getMinutes(),
|
||||
"s+": new Date().getSeconds(),
|
||||
"q+": Math.floor((new Date().getMonth() + 3) / 3),
|
||||
S: new Date().getMilliseconds(),
|
||||
};
|
||||
/(y+)/.test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
(new Date().getFullYear() + "").substr(4 - RegExp.$1.length)
|
||||
));
|
||||
for (let e in s) {
|
||||
new RegExp("(" + e + ")").test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
1 == RegExp.$1.length
|
||||
? s[e]
|
||||
: ("00" + s[e]).substr(("" + s[e]).length)
|
||||
));
|
||||
}
|
||||
return t;
|
||||
}
|
||||
msg(title = t, subtitle = "", body = "", options) {
|
||||
const formatOptions = (options) => {
|
||||
if (!options) {
|
||||
return options;
|
||||
} else if (typeof options === "string") {
|
||||
if (this.isQuanX()) {
|
||||
return { "open-url": options };
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
} else if (
|
||||
typeof options === "object" &&
|
||||
(options["open-url"] || options["media-url"])
|
||||
) {
|
||||
if (this.isQuanX()) {
|
||||
return options;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
if (!this.isMute) {
|
||||
if (this.isQuanX()) {
|
||||
$notify(title, subtitle, body, formatOptions(options));
|
||||
}
|
||||
}
|
||||
let logs = ["", "==============📣系统通知📣=============="];
|
||||
logs.push(title);
|
||||
subtitle ? logs.push(subtitle) : "";
|
||||
body ? logs.push(body) : "";
|
||||
console.log(logs.join("\n"));
|
||||
this.logs = this.logs.concat(logs);
|
||||
}
|
||||
log(...t) {
|
||||
t.length > 0 && (this.logs = [...this.logs, ...t]),
|
||||
console.log(t.join(this.logSeparator));
|
||||
}
|
||||
logErr(t, s) {
|
||||
const e = !this.isQuanX();
|
||||
e
|
||||
? this.log("", `\u2757\ufe0f${this.name},\u9519\u8bef!`, t.stack)
|
||||
: this.log("", `\u2757\ufe0f${this.name},\u9519\u8bef!`, t);
|
||||
}
|
||||
wait(t) {
|
||||
return new Promise((s) => setTimeout(s, t));
|
||||
}
|
||||
done(t = {}) {
|
||||
const s = new Date().getTime(),
|
||||
e = (s - this.startTime) / 1e3;
|
||||
this.log(
|
||||
"",
|
||||
`\ud83d\udd14${this.name},\u7ed3\u675f!\ud83d\udd5b ${e}\u79d2`
|
||||
);
|
||||
this.log();
|
||||
if (this.isNode()) {
|
||||
process.exit(1);
|
||||
}
|
||||
if (this.isQuanX()) {
|
||||
$done(t);
|
||||
}
|
||||
}
|
||||
})(t, s);
|
||||
}
|
||||
|
||||
async function Request(options) {
|
||||
if ($.isNode()) {
|
||||
const axios = require("axios");
|
||||
Request = async (options) => {
|
||||
try {
|
||||
return axios.request(options);
|
||||
} catch (error) {
|
||||
throw error && error.error ? error.error : "请求失败";
|
||||
}
|
||||
};
|
||||
}
|
||||
if ($.isQuanX()) {
|
||||
Request = async (options) => {
|
||||
try {
|
||||
return await $task.fetch(options);
|
||||
} catch (error) {
|
||||
throw error && error.error ? error.error : "请求失败";
|
||||
}
|
||||
};
|
||||
}
|
||||
return await Request(options)
|
||||
}
|
||||
File renamed without changes.
@@ -1,109 +0,0 @@
|
||||
|
||||
'''
|
||||
topspace微信小程序
|
||||
|
||||
|
||||
new Env('topspace');
|
||||
抓x-vcs-user-token和app-id用&分割并且多号@
|
||||
'''
|
||||
import requests
|
||||
import os
|
||||
|
||||
class AC:
|
||||
def __init__(self, cookie):
|
||||
self.headers = {
|
||||
'User-Agent': "Mozilla/5.0 (Linux; Android 12; RMX3562 Build/SP1A.210812.016; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/122.0.6261.120 Mobile Safari/537.36 XWEB/1220133 MMWEBSDK/20240404 MMWEBID/2307 MicroMessenger/8.0.49.2600(0x28003133) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
|
||||
'app-id': cookie.split('&')[1],
|
||||
'x-vcs-user-token': cookie.split('&')[0]
|
||||
}
|
||||
|
||||
def info(self):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/user-info-api/api/v1/sda-app/personal-info/basic-information"
|
||||
response = requests.get(url, headers=self.headers)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
userNickname = data["data"]["userNickname"]
|
||||
totalPoints = data["data"]["pointInfo"]["totalPoints"]
|
||||
print(f"用户:{userNickname}当前共有{totalPoints}币")
|
||||
return userNickname
|
||||
else:
|
||||
msg = data["msg"]
|
||||
print(f"登录失败: {msg}")
|
||||
return None
|
||||
|
||||
def check(self, userNickname):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/user-info-api/api/v2/point/check-in"
|
||||
response = requests.post(url, headers=self.headers)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
description = data["data"]["description"]
|
||||
total = data["data"]["total"]
|
||||
print(f"用户:{userNickname}{description}获得{total}TOP币")
|
||||
else:
|
||||
msg = data["msg"]
|
||||
print(f"签到失败: {msg}")
|
||||
|
||||
def list_articles(self, userNickname):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/sda-zone-api/api/v1/post/list"
|
||||
data = {
|
||||
"section_id": "1002",
|
||||
"page": {
|
||||
"current_page": 1,
|
||||
"page_size": 20
|
||||
},
|
||||
"sort_type": "RECOMMEND_FIRST"
|
||||
}
|
||||
response = requests.post(url, headers=self.headers, json=data)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
article_id = data["data"]["list"][0]["id"]
|
||||
print(f"用户:{userNickname}获取文章{article_id}")
|
||||
return article_id
|
||||
else:
|
||||
msg = data["msg"]
|
||||
print(f"获取文章失败: {msg}")
|
||||
|
||||
def publish_comment(self, userNickname, article_id):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/sda-zone-api/api/v1/comment/publish"
|
||||
data = {
|
||||
"content": "很酷",
|
||||
"post_id": article_id
|
||||
}
|
||||
response = requests.post(url, headers=self.headers, json=data)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
print("发布成功")
|
||||
else:
|
||||
print(f"发布失败: {data['msg']}")
|
||||
|
||||
def share_article(self, userNickname, article_id):
|
||||
url = "https://m.sda.changan.com.cn/app-apigw/sda-zone-api/api/v1/action/share"
|
||||
data = {
|
||||
"post_id": article_id
|
||||
}
|
||||
response = requests.post(url, headers=self.headers, json=data)
|
||||
data = response.json()
|
||||
if data['code'] == 0:
|
||||
print("转发成功")
|
||||
else:
|
||||
print(f"转发失败: {data['msg']}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
topspace = os.environ.get('topspace')
|
||||
if not topspace:
|
||||
print("请设置环境变量 'topspace' 后再运行")
|
||||
else:
|
||||
topspace_list = topspace.split('@')
|
||||
for num, topspace_item in enumerate(topspace_list, start=1):
|
||||
x_vcs_user_token, app_id = topspace_item.split('&')
|
||||
cookie = f"{x_vcs_user_token}&{app_id}"
|
||||
ac = AC(cookie)
|
||||
print(f"=====开始执行第{num}个账号任务=====")
|
||||
user_nickname = ac.info()
|
||||
if user_nickname:
|
||||
ac.check(user_nickname)
|
||||
article_id = ac.list_articles(user_nickname)
|
||||
if article_id:
|
||||
ac.publish_comment(user_nickname, article_id)
|
||||
ac.share_article(user_nickname, article_id)
|
||||
print("---------账号任务执行完毕---------")
|
||||
File renamed without changes.
@@ -1,260 +0,0 @@
|
||||
/**
|
||||
* 高济健康pro小程序签到
|
||||
* cron 7 5 * * * wx_gjjkpro.js
|
||||
* 活动入口 首页 智慧小屋
|
||||
* ========= 青龙--配置文件 ===========
|
||||
* # 项目名称
|
||||
* export wx_gjjkpro_data='userId&authorization'
|
||||
*
|
||||
* 多账号用 换行 或 @ 分割
|
||||
* 抓包 https://api.gaojihealth.cn/fund/api/ , 找到userId&authorization即可
|
||||
* ====================================
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
const $ = new Env("高济健康pro小程序签到");
|
||||
const ckName = "wx_gjjkpro_data";
|
||||
//-------------------- 一般不动变量区域 -------------------------------------
|
||||
const Notify = 1; //0为关闭通知,1为打开通知,默认为1
|
||||
const notify = $.isNode() ? require('../sendNotify') : '';
|
||||
let debug = 1; //Debug调试 0关闭 1开启
|
||||
let envSplitor = ["@"]; //多账号分隔符
|
||||
let ck = msg = ''; //let ck,msg
|
||||
let host, hostname;
|
||||
let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || '';
|
||||
let userList = [];
|
||||
let userIdx = 0;
|
||||
let userCount = 0;
|
||||
//---------------------- 自定义变量区域 -----------------------------------
|
||||
//---------------------------------------------------------
|
||||
|
||||
async function start() {
|
||||
|
||||
console.log('\n================== 用户CK ==================\n');
|
||||
taskall = [];
|
||||
for (let user of userList) {
|
||||
taskall.push(await user.user_info());
|
||||
await $.wait(3000); //延迟 1秒 可充分利用 $.环境函数
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
console.log('\n================== 签到 ==================\n');
|
||||
taskall = [];
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
taskall.push(await user.task_signin());
|
||||
await $.wait(3000); //延迟 1秒 可充分利用 $.环境函数
|
||||
}
|
||||
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
console.log('\n================== 任务 ==================\n');
|
||||
taskall = [];
|
||||
let tasktmp;
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
for(let tasknum in user.taskList){
|
||||
tasktmp = user.taskList[tasknum]
|
||||
taskall.push(await user.task_do(tasktmp));
|
||||
await $.wait(3000); //延迟 1秒 可充分利用 $.环境函数
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
class UserInfo {
|
||||
constructor(str) {
|
||||
this.index = ++userIdx;
|
||||
this.userId = str.split('&')[0]; //单账号多变量分隔符
|
||||
this.ck = str.split('&')[1];
|
||||
this.ck = this.ck.replace('bearer', 'bearer ')
|
||||
//let ck = str.split('&')
|
||||
//this.data1 = ck[0]
|
||||
this.ckStatus = true
|
||||
this.headersPost = {
|
||||
'Host': 'api.gaojihealth.cn',
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
'authorization': this.ck,
|
||||
}
|
||||
this.headersGet = {
|
||||
'Host': 'api.gaojihealth.cn',
|
||||
'authorization': this.ck,
|
||||
}
|
||||
this.taskList = [{ "browsePageId": "100004", "browsePageUrl": "/modules/integral/integral-mall/index", "taskId": 729 }, { "browsePageId": "100015", "browsePageUrl": "/modules/storeEmployeeQRcode/index?pageType=1", "taskId": 730 }]
|
||||
|
||||
}
|
||||
|
||||
async user_info() {//userinfo
|
||||
try {
|
||||
let options = {
|
||||
url: `https://api.gaojihealth.cn/fund/api/noauth/appCoupon/findDkSignActivityPage?businessId=212798&userId=${this.userId}&version=1.4`,
|
||||
headers: this.headersGet,
|
||||
}
|
||||
//console.log(options);
|
||||
let result = await httpRequest(options);
|
||||
//console.log(result);
|
||||
if (result.runFlag == true) {
|
||||
DoubleLog(`账号[${this.index}] ck验证成功: G金[${result.integralResponse.currentFund}] `);
|
||||
this.ckStatus = true
|
||||
} else {
|
||||
DoubleLog(`账号[${this.index}] ck验证失效,原因未知!`);
|
||||
this.ckStatus = false
|
||||
console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async task_signin() {//userinfo
|
||||
try {
|
||||
let options = {
|
||||
url: `https://api.gaojihealth.cn/gulosity/api/dkUserEvent/everyDaySign`,
|
||||
headers: this.headersPost,
|
||||
body: JSON.stringify({ "businessId": 212798, "userId": this.userId, "taskId": 372 })
|
||||
}
|
||||
this.headersPost['Content-Length'] = options.body.length
|
||||
|
||||
//console.log(options);
|
||||
let result = await httpRequest(options);
|
||||
//console.log(result);
|
||||
if (result.opCode == 200) {
|
||||
DoubleLog(`账号[${this.index}] 签到成功: [${result.prizeInfo}] `);
|
||||
} else {
|
||||
DoubleLog(`账号[${this.index}] 签到失效,原因未知!`);
|
||||
console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async task_do(tasktmp) {//DO
|
||||
|
||||
try {
|
||||
let options = {
|
||||
url: `https://api.gaojihealth.cn/gulosity/api/dkUserEvent/browsePageCompleteTaskEvent`,
|
||||
headers: this.headersPost,
|
||||
body: JSON.stringify(tasktmp)
|
||||
}
|
||||
this.headersPost['Content-Length'] = options.body.length
|
||||
|
||||
//console.log(options);
|
||||
|
||||
let result = await httpRequest(options)
|
||||
if (result == 'true') {
|
||||
DoubleLog(`账号[${this.index}] 执行任务成功: [${tasktmp.taskId}] `);
|
||||
} else {
|
||||
DoubleLog(`账号[${this.index}] 执行任务失效,原因未知!`);
|
||||
console.log(result);
|
||||
}
|
||||
//console.log(result);
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
!(async () => {
|
||||
if (!(await checkEnv())) return;
|
||||
if (userList.length > 0) {
|
||||
await start();
|
||||
}
|
||||
await SendMsg(msg);
|
||||
})()
|
||||
.catch((e) => console.log(e))
|
||||
.finally(() => $.done());
|
||||
|
||||
|
||||
//********************************************************
|
||||
// 变量检查与处理
|
||||
async function checkEnv() {
|
||||
if (userCookie) {
|
||||
// console.log(userCookie);
|
||||
let e = envSplitor[0];
|
||||
for (let o of envSplitor)
|
||||
if (userCookie.indexOf(o) > -1) {
|
||||
e = o;
|
||||
break;
|
||||
}
|
||||
for (let n of userCookie.split(e)) n && userList.push(new UserInfo(n));
|
||||
userCount = userList.length;
|
||||
} else {
|
||||
console.log("未找到CK");
|
||||
return;
|
||||
}
|
||||
return console.log(`共找到${userCount}个账号`), true;//true == !0
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function httpRequest(options, method) {
|
||||
typeof (method) === 'undefined' ? ('body' in options ? method = 'post' : method = 'get') : method = method
|
||||
return new Promise((resolve) => {
|
||||
$[method](options, (err, resp, data) => {
|
||||
try {
|
||||
if (err) {
|
||||
console.log(`${method}请求失败`);
|
||||
$.logErr(err);
|
||||
//throw new Error(err);
|
||||
//console.log(err);
|
||||
} else {
|
||||
//httpResult = data;
|
||||
//httpResponse = resp;
|
||||
if (data) {
|
||||
//console.log(data);
|
||||
typeof JSON.parse(data) == 'object' ? data = JSON.parse(data) : data = data
|
||||
resolve(data)
|
||||
} else {
|
||||
console.log(`请求api返回数据为空,请检查自身原因`)
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
//console.log(e, resp);
|
||||
$.logErr(e, resp);
|
||||
} finally {
|
||||
resolve();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
function ts13() {
|
||||
return Math.round(new Date().getTime()).toString();
|
||||
}
|
||||
// 双平台log输出
|
||||
function DoubleLog(data) {
|
||||
if ($.isNode()) {
|
||||
if (data) {
|
||||
console.log(`${data}`);
|
||||
msg += `\n${data}`
|
||||
}
|
||||
} else {
|
||||
console.log(`${data}`);
|
||||
msg += `\n${data}`
|
||||
}
|
||||
}
|
||||
// 发送消息
|
||||
async function SendMsg(message) {
|
||||
if (!message) return;
|
||||
if (Notify > 0) {
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify($.name, message)
|
||||
} else {
|
||||
$.msg($.name, '', message)
|
||||
}
|
||||
} else {
|
||||
console.log(message)
|
||||
}
|
||||
}
|
||||
// 完整 Env
|
||||
function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(tLine truncated
|
||||
@@ -1,519 +0,0 @@
|
||||
/**
|
||||
* cron 5 15 * * *
|
||||
* Show:微信小程序-莱充充电
|
||||
* 变量名:
|
||||
* 变量值:https://shop.laichon.com/api/v1/ headers下的authorization 去掉JWT 只要后面的 # openid 多账户换行或者&
|
||||
* 示例 ejxxxxxx#o0sa51....
|
||||
* scriptVersionNow = "0.0.1";
|
||||
*/
|
||||
|
||||
const $ = new Env("微信小程序-莱充充电");
|
||||
const notify = $.isNode() ? require('../sendNotify') : '';
|
||||
let ckName = "wx_lccd";
|
||||
let envSplitor = ["&", "\n"]; //多账号分隔符
|
||||
let strSplitor = "#"; //多变量分隔符
|
||||
let userIdx = 0;
|
||||
let userList = [];
|
||||
class UserInfo {
|
||||
constructor(str) {
|
||||
this.index = ++userIdx;
|
||||
this.ck = str.split(strSplitor)[0];
|
||||
this.ck1 = str.split(strSplitor)[1];
|
||||
this.ckStatus = true;
|
||||
this.signStatus = ""
|
||||
this.headers = {
|
||||
"Host": "shop.laichon.com",
|
||||
"Connection": "keep-alive",
|
||||
"Content-Length": "9",
|
||||
"authorization": "JWT " + this.ck,
|
||||
"charset": "utf-8",
|
||||
"openid": this.ck1,
|
||||
"service-code": "WYC-MI-WEIXIN",
|
||||
"User-Agent": "Mozilla/5.0 (Linux; Android 10; MI 8 Lite Build/QKQ1.190910.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/116.0.0.0 Mobile Safari/537.36 XWEB/1160027 MMWEBSDK/20231002 MMWEBID/2585 MicroMessenger/8.0.43.2480(0x28002B51) WeChat/arm64 Weixin NetType/WIFI Language/zh_CN ABI/arm64 MiniProgramEnv/android",
|
||||
"content-type": "application/x-www-form-urlencoded",
|
||||
"Accept-Encoding": "gzip,compress,br,deflate",
|
||||
"Referer": "https://servicewechat.com/wxa68db1dabe823e7e/316/page-frame.html"
|
||||
}
|
||||
}
|
||||
async main() {
|
||||
await this.user_info()
|
||||
if(this.ckStatus){
|
||||
await this.task_sign();
|
||||
if (this.signStatus == 0) {
|
||||
await this.task_sign();
|
||||
} else if (this.signStatus == 1) {
|
||||
$.log(`签到翻倍`)
|
||||
await this.task_double();
|
||||
}
|
||||
$.log(`完成充电和看视频任务`)
|
||||
await this.task_complete(3)
|
||||
await this.task_complete(4)
|
||||
}
|
||||
|
||||
}
|
||||
async task_sign() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "签到",
|
||||
method: "get",
|
||||
url: `https://shop.laichon.com/api/v1/task/getSignTask`,
|
||||
headers: this.headers,
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if (result.code == 1) {
|
||||
if (result.data.isSign == 0) {
|
||||
//未签到
|
||||
$.log(`未签到`)
|
||||
this.signStatus = 0
|
||||
} else {
|
||||
$.log(`已签到`)
|
||||
this.signStatus = 1
|
||||
}
|
||||
} else {
|
||||
this.signStatus = 2
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async user_info() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "信息",
|
||||
method: "get",
|
||||
url: `https://shop.laichon.com/api/v1/member/userinfo`,
|
||||
headers: this.headers,
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if(result.code_key == "success"){
|
||||
this.ckStatus = true
|
||||
$.log(`当前[${result.data.mobile} 积分[${result.data.point}]]`)
|
||||
}else {
|
||||
this.ckStatus = false
|
||||
console.log(result);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async task_double() {
|
||||
try {
|
||||
let options = {
|
||||
fn: "签到翻倍",
|
||||
method: "get",
|
||||
url: `https://shop.laichon.com/api/v1/task/pointsDouble`,
|
||||
headers: this.headers,
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if(result.code_key == "success"){
|
||||
$.log(`完成 +1`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
async task_complete(id) {
|
||||
try {
|
||||
let options = {
|
||||
fn: "完成任务",
|
||||
method: "post",
|
||||
url: `https://shop.laichon.com/api/v1/task/taskComplete`,
|
||||
headers: this.headers,
|
||||
body: `task_id=${id}`
|
||||
}
|
||||
let { body: result } = await $.httpRequest(options);
|
||||
//console.log(options);
|
||||
//console.log(result);
|
||||
if(result.code_key == "success"){
|
||||
$.log(`完成 +1`)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
!(async () => {
|
||||
if (!(await checkEnv())) return;
|
||||
if (userList.length > 0) {
|
||||
let taskall = [];
|
||||
for (let user of userList) {
|
||||
if (user.ckStatus) {
|
||||
taskall.push(await user.main());
|
||||
}
|
||||
}
|
||||
await Promise.all(taskall);
|
||||
}
|
||||
await $.sendMsg($.logs.join("\n"))
|
||||
})()
|
||||
.catch((e) => console.log(e))
|
||||
.finally(() => $.done());
|
||||
|
||||
//********************************************************
|
||||
/**
|
||||
* 变量检查与处理
|
||||
* @returns
|
||||
*/
|
||||
async function checkEnv() {
|
||||
let userCookie = ($.isNode() ? process.env[ckName] : $.getdata(ckName)) || "";
|
||||
if (userCookie) {
|
||||
let e = envSplitor[0];
|
||||
for (let o of envSplitor)
|
||||
if (userCookie.indexOf(o) > -1) {
|
||||
e = o;
|
||||
break;
|
||||
}
|
||||
for (let n of userCookie.split(e)) n && userList.push(new UserInfo(n));
|
||||
} else {
|
||||
console.log(`未找到变量[${ckName}]`);
|
||||
return;
|
||||
}
|
||||
return console.log(`共找到${userList.length}个账号`), true; //true == !0
|
||||
}
|
||||
function Env(t, s) {
|
||||
return new (class {
|
||||
constructor(t, s) {
|
||||
this.name = t;
|
||||
this.data = null;
|
||||
this.dataFile = "box.dat";
|
||||
this.logs = [];
|
||||
this.logSeparator = "\n";
|
||||
this.startTime = new Date().getTime();
|
||||
Object.assign(this, s);
|
||||
this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`);
|
||||
}
|
||||
isNode() {
|
||||
return "undefined" != typeof module && !!module.exports;
|
||||
}
|
||||
isQuanX() {
|
||||
return "undefined" != typeof $task;
|
||||
}
|
||||
isSurge() {
|
||||
return "undefined" != typeof $httpClient && "undefined" == typeof $loon;
|
||||
}
|
||||
isLoon() {
|
||||
return "undefined" != typeof $loon;
|
||||
}
|
||||
loaddata() {
|
||||
if (!this.isNode()) return {};
|
||||
{
|
||||
this.fs = this.fs ? this.fs : require("fs");
|
||||
this.path = this.path ? this.path : require("path");
|
||||
const t = this.path.resolve(this.dataFile),
|
||||
s = this.path.resolve(process.cwd(), this.dataFile),
|
||||
e = this.fs.existsSync(t),
|
||||
i = !e && this.fs.existsSync(s);
|
||||
if (!e && !i) return {};
|
||||
{
|
||||
const i = e ? t : s;
|
||||
try {
|
||||
return JSON.parse(this.fs.readFileSync(i));
|
||||
} catch (t) {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
writedata() {
|
||||
if (this.isNode()) {
|
||||
this.fs = this.fs ? this.fs : require("fs");
|
||||
this.path = this.path ? this.path : require("path");
|
||||
const t = this.path.resolve(this.dataFile),
|
||||
s = this.path.resolve(process.cwd(), this.dataFile),
|
||||
e = this.fs.existsSync(t),
|
||||
i = !e && this.fs.existsSync(s),
|
||||
o = JSON.stringify(this.data);
|
||||
e ? this.writeFileSync(t, o) : i ? this.fs.writeFileSync(s, o) : this.fs.writeFileSync(t, o);
|
||||
}
|
||||
}
|
||||
lodash_get(t, s, e) {
|
||||
const i = s.replace(/\[(\d+)\]/g, ".$1").split(".");
|
||||
let o = t;
|
||||
for (const t of i) if (((o = Object(o)[t]), void 0 === o)) return e;
|
||||
return o;
|
||||
}
|
||||
lodash_set(t, s, e) {
|
||||
return Object(t) !== t
|
||||
? t
|
||||
: (Array.isArray(s) || (s = s.toString().match(/[^.[\]]+/g) || []),
|
||||
(s
|
||||
.slice(0, -1)
|
||||
.reduce(
|
||||
(t, e, i) =>
|
||||
Object(t[e]) === t[e]
|
||||
? t[e]
|
||||
: (t[e] = Math.abs(s[i + 1]) >> 0 == +s[i + 1] ? [] : {}),
|
||||
t
|
||||
)[s[s.length - 1]] = e),
|
||||
t);
|
||||
}
|
||||
getdata(t) {
|
||||
let s = this.getval(t);
|
||||
if (/^@/.test(t)) {
|
||||
const [, e, i] = /^@(.*?)\.(.*?)$/.exec(t),
|
||||
o = e ? this.getval(e) : "";
|
||||
if (o)
|
||||
try {
|
||||
const t = JSON.parse(o);
|
||||
s = t ? this.lodash_get(t, i, "") : s;
|
||||
} catch (t) {
|
||||
s = "";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
setdata(t, s) {
|
||||
let e = !1;
|
||||
if (/^@/.test(s)) {
|
||||
const [, i, o] = /^@(.*?)\.(.*?)$/.exec(s),
|
||||
h = this.getval(i),
|
||||
a = i ? ("null" === h ? null : h || "{}") : "{}";
|
||||
try {
|
||||
const s = JSON.parse(a);
|
||||
this.lodash_set(s, o, t), (e = this.setval(JSON.stringify(s), i));
|
||||
} catch (s) {
|
||||
const h = {};
|
||||
this.lodash_set(h, o, t), (e = this.setval(JSON.stringify(h), i));
|
||||
}
|
||||
} else e = this.setval(t, s);
|
||||
return e;
|
||||
}
|
||||
getval(t) {
|
||||
if (this.isSurge() || this.isLoon()) {
|
||||
return $persistentStore.read(t);
|
||||
} else if (this.isQuanX()) {
|
||||
return $prefs.valueForKey(t);
|
||||
} else if (this.isNode()) {
|
||||
this.data = this.loaddata();
|
||||
return this.data[t];
|
||||
} else {
|
||||
return this.data && this.data[t] || null;
|
||||
}
|
||||
}
|
||||
setval(t, s) {
|
||||
if (this.isSurge() || this.isLoon()) {
|
||||
return $persistentStore.write(t, s);
|
||||
} else if (this.isQuanX()) {
|
||||
return $prefs.setValueForKey(t, s);
|
||||
} else if (this.isNode()) {
|
||||
this.data = this.loaddata();
|
||||
this.data[s] = t;
|
||||
this.writedata();
|
||||
return true;
|
||||
} else {
|
||||
return this.data && this.data[s] || null;
|
||||
}
|
||||
}
|
||||
initGotEnv(t) {
|
||||
this.got = this.got ? this.got : require("got");
|
||||
this.cktough = this.cktough ? this.cktough : require("tough-cookie");
|
||||
this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar();
|
||||
if (t) {
|
||||
t.headers = t.headers ? t.headers : {};
|
||||
if (typeof t.headers.Cookie === "undefined" && typeof t.cookieJar === "undefined") {
|
||||
t.cookieJar = this.ckjar;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param {Object} options
|
||||
* @returns {String} 将 Object 对象 转换成 queryStr: key=val&name=senku
|
||||
*/
|
||||
queryStr(options) {
|
||||
return Object.entries(options)
|
||||
.map(([key, value]) => `${key}=${typeof value === 'object' ? JSON.stringify(value) : value}`)
|
||||
.join('&');
|
||||
}
|
||||
isJSONString(str) {
|
||||
try {
|
||||
var obj = JSON.parse(str);
|
||||
if (typeof obj == 'object' && obj) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
isJson(obj) {
|
||||
var isjson = typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
|
||||
return isjson;
|
||||
}
|
||||
async sendMsg(message) {
|
||||
if (!message) return;
|
||||
if ($.isNode()) {
|
||||
await notify.sendNotify($.name, message)
|
||||
} else {
|
||||
$.msg($.name, '', message)
|
||||
}
|
||||
}
|
||||
async httpRequest(options) {
|
||||
let t = {
|
||||
...options
|
||||
};
|
||||
if (!t.headers) {
|
||||
t.headers = {}
|
||||
}
|
||||
if (t.params) {
|
||||
t.url += '?' + this.queryStr(t.params);
|
||||
}
|
||||
t.method = t.method.toLowerCase();
|
||||
if (t.method === 'get') {
|
||||
delete t.headers['Content-Type'];
|
||||
delete t.headers['Content-Length'];
|
||||
delete t.headers['content-Type'];
|
||||
delete t.headers['content-Length'];
|
||||
delete t["body"]
|
||||
}
|
||||
if (t.method === 'post') {
|
||||
let contentType;
|
||||
|
||||
if (!t.body) {
|
||||
t.body = ""
|
||||
} else {
|
||||
if (typeof t.body == "string") {
|
||||
if (this.isJSONString(t.body)) {
|
||||
contentType = 'application/json'
|
||||
} else {
|
||||
contentType = 'application/x-www-form-urlencoded'
|
||||
}
|
||||
} else if (this.isJson(t.body)) {
|
||||
t.body = JSON.stringify(t.body);
|
||||
contentType = 'application/json';
|
||||
}
|
||||
}
|
||||
if (!t.headers['Content-Type']) {
|
||||
t.headers['Content-Type'] = contentType;
|
||||
}
|
||||
delete t.headers['Content-Length'];
|
||||
}
|
||||
if (this.isNode()) {
|
||||
this.initGotEnv(t);
|
||||
let httpResult = await this.got(t);
|
||||
if (this.isJSONString(httpResult.body)) {
|
||||
httpResult.body = JSON.parse(httpResult.body)
|
||||
}
|
||||
return httpResult;
|
||||
}
|
||||
if (this.isQuanX()) {
|
||||
t.method = t.method.toUpperCase()
|
||||
return new Promise((resolve, reject) => {
|
||||
$task.fetch(t).then(response => {
|
||||
if (this.isJSONString(response.body)) {
|
||||
response.body = JSON.parse(response.body)
|
||||
}
|
||||
resolve(response)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
randomNumber(length) {
|
||||
const characters = '0123456789';
|
||||
return Array.from({ length }, () => characters[Math.floor(Math.random() * characters.length)]).join('');
|
||||
}
|
||||
randomString(length) {
|
||||
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||
return Array.from({ length }, () => characters[Math.floor(Math.random() * characters.length)]).join('');
|
||||
}
|
||||
timeStamp() {
|
||||
return new Date().getTime()
|
||||
}
|
||||
uuid() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
var r = Math.random() * 16 | 0,
|
||||
v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
time(t) {
|
||||
let s = {
|
||||
"M+": new Date().getMonth() + 1,
|
||||
"d+": new Date().getDate(),
|
||||
"H+": new Date().getHours(),
|
||||
"m+": new Date().getMinutes(),
|
||||
"s+": new Date().getSeconds(),
|
||||
"q+": Math.floor((new Date().getMonth() + 3) / 3),
|
||||
S: new Date().getMilliseconds(),
|
||||
};
|
||||
/(y+)/.test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
(new Date().getFullYear() + "").substr(4 - RegExp.$1.length)
|
||||
));
|
||||
for (let e in s)
|
||||
new RegExp("(" + e + ")").test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
1 == RegExp.$1.length
|
||||
? s[e]
|
||||
: ("00" + s[e]).substr(("" + s[e]).length)
|
||||
));
|
||||
return t;
|
||||
}
|
||||
msg(s = t, e = "", i = "", o) {
|
||||
const h = (t) =>
|
||||
!t || (!this.isLoon() && this.isSurge())
|
||||
? t
|
||||
: "string" == typeof t
|
||||
? this.isLoon()
|
||||
? t
|
||||
: this.isQuanX()
|
||||
? { "open-url": t }
|
||||
: void 0
|
||||
: "object" == typeof t && (t["open-url"] || t["media-url"])
|
||||
? this.isLoon()
|
||||
? t["open-url"]
|
||||
: this.isQuanX()
|
||||
? t
|
||||
: void 0
|
||||
: void 0;
|
||||
this.isMute ||
|
||||
(this.isSurge() || this.isLoon()
|
||||
? $notification.post(s, e, i, h(o))
|
||||
: this.isQuanX() && $notify(s, e, i, h(o)));
|
||||
let logs = ['', '==============📣系统通知📣=============='];
|
||||
logs.push(t);
|
||||
e ? logs.push(e) : '';
|
||||
i ? logs.push(i) : '';
|
||||
console.log(logs.join('\n'));
|
||||
this.logs = this.logs.concat(logs);
|
||||
}
|
||||
log(...t) {
|
||||
t.length > 0 && (this.logs = [...this.logs, ...t]),
|
||||
console.log(t.join(this.logSeparator));
|
||||
}
|
||||
logErr(t, s) {
|
||||
const e = !this.isSurge() && !this.isQuanX() && !this.isLoon();
|
||||
e
|
||||
? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack)
|
||||
: this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t);
|
||||
}
|
||||
wait(t) {
|
||||
return new Promise((s) => setTimeout(s, t));
|
||||
}
|
||||
done(t = {}) {
|
||||
const s = new Date().getTime(),
|
||||
e = (s - this.startTime) / 1e3;
|
||||
this.log(
|
||||
"",
|
||||
`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`
|
||||
)
|
||||
this.log()
|
||||
if (this.isNode()) {
|
||||
process.exit(1)
|
||||
}
|
||||
if (this.isQuanX()) {
|
||||
$done(t)
|
||||
}
|
||||
}
|
||||
})(t, s);
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/**
|
||||
* 哪吒汽车 V1.00
|
||||
* 仅供学习交流,请在下载后的24小时内完全删除 请勿将任何内容用于商业或非法目的,否则后果自负。
|
||||
* const $ = new Env("哪吒汽车");
|
||||
*
|
||||
* cron 0 8,10,14,20 * * * 哪吒汽车.js
|
||||
*
|
||||
* 直接微信搜索 哪吒汽车,小程序即可,别下载app了
|
||||
*
|
||||
* ========= 青龙--配置文件 ===========
|
||||
* # 项目名称
|
||||
* export nzqc='抓包返回的refresh_token'
|
||||
|
||||
* 自己抓包搜索 /registerOrLoginUncheck 返回的 refresh_token
|
||||
|
||||
* 多账号换行或&隔开
|
||||
|
||||
* 奖励:签到转发得积分,一天大概五分,自动刷新token,小毛
|
||||
*
|
||||
* ====================================
|
||||
*
|
||||
*/
|
||||
var _0xodq='jsjiami.com.v7';const _0x359a3b=_0x2b50;(function(_0x4415b5,_0x54edf4,_0x4f077d,_0x5a17e2,_0x1168b4,_0x49812b,_0x3e55fe){return _0x4415b5=_0x4415b5>>0x1,_0x49812b='hs',_0x3e55fe='hs',function(_0x69a95a,_0x5bf113,_0x41599e,_0x234e33,_0x366c54){const _0x478cde=_0x2b50;_0x234e33='tfi',_0x49812b=_0x234e33+_0x49812b,_0x366c54='up',_0x3e55fe+=_0x366c54,_0x49812b=_0x41599e(_0x49812b),_0x3e55fe=_0x41599e(_0x3e55fe),_0x41599e=0x0;const _0x11dc99=_0x69a95a();while(!![]&&--_0x5a17e2+_0x5bf113){try{_0x234e33=parseInt(_0x478cde(0x205,'qAHF'))/0x1*(-parseInt(_0x478cde(0x525,'1vMd'))/0x2)+-parseInt(_0x478cde(0x61c,'$IdN'))/0x3*(parseInt(_0x478cde(0x25d,')M[x'))/0x4)+parseInt(_0x478cde(0x26a,'j4ia'))/0x5*(-parseInt(_0x478cde(0x4fd,'od7T'))/0x6)+-parseInt(_0x478cde(0x285,'e52A'))/0x7*(-parseInt(_0x478cde(0x267,'oC5F'))/0x8)+parseInt(_0x478cde(0x2c1,'gkg]'))/0x9*(-parseInt(_0x478cde(0x1bc,'[@5v'))/0xa)+parseInt(_0x478cde(0x214,'0MRg'))/0xb*(-parseInt(_0x478cde(0x361,'8umv'))/0xc)+-parseInt(_0x478cde(0x24b,'[#yz'))/0xd*(-parseInt(_0x478cde(0x4d2,'4AWb'))/0xe);}catch(_0x257c7f){_0x234e33=_0x41599e;}finally{_0x366c54=_0x11dc99[_0x49812b]();if(_0x4415b5<=_0x5a17e2)_0x41599e?_0x1168b4?_0x234e33=_0x366c54:_0x1168b4=_0x366c54:_0x41599e=_0x366c54;else{if(_0x41599e==_0x1168b4['replace'](/[AKOVPRgpGHWMDCLhrYt=]/g,'')){if(_0x234e33===_0x5bf113){_0x11dc99['un'+_0x49812b](_0x366c54);break;}_0x11dc99[_0x3e55fe](_0x366c54);}}}}}(_0x4f077d,_0x54edf4,function(_0x25b336,_0x5bb531,_0x3cdd4a,_0x571f91,_0x3a35e0,_0x4064f7,_0x33b7aa){return _0x5bb531='\x73\x70\x6c\x69\x74',_0x25b336=arguments[0x0],_0x25b336=_0x25b336[_0x5bb531](''),_0x3cdd4a=`\x72\x65\x76\x65\x72\x73\x65`,_0x25b336=_0x25b336[_0x3cdd4a]('\x76'),_0x571f91=`\x6a\x6f\x69\x6e`,(0x14d48e,_0x25b336[_0x571f91](''));});}(0x184,0x684e7,_0x9673,0xc4),_0x9673)&&(_0xodq=0x2289);const _0xfa5a18=(function(){const _0x4e9a8d=_0x2b50,_0x1c8317={'jzSJq':function(_0x8d05f0,_0x14140d){return _0x8d05f0===_0x14140d;},'tjhtf':_0x4e9a8d(0x3bb,'nCuX'),'paGkj':_0x4e9a8d(0x194,'!g)^'),'OlCVV':function(_0x478bd9,_0x14d343){return _0x478bd9(_0x14d343);},'bfIol':function(_0x43f265,_0x3efe7e){return _0x43f265+_0x3efe7e;},'NApUX':function(_0x5454fa,_0x58fa86){return _0x5454fa+_0x58fa86;},'UAMeM':function(_0x3d38e3,_0x4b2c53){return _0x3d38e3+_0x4b2c53;},'IVbzr':_0x4e9a8d(0x36e,'qAHF'),'WJkbN':function(_0x58c1de,_0x8c233c){return _0x58c1de+_0x8c233c;},'HHora':function(_0x4abfa7,_0x24d844){return _0x4abfa7(_0x24d844);},'mVklc':function(_0x3f7c78,_0x4b3764){return _0x3f7c78+_0x4b3764;},'HTAPA':_0x4e9a8d(0x4cc,'^leF')};let _0x284ee1=!![];return function(_0x4d7704,_0x4145c4){const _0x445cf2=_0x4e9a8d,_0x5c11bf={'IRwlZ':function(_0x1d774a,_0x57a4dc){const _0x440bc7=_0x2b50;return _0x1c8317[_0x440bc7(0x420,'A6yu')](_0x1d774a,_0x57a4dc);},'XpgOW':function(_0x4b744a,_0xda338c){const _0x4b4948=_0x2b50;return _0x1c8317[_0x4b4948(0x17a,'VsQH')](_0x4b744a,_0xda338c);},'CTJoX':function(_0x30ab45,_0x3fd70f){const _0x5828c2=_0x2b50;return _0x1c8317[_0x5828c2(0x5ee,'VsQH')](_0x30ab45,_0x3fd70f);},'gCUwd':function(_0x379cc5,_0x44c801){const _0x492d1c=_0x2b50;return _0x1c8317[_0x492d1c(0x2d3,'e52A')](_0x379cc5,_0x44c801);},'ZkTjd':function(_0x3692f4,_0x3191bb){const _0x104c04=_0x2b50;return _0x1c8317[_0x104c04(0x336,']Xq!')](_0x3692f4,_0x3191bb);},'KyXJb':function(_0x19fca3,_0xade198){const _0x379d29=_0x2b50;return _0x1c8317[_0x379d29(0x3bd,'Q300')](_0x19fca3,_0xade198);},'QpuoO':function(_0x2a8cf1,_0x4f5e6a){const _0x23bbce=_0x2b50;return _0x1c8317[_0x23bbce(0x49a,'oNRx')](_0x2a8cf1,_0x4f5e6a);},'KmkfL':_0x1c8317[_0x445cf2(0x258,'NXvd')],'uGTjl':function(_0x3ff60b,_0x41a501){const _0x5d15f6=_0x445cf2;return _0x1c8317[_0x5d15f6(0x453,'n7BF')](_0x3ff60b,_0x41a501);},'jrsgy':function(_0x1b7d80,_0x29998d){const _0x5f0c58=_0x445cf2;return _0x1c8317[_0x5f0c58(0x634,'vIIW')](_0x1b7d80,_0x29998d);},'NSvGv':function(_0xcce1d9,_0x300521){const _0x520624=_0x445cf2;return _0x1c8317[_0x520624(0x4e8,'7xMY')](_0xcce1d9,_0x300521);},'RhpKz':function(_0x3188b5,_0x223671){const _0x1b2d32=_0x445cf2;return _0x1c8317[_0x1b2d32(0x2f8,'Pjwb')](_0x3188b5,_0x223671);},'HeVyu':function(_0x4711c9,_0x1122fc){const _0xeca5e6=_0x445cf2;return _0x1c8317[_0xeca5e6(0x44c,'Y&oW')](_0x4711c9,_0x1122fc);},'VgxYk':function(_0x5ca0ef,_0x402077){const _0x1e3dbe=_0x445cf2;return _0x1c8317[_0x1e3dbe(0x63e,'cM^%')](_0x5ca0ef,_0x402077);}};if(_0x1c8317[_0x445cf2(0x4d1,'cM^%')](_0x1c8317[_0x445cf2(0x360,'nCuX')],_0x1c8317[_0x445cf2(0x1c7,'8umv')])){const _0xd6a761=_0x284ee1?function(){const _0x59c362=_0x445cf2;if(_0x4145c4){if(_0x1c8317[_0x59c362(0x64b,'[@5v')](_0x1c8317[_0x59c362(0x483,'oSR]')],_0x1c8317[_0x59c362(0x54e,'Y&oW')])){const _0x3a3482=_0x70eda9[_0x59c362(0x59a,'j4ia')](_0x5c11bf[_0x59c362(0x140,'VsQH')](_0x164015,this[_0x59c362(0x434,'cM^%')]?.[_0x59c362(0x4af,'qAHF')]('.')[0x1])),_0x5e45bf=_0x5c11bf[_0x59c362(0x2a4,'oNRx')](_0x5c11bf[_0x59c362(0x34e,'!g)^')](_0x5c11bf[_0x59c362(0x451,'8umv')](_0x5c11bf[_0x59c362(0x462,'Q300')](_0x5c11bf[_0x59c362Line truncated
|
||||
Reference in new issue
Block a user