mirror of
https://github.com/fmz200/wool_scripts.git
synced 2026-03-22 05:49:12 +08:00
Initial commit: new history
This commit is contained in:
21
Scripts/51card.js
Normal file
21
Scripts/51card.js
Normal file
@ -0,0 +1,21 @@
|
||||
// 去除首页横幅广告,去除我的广告(只保留设置,个人资料)
|
||||
|
||||
if (!$response.body) {
|
||||
$done({});
|
||||
}
|
||||
const url = $request.url;
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (obj?.operationResourceDTO) {
|
||||
obj.operationResourceDTO = [];
|
||||
}
|
||||
|
||||
if (url.includes("api.u51.com/generic-config-gateway/api")) {
|
||||
if (obj?.meTabConfigExts) {
|
||||
let reserve = ['设置']
|
||||
obj.meTabConfigExts = obj.meTabConfigExts.filter(item => reserve.includes(item.meTabConfigs[0].title));
|
||||
}
|
||||
}
|
||||
|
||||
body = JSON.stringify(obj);
|
||||
$done({body});
|
||||
11
Scripts/555Ad.js
Normal file
11
Scripts/555Ad.js
Normal file
@ -0,0 +1,11 @@
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
// 过滤掉 layout 为 advert_self 的 data 条目
|
||||
obj.data = obj.data.filter(item => item.layout !== "advert_self");
|
||||
|
||||
// 对每个 data 条目中的 list 进行二次过滤 (移除 type=3 的元素)
|
||||
obj.data.forEach(item => {
|
||||
item.list = item.list.filter(ad => ad.type !== 3);
|
||||
});
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
25
Scripts/Enpass/enpass.js
Normal file
25
Scripts/Enpass/enpass.js
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
脚本作者:Maasea
|
||||
引用地址:https://raw.githubusercontent.com/Maasea/sgmodule/master/Script/Enpass/enpass.js
|
||||
|
||||
[rewrite_local]
|
||||
# Enpass Password Manager解锁订阅 //license.enpass.io
|
||||
^https?:\/\/license\.enpass\.io\/api\/v1\/subscription\/me url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/Enpass/enpass.js
|
||||
|
||||
[mitm]
|
||||
hostname = license.enpass.io
|
||||
*/
|
||||
|
||||
var obj = JSON.parse($response.body);
|
||||
|
||||
obj.license = "premium";
|
||||
obj.info = {
|
||||
purchase_type: "inapp",
|
||||
store: "ios",
|
||||
id: "ENP_IAP_LTP",
|
||||
userid: "000000",
|
||||
transaction_id: "1000000000000000",
|
||||
logo: ""
|
||||
};
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
3
Scripts/FamilyMart.js
Normal file
3
Scripts/FamilyMart.js
Normal file
@ -0,0 +1,3 @@
|
||||
let obj=JSON.parse($response.body);
|
||||
delete obj.data.topBanner ;
|
||||
$done({body: JSON.stringify(obj)});
|
||||
8
Scripts/PupuSplashAds.js
Normal file
8
Scripts/PupuSplashAds.js
Normal file
@ -0,0 +1,8 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 朴朴超市
|
||||
* @date 2023-11-27 22:50:13
|
||||
*/
|
||||
let obj = JSON.parse($response.body);
|
||||
obj.data = obj.data.filter(item => item.position_type !== 50);
|
||||
$done({body: JSON.stringify(obj)});
|
||||
13
Scripts/QuDa.js
Normal file
13
Scripts/QuDa.js
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 去哒 首页开屏广告
|
||||
* @date 2023-11-27 22:50:13
|
||||
*/
|
||||
var body = $response.body;
|
||||
var obj = JSON.parse(body);
|
||||
if (obj.data.length == 600) {
|
||||
obj.data = "null";
|
||||
$done({body: JSON.stringify(obj)});
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
553
Scripts/SubStore/cname.js
Normal file
553
Scripts/SubStore/cname.js
Normal file
@ -0,0 +1,553 @@
|
||||
/**
|
||||
* @Sub-Store-Page
|
||||
* CNAME 接口查询去重/重命名 2023-11-16 20:34:08
|
||||
* - 入口查询[国内spapi 识别到国外为ip-api] 落地查询[ip-api]
|
||||
* - 根据接口返回的真实结果,重新对节点命名。
|
||||
* - 添加入口城市、落地国家或地区、国内运营商信息,并对这些数据做持久化缓存(48小时有效期),减少API请求次数,提高运行效率。
|
||||
* - 仅兼容 Surge, Loon 客户端。
|
||||
* - Surge 需要固定带 ability 参数版本。
|
||||
* 特别说明:
|
||||
* - 符号:🅳电信 🅻联通 🆈移动 🅶广电 🅲公司 🆉直连 🎮游戏
|
||||
* - 首次运行或者在没有缓存的情况下会通知进度
|
||||
* - 无参数时的节点命名格式: "美国 01"
|
||||
* - 1. 官方默认版(目前不带 ability 参数, 不保证以后不会改动): 》https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge.sgmodule
|
||||
*
|
||||
* - 2. 固定带 ability 参数版本,可能会爆内存, 如果需要使用指定节点功能 例如 [加国旗脚本或者cname脚本] 请使用此带 ability 参数版本: https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge-ability.sgmodule
|
||||
*
|
||||
* - 3. 固定不带 ability 参数版本:https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge-Noability.sgmodule
|
||||
*
|
||||
* - 参数必须以"#"开头,多个参数使用"&"连接,例如 https://github.com/Keywos/rule/raw/main/cname.js#city&iisp&name=Name
|
||||
* - 以下是此脚本支持的参数,必须以"#"开头,多个参数使用"&"连接,需要传入参数的话用 "=" 例如 "name=一元" 参考上述地址为例使用参数。
|
||||
* - 无参数时的节点命名格式: "美国 01",如果 [入口IP或国家]或 [落地IP或国家]一样则为 "直连 德国 01"
|
||||
* - 首次运行或者在没有缓存的情况下会通知进度
|
||||
*
|
||||
*
|
||||
* 入口参数
|
||||
* - [iisp] 增加入口运营商或者直连标识;
|
||||
* - [city] 增加入口城市文字标识;
|
||||
* - [sheng] 增加入口省份文字标识;
|
||||
* - [yuan] 为境外入口添加真实的入口属地标识,当未配置此此参数时,则将境外入口统一标记为 [境外],默认未配置此参数;
|
||||
* - [inflag] 增加入口国旗
|
||||
*
|
||||
* 落地参数
|
||||
* - [yisp] 显示落地详细运营商名称;
|
||||
* - [yw] 落地归属地使用英文缩写标识,不建议与其他入口参数配合使用,因为其他参数API没有返回英文;
|
||||
* - [xy] 此参数关闭落地查询,仅查询入口;开启 yisp || yw || flag 参数后 xy 参数无效
|
||||
*
|
||||
* 图标参数
|
||||
* - [game] 增加游戏节点标识;
|
||||
* - [flag] 增加国家或地区的旗帜标识,默认无此参数;
|
||||
* - [bl] 保留倍率标识;
|
||||
* - [snone] 清理某地区内只有一个节点的序号;
|
||||
*
|
||||
* 分隔符参数
|
||||
* - [fgf=] 设置入口和落地之间的分隔符,默认为空格;
|
||||
* - [sn=] 设置国家与序号之间的分隔符,默认为空格;
|
||||
* - [name=] 为节点添加机场名称前缀;
|
||||
*
|
||||
* 通知参数
|
||||
* - [offtz] 关闭脚本通知;
|
||||
*
|
||||
* 解析参数
|
||||
* - [dnsjx] 将节点域名解析为IP,普通用户不建议使用;
|
||||
*
|
||||
* 逻辑参数
|
||||
* - [bs=] 批处理节点数建议10个左右,如果经常读不到节点建议减小批处理个数;
|
||||
*
|
||||
* 缓存参数
|
||||
* - [h=] 节点缓存有效期,单位小时,时间参数只能二选一,Loon用户不需填写要此参数,请进入Sub-Store插件的配置界面自定义缓存有效期;
|
||||
* - [min=] 节点缓存有效期,单位分钟,时间参数只能二选一,Loon用户不需填写要此参数,请进入Sub-Store插件的配置界面自定义缓存有效期;
|
||||
*
|
||||
* 超时参数
|
||||
* - [timeout=] 当无任何节点缓存时测试节点HTTP延时允许的最大超时参数,超出允许范围则判定为无效节点,默认2000ms;
|
||||
* - [cd=] 当有缓存时,会先读取缓存,直接输出结果;默认 [cd=]的值等于0,微直接读取缓存;
|
||||
当设为更高的值: 比如'460'则每次读缓存都会再次处理之前判定为超时的节点,超时为460ms
|
||||
*
|
||||
* 其他参数
|
||||
* - [debug] 调试日志,普通用户不建议使用。
|
||||
* - 异常:如遇问题,Loon可以进入[配置]→[持久化缓存]→[删除指定数据]→输入Key [sub-store-cached-script-resource]并删除缓存。累计输出节点为0个3次以上将清理所有缓存
|
||||
* - Surge需要进入[脚本编辑器]→左下角[设置]→[$persistentStore] [sub-store-cached-script-resource]删除缓存数据。
|
||||
*/
|
||||
|
||||
const SUB_STORE_SCHEMA = {
|
||||
title: "CNAME",
|
||||
description: "根据接口返回的真实结果,重新对节点命名/去重。 如:入口/落地详细地区信息",
|
||||
scope: ["Surge", "Loon"],
|
||||
author: "@Key @奶茶姐 @小一 @可莉",
|
||||
updateTime: "2023-11-11 18:26:00",
|
||||
version: "1.2.2",
|
||||
params: {
|
||||
flag: {
|
||||
datatype: "boolean",
|
||||
description: "增加落地国家或地区的旗帜标识,默认无此参数",
|
||||
defaultValue: false,
|
||||
},
|
||||
inflag:{
|
||||
datatype: "boolean",
|
||||
description: "增加入口国家或地区的旗帜标识,默认无此参数",
|
||||
defaultValue: false,
|
||||
},
|
||||
xy: {
|
||||
datatype: "boolean",
|
||||
description: "关闭落地查询,仅查询入口;开启 yisp || yw || flag 参数后 xy 参数无效",
|
||||
defaultValue: false,
|
||||
},
|
||||
iisp: {
|
||||
datatype: "boolean",
|
||||
description: "增加入口运营商或者直连标识",
|
||||
defaultValue: false,
|
||||
},
|
||||
city: {
|
||||
datatype: "boolean",
|
||||
description: "增加入口城市文字标识",
|
||||
defaultValue: false,
|
||||
},
|
||||
sheng: {
|
||||
datatype: "boolean",
|
||||
description: "增加入口省份文字标识",
|
||||
defaultValue: false,
|
||||
},
|
||||
yuan: {
|
||||
datatype: "boolean",
|
||||
description:
|
||||
"为境外入口添加真实的入口属地标识,当未配置此此参数时,则将境外入口统一标记为[境外],默认未配置此参数",
|
||||
defaultValue: false,
|
||||
},
|
||||
yisp: {
|
||||
datatype: "boolean",
|
||||
description: "显示落地详细运营商名称",
|
||||
defaultValue: false,
|
||||
},
|
||||
yw: {
|
||||
datatype: "boolean",
|
||||
description:
|
||||
"落地归属地使用英文缩写标识,不建议与其他入口参数配合使用,因为其他参数API没有返回英文",
|
||||
defaultValue: false,
|
||||
},
|
||||
game: {
|
||||
datatype: "boolean",
|
||||
description: "增加游戏节点标识",
|
||||
defaultValue: false,
|
||||
},
|
||||
bl: {
|
||||
datatype: "boolean",
|
||||
description: "保留倍率标识",
|
||||
defaultValue: false,
|
||||
},
|
||||
snone: {
|
||||
datatype: "boolean",
|
||||
description: "清理某地区内只有一个节点的序号",
|
||||
defaultValue: false,
|
||||
},
|
||||
offtz: {
|
||||
datatype: "boolean",
|
||||
description: "关闭脚本通知",
|
||||
defaultValue: false,
|
||||
},
|
||||
dnsjx: {
|
||||
datatype: "boolean",
|
||||
description: "将节点域名解析为IP, 普通用户不建议使用",
|
||||
defaultValue: false,
|
||||
},
|
||||
debug: {
|
||||
datatype: "boolean",
|
||||
description: "调试日志,普通用户不建议使用",
|
||||
defaultValue: false,
|
||||
},
|
||||
fgf: {
|
||||
datatype: "string",
|
||||
description: "设置入口和落地之间的分隔符,默认为空格",
|
||||
defaultValue: " ",
|
||||
},
|
||||
sn: {
|
||||
datatype: "string",
|
||||
description: "设置国家与序号之间的分隔符,默认为空格",
|
||||
defaultValue: " ",
|
||||
},
|
||||
name: {
|
||||
datatype: "string",
|
||||
description: "为节点添加机场名称前缀",
|
||||
defaultValue: "",
|
||||
},
|
||||
timeout: {
|
||||
datatype: "number",
|
||||
description:
|
||||
"当无任何节点缓存时测试节点HTTP延时允许的最大超时参数,超出允许范围则判定为无效节点,默认2000ms",
|
||||
defaultValue: 2000,
|
||||
},
|
||||
cd: {
|
||||
datatype: "number",
|
||||
description:
|
||||
"当有缓存时,会先读取缓存,直接输出结果;默认[cd=]的值等于0,微直接读取缓存; 当设为更高的值: 比如'460'则每次读缓存都会再次处理之前判定为超时的节点,超时为460ms",
|
||||
defaultValue: 0,
|
||||
},
|
||||
bs: {
|
||||
datatype: "number",
|
||||
description:
|
||||
"批处理节点数建议10个左右,如果经常读不到节点建议减小批处理个数",
|
||||
defaultValue: 10,
|
||||
},
|
||||
h: {
|
||||
datatype: "number",
|
||||
description:
|
||||
"节点缓存有效期,单位小时,时间参数只能二选一,Loon用户不需填写要此参数,请进入Sub-Store插件的配置界面自定义缓存有效期",
|
||||
defaultValue: "",
|
||||
},
|
||||
min: {
|
||||
datatype: "number",
|
||||
description:
|
||||
"节点缓存有效期,单位分钟,时间参数只能二选一,Loon用户不需填写要此参数,请进入Sub-Store插件的配置界面自定义缓存有效期",
|
||||
defaultValue: "",
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
const $ = $substore;
|
||||
const iar = $arguments;
|
||||
let FGF = iar.fgf == undefined ? " " : decodeURI(iar.fgf),FGFS = FGF,debug = iar.debug;
|
||||
const { yw, bl, iisp, xy, yisp, yun, city, flag, inflag, game, yuan, sheng, offtz, snone: numone} = iar;
|
||||
const h = iar.h ? decodeURI(iar.h) : "",min = iar.min ? decodeURI(iar.min) : "",firstN = iar.name ? decodeURI(iar.name) : "";
|
||||
const XHFGF = iar.sn == undefined ? " " : decodeURI(iar.sn),{ isLoon: isLoon, isSurge: isSurge } = $substore.env, dns = iar.dnsjx,target = isLoon ? "Loon" : isSurge ? "Surge" : undefined,keypr= "peedtest";
|
||||
let cd = iar.cd ? iar.cd : 0, timeout = iar.timeout ? iar.timeout : 2000, writet = "", innum = 1728e5, loontrue = false, onen = false, Sue = false, rawtime = 1500;
|
||||
const keyp = "3.s",EXPIRATION_KEY = "#sub-store-csr-expiration-time";
|
||||
if (min !== "") {
|
||||
Sue = true;
|
||||
innum = parseInt(min, 10) * 6e4;
|
||||
writet = $.write(JSON.stringify(innum), EXPIRATION_KEY);
|
||||
} else if (h !== "") {
|
||||
Sue = true;
|
||||
innum = parseInt(h, 10) * 36e5;
|
||||
writet = $.write(JSON.stringify(innum), EXPIRATION_KEY);
|
||||
} else {
|
||||
writet = $.write(JSON.stringify(innum), EXPIRATION_KEY);
|
||||
}
|
||||
let TIMEDKEY = $.read(EXPIRATION_KEY),inapi=0;
|
||||
async function operator(e = [], targetPlatform, env) {
|
||||
let tzname = "", subcoll = "", x = false, xys = false;
|
||||
if (env?.source?.[e?.[0]?.subName]) x = true;
|
||||
if (env?.source?._collection?.name) xys = true;
|
||||
if (x && xys) {
|
||||
tzname =
|
||||
env.source._collection.name + ": [" + env.source._collection.subscriptions + "]";
|
||||
subcoll = "组合订阅内单条订阅加了脚本, 输出组合订阅";
|
||||
} else if (x) {
|
||||
tzname = env.source[e[0].subName].name;
|
||||
subcoll = "单条订阅脚本";
|
||||
} else {
|
||||
tzname = env.source._collection.name;
|
||||
subcoll = "组合订阅脚本";
|
||||
}
|
||||
const startTime = new Date();
|
||||
const support = isLoon || isSurge;
|
||||
if (!xy) {
|
||||
if (!support) {
|
||||
$.notify("No Loon or Surge")
|
||||
$.error(`No Loon or Surge`);
|
||||
return e;
|
||||
}
|
||||
}
|
||||
function klog(...arg) {
|
||||
console.log('[CNAME] ' +subcoll+ tzname +" : "+ arg);
|
||||
}
|
||||
if (e.length < 1) {$.notify(subcoll +tzname,"订阅无节点","");return e;}
|
||||
if (typeof scriptResourceCache === "undefined")return e;
|
||||
let bs = iar.bs ? iar.bs : 9;
|
||||
const ein = e.length;
|
||||
const eins = ein/2;
|
||||
klog(`开始处理节点: ${ein} 个`);
|
||||
klog(`批处理节点数: ${bs} 个`);
|
||||
klog(`设定api超时: ${zhTime(timeout)}`);
|
||||
klog(`有缓api超时: ${zhTime(cd)}`);
|
||||
// e = e.filter((item) => !nlc.test(item.name));
|
||||
let o = 0,Pushtd = "",intimed = "",stops = false,rere=false,iflag="",cachen = 0;
|
||||
while (o < e.length && !stops) {
|
||||
const batchs = e.slice(o, o + 1);
|
||||
await Promise.all(
|
||||
batchs.map(async (pk) => {
|
||||
try {
|
||||
const inss = new Map();
|
||||
const id = getid(pk);
|
||||
if (inss.has(id)) {
|
||||
return inss.get(id);
|
||||
}
|
||||
const cacheds = scriptResourceCache.get(id);
|
||||
if (cacheds) cachen++;
|
||||
if (cachen > eins) {
|
||||
if (!onen) {
|
||||
klog(`检查缓存数量: ${cachen}/${ein} 个`);
|
||||
rawtime = timeout;
|
||||
timeout = cd;
|
||||
onen = true;
|
||||
stops = true;
|
||||
}
|
||||
const readt = scriptResourceCache.gettime(id);
|
||||
let nt = new Date().getTime();
|
||||
let timedPush = "";
|
||||
if (isLoon) {
|
||||
let loontd = "";
|
||||
const loonkkk={"1分钟":6e4,"5分钟":3e5,"10分钟":6e5,"30分钟":18e5,"1小时":36e5,"2小时":72e5,"3小时":108e5,"6小时":216e5,"12小时":432e5,"24小时":864e5,"48小时":1728e5,"72小时":2592e5,参数传入:"innums"};
|
||||
intimed = $.read("#节点缓存有效期");
|
||||
loontd = loonkkk[intimed] || 1728e5;
|
||||
if (loontd == "innums") {
|
||||
loontd = innum;
|
||||
}
|
||||
timedPush = zhTime(
|
||||
parseInt(readt, 10) - nt + parseInt(loontd, 10)
|
||||
);
|
||||
} else if (target === "Surge" && Sue) {
|
||||
timedPush = zhTime(
|
||||
parseInt(readt, 10) - nt + parseInt(innum, 10)
|
||||
);
|
||||
} else {
|
||||
timedPush = zhTime(
|
||||
parseInt(readt, 10) - nt + parseInt(TIMEDKEY, 10)
|
||||
);
|
||||
}
|
||||
Pushtd = `, ${timedPush}后过期 \n`;
|
||||
}
|
||||
} catch (err) {delog(err.message)}
|
||||
})
|
||||
);
|
||||
o += 1;
|
||||
}
|
||||
if (!onen && !offtz) $.notify(subcoll+tzname, `开始处理节点: ${ein} 个 批处理数量: ${bs} 个`, "请等待处理完毕后再次点击预览");
|
||||
|
||||
let retryi = 0,breaki=false, isone = 0;
|
||||
do {
|
||||
let i = 0,newnode = [];isone++;
|
||||
while (i < e.length) {
|
||||
const batch = e.slice(i, i + bs);
|
||||
await Promise.all(
|
||||
batch.map(async (pk) => {
|
||||
try {
|
||||
let keyover = [], Yserver = pk.server,luodi = "",inQcip = "",nxx = "",adflag = "",OGame="",Oisp="",Oispflag="",Osh="", Oct="",zhi = "",yuanisp ="",isCN = false,v4 = false, v6 = false, isNoAli = false;
|
||||
let inServer = await AliD(Yserver);
|
||||
delog(inServer)
|
||||
switch (inServer) {
|
||||
case "keyn":
|
||||
isNoAli = true;
|
||||
inServer = Yserver;
|
||||
break;
|
||||
default:
|
||||
pk.keyrk = inServer;
|
||||
if (!isNoAli) {
|
||||
if (/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(inServer)) {
|
||||
v4 = true;
|
||||
} else if (/^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/.test(inServer)) {
|
||||
v6 = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
let btip = true,outu="",outips="";
|
||||
if (!xy || yisp || yw || flag) {
|
||||
if (!support) {
|
||||
$.notify("No Loon or Surge")
|
||||
$.error(`No Loon or Surge, 开启 yisp || yw || flag 参数后 xy 参数无效`);
|
||||
return e;
|
||||
}
|
||||
|
||||
const outip = await OUTIA(pk);
|
||||
let {country:outUsq, countryCode:outUs, city:outCity, query:outQuery, isp:outisp} = outip;//落地
|
||||
if (yisp) {
|
||||
yuanisp = FGFS+outisp
|
||||
};
|
||||
debug && (pk.keyoutld = outip);
|
||||
delog("落地信息 " + JSON.stringify(outip))
|
||||
outu = outUs;
|
||||
outips = outQuery;
|
||||
luodi = (outUsq === "中国") ? outCity : (yw ? outUs : outUsq);
|
||||
btip = outQuery !== inServer
|
||||
};
|
||||
|
||||
if (btip || xy) {
|
||||
if (!isNoAli || v4) {
|
||||
const spkey = await SPEC(inServer);
|
||||
let {country:inSpCn,regionName:inSpSheng,city:inSpCity,isp:inSpIsp,ip:inSpIp,countryCode:inCode} = spkey;
|
||||
inflag && (iflag = getflag(inCode));
|
||||
debug && (pk.keyinsp = spkey);
|
||||
isCN = inSpCn === "中国";
|
||||
inQcip = inServer;
|
||||
const keycm = {电信:"🅳", 联通:"🅻", 移动: "🆈",广电:"🅶"};
|
||||
if (isCN){
|
||||
debug && (pk.keyinsp = spkey)
|
||||
delog("国内入口 " + JSON.stringify(spkey));
|
||||
if(iisp && flag){
|
||||
inSpIsp=inSpIsp.replace(/中国/g, "")
|
||||
flag && (Oispflag = keycm.hasOwnProperty(inSpIsp) ? keycm[inSpIsp] : "🅲");
|
||||
} else if(iisp){
|
||||
Oisp = /电信|联通|移动|广电/.test(inSpIsp) ? inSpIsp.replace(/中国/g, "") : "企业";
|
||||
}
|
||||
(inSpSheng === inSpCity) && (inSpCity = "");
|
||||
|
||||
if (sheng && city){
|
||||
Osh = inSpSheng;Oct = inSpCity
|
||||
} else if (sheng){
|
||||
Osh = inSpSheng;
|
||||
} else if (city){
|
||||
Oct = inSpCity ? inSpCity : inSpSheng;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (isNoAli || v6 || !isCN) {
|
||||
const inip = await INIA(Yserver);
|
||||
let {country: inUsq, city: inCity, query: inQuery, regionName: inIpSh, countryCode:inaCode} = inip;
|
||||
inflag && (iflag = getflag(inaCode));
|
||||
debug && (pk.keyinipapi = inip);
|
||||
delog("ipapi入口 " + JSON.stringify(inip));
|
||||
inQcip = inQuery; //去重ip
|
||||
if (inUsq === "中国") {
|
||||
// inCity === inUs ? (incity=inCity)
|
||||
(/[a-zA-Z]/.test(inCity)) && (inCity = inIpSh);
|
||||
(inCity === inIpSh) && (inIpSh="");
|
||||
if (sheng && city){
|
||||
Osh = inIpSh;Oct = inCity;
|
||||
} else if (sheng){
|
||||
Osh = inIpSh;
|
||||
} else if (city){
|
||||
Oct = inCity ? inCity : inIpSh;
|
||||
}
|
||||
// 运营商 未知
|
||||
flag && (Oispflag = "🅲");
|
||||
|
||||
} else {
|
||||
if(inQuery === outips){
|
||||
flag && (Oispflag = "🆉");
|
||||
(sheng || city || iisp) && (zhi = "直连");
|
||||
} else if (yuan){
|
||||
flag && (Oispflag = "🅲");
|
||||
(sheng || city || iisp) && (zhi = inUsq);
|
||||
} else {
|
||||
flag && (Oispflag = "🆇");
|
||||
(sheng || city || iisp) && (zhi = "境外");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
flag && (Oispflag = "🆉");
|
||||
(sheng || city || iisp) && (zhi = "直连");
|
||||
}
|
||||
flag && (adflag = getflag(outu));
|
||||
game && (OGame = /game|游戏/i.test(pk.name) ? (flag ? "🎮" : FGF+"Game") : OGame);
|
||||
if (bl){
|
||||
const match = pk.name.match(/((倍率|X|x|×)\D?((\d\.)?\d+)\D?)|((\d\.)?\d+)(倍|X|x|×)/);
|
||||
if (match) {
|
||||
const matchVa = match[0].match(/(\d[\d.]*)/)[0];
|
||||
if (matchVa !== "1") {
|
||||
nxx = XHFGF + matchVa + "X";
|
||||
}
|
||||
}
|
||||
}
|
||||
(!iisp && !city && !sheng && !xy && !inflag) && (Oispflag = "",FGF ="");
|
||||
keyover = keyover.concat(
|
||||
firstN, Oispflag,Osh,Oct,Oisp,zhi,FGF,adflag,luodi,OGame,nxx,yuanisp
|
||||
).filter(ki => ki !== "");
|
||||
// delog(keyover)
|
||||
let overName = keyover.join("");
|
||||
xy && (overName = iflag +overName +FGF+ pk.name);
|
||||
// delog(overName)
|
||||
newnode.push(outips);
|
||||
dns && (pk.server = inQcip);
|
||||
pk.name = overName;
|
||||
inflag && (pk.name = iflag + overName);
|
||||
pk.qc = inQcip + outips;
|
||||
} catch (err) {
|
||||
if (inapi >= 1) {
|
||||
retryi++;
|
||||
breaki = true;
|
||||
}
|
||||
delog(err.message)
|
||||
};
|
||||
})
|
||||
);
|
||||
i += bs;
|
||||
klog(`处理进度${i}/${ein}`)
|
||||
if (!onen){
|
||||
if(!offtz && (ein > (i*2))){
|
||||
if (i >= (e.length / 3) && i < (e.length * 2 / 3) && ein>i) {
|
||||
$.notify(subcoll+tzname, `处理进度${i}/${ein}`, "耐心等待, 请勿重复点击预览...");
|
||||
}
|
||||
}
|
||||
await sleep(GRa());
|
||||
}
|
||||
}
|
||||
!xy && (e = removels(e));
|
||||
var eout = e.length;
|
||||
if (eout > 3 && isSurge){
|
||||
const allsame = newnode.every((value, index, arr) => value === arr[0]);
|
||||
if(allsame){
|
||||
klog(`未使用带指定节点功能的 SubStore, 或所有节点落地IP相同`);
|
||||
$.notify('CNAME:点击以安装对应版本','未使用带指定节点功能的 SubStore,或所有节点落地IP相同','',{url: "https://raw.githubusercontent.com/sub-store-org/Sub-Store/master/config/Surge-ability.sgmodule",})
|
||||
return e;
|
||||
}
|
||||
}
|
||||
if (inapi >= 1) {
|
||||
retryi++;
|
||||
timeout = rawtime;
|
||||
onen = false;
|
||||
spMap.clear();alMap.clear();iaMap.clear();oaMap.clear();
|
||||
klog(`重试中...`);
|
||||
} else {
|
||||
retryi = 2;
|
||||
}
|
||||
} while(retryi < 2);
|
||||
|
||||
!xy && (e = removeqc(e));
|
||||
e = jxh(e);
|
||||
// if (firstN !== "") {e.forEach((pk) => {pk.name = firstN + " " + pk.name;});}
|
||||
numone && (e = onee(e));
|
||||
const endTime = new Date();
|
||||
const timeDiff = endTime.getTime() - startTime.getTime();
|
||||
if (dns) {
|
||||
klog(`dns解析后共: ${eout} 个`);
|
||||
}
|
||||
apiRead > 0 ? klog(`读取api缓存: ${apiRead} 个`) : null;
|
||||
apiw > 0 ? klog(`写入api缓存: ${apiw} 个`) : null;
|
||||
klog(`处理完后剩余: ${eout} 个`);
|
||||
// const Nullv ='#SubStoreNullvalue';
|
||||
// if (eout === 0 && ein !== 0){
|
||||
// let Nullvi = parseInt($.read(Nullv), 10);
|
||||
// if (isNaN(Nullvi)) {
|
||||
// klog(`错误1次, 3次后将清理所有节点缓存`);
|
||||
// $.write("0", Nullv);
|
||||
// } else {
|
||||
// Nullvi += 1;
|
||||
// klog(`错误${Nullvi}次, 3次后将清理所有节点缓存`);
|
||||
// $.write(Nullvi.toString(), Nullv);
|
||||
// }
|
||||
// if (Nullvi > 3) {
|
||||
// $.write({}, "#sub-store-cached-script-resource");
|
||||
// klog(`错误${Nullvi}次, 已清理所有节点缓存`);
|
||||
// Nullvi = 0;
|
||||
// $.write(Nullvi.toString(), Nullv);
|
||||
// }
|
||||
// }
|
||||
if (isLoon) {
|
||||
klog("缓存过期时间: " + intimed + ", 还剩" + Pushtd.replace(/,|\n/g, ""));
|
||||
} else {
|
||||
klog("缓存过期时间: " +zhTime(TIMEDKEY) +", 还剩" +Pushtd.replace(/,|\n/g, ""));
|
||||
}
|
||||
klog(`此方法总用时: ${zhTime(timeDiff)}\n----For New CNAME----\n\n\n\n\n`);
|
||||
const readklog = apiRead ? `读取缓存:${apiRead} ` : "";
|
||||
const writeklog = apiw ? `写入缓存:${apiw}, ` : "";
|
||||
const Push = (eout === ein && eout === 0) ? "" : (eout === ein ? "全部通过测试, " : "去除无效节点后有" + eout + "个, ");
|
||||
if (!offtz) {$.notify(
|
||||
`${subcoll}${tzname} 共${ein}个节点`,
|
||||
"",
|
||||
`${writeklog}${readklog}${Pushtd}${Push}用时:${zhTime(timeDiff)}`
|
||||
);}
|
||||
return e;
|
||||
}
|
||||
|
||||
function getflag(e) { const t = e .toUpperCase() .split("") .map((e) => 127397 + e.charCodeAt()); return String.fromCodePoint(...t).replace(/🇹🇼/g, "🇨🇳"); } function sleep(e) { return new Promise((t) => setTimeout(t, e)); } let apiRead = 0, apiw = 0;
|
||||
const oaMap = new Map(); async function OUTIA(e) { const t = getid(e); if (oaMap.has(t)) return oaMap.get(t); const cached = scriptResourceCache.get(t);if (cached) { apiRead++; return cached; } else {inapi++;};const maxRE = 2; const url = `http://ip-api.com/json?lang=zh-CN&fields=status,message,country,countryCode,city,query,isp`; const getHttp = async (reTry) => { try { let r = ProxyUtils.produce([e], target); const response = await Promise.race([ $.http.get({ url: url, node: r, "policy-descriptor": r }), new Promise((_, reject) => setTimeout(() => reject(new Error("timeout-OUTIA")), timeout) ), ]); const data = JSON.parse(response.body); if (data.status === "success") { scriptResourceCache.set(t, data); return data; } else { throw new Error(resdata.message); } } catch (error) { if (reTry < maxRE) { await sleep(GRa()); delog(e.name + "-> [outipApi超时查询次数] " + reTry); return getHttp(reTry + 1); } else { throw error; } } }; const resGet = new Promise((resolve, reject) => { if (cd < 1 && onen) return resGet; getHttp(1) .then((data) => { apiw++; resolve(data); }) .catch(reject); }); oaMap.set(t, resGet); return resGet; };
|
||||
const alMap = new Map(); async function AliD(e) { const ti = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$|^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$/.test( e ); if (ti) return e; const t = getaliid(e); if (alMap.has(t)) return alMap.get(t); const cached = scriptResourceCache.get(t); if (cached) { apiRead++; return cached;} else {inapi++;};const maxRE = 2; let alip = Math.random() < 0.5 ? '223.5.5.5' : '223.6.6.6';const url = `https://${alip}/resolve?name=${e}&type=A&short=1`; const getHttp = async (reTry) => { try { const response = await Promise.race([ $.http.get({ url: url }), new Promise((_, reject) => setTimeout(() => reject(new Error("timeout-AliD")), timeout) ), ]); const resdata = JSON.parse(response.body); if (resdata.length > 0) { scriptResourceCache.set(t, resdata[0]); return resdata[0]; } else { return "keyn"; } } catch (error) { if (reTry < maxRE) { await sleep(GRa()); delog(e + " [->Ali超时查询次数] " + reTry); return getHttp(reTry + 1); } else { throw error; } } }; const resGet = new Promise((resolve, reject) => { if (cd < 1 && onen) { return resGet; } else { getHttp(1) .then((data) => { resolve(data); }) .catch(reject); } }); alMap.set(t, resGet); return resGet; };function getaliid(e){let t="al";return MD5(`${t}-${e}`)};function getspcn(e){let t="sc";return MD5(`${t}-${e}`)};
|
||||
const spMap = new Map(); async function SPEC(e) { const n = getspcn(e); if (spMap.has(n)) return spMap.get(n);const cached = scriptResourceCache.get(n); if (cached) {apiRead++;return cached;} else {inapi++;}; const maxRE = 2; const url = `https://api-v${keyp}${keypr}.cn/ip?ip=${e}`; const getHttp = async (reTry) => { try { const response = await Promise.race([ $.http.get({ url: url }), new Promise((_, reject) => setTimeout(() => reject(new Error("timeout-SPEC")), timeout) ), ]); const resdata = JSON.parse(response.body); delog(resdata); if (resdata.data) { const { country: e, province: o, city: r, isp: i, ip: c, countryCode: k, } = resdata.data; const a = { country: e, regionName: o, city: r, isp: i, ip: c, countryCode: k, }; delog("写入"); scriptResourceCache.set(n, a); return a; } else { throw new Error(resdata.message); } } catch (error) { if (reTry < maxRE) { await sleep(GRa()); delog(e + "-> [SP超时查询次数] " + reTry); return getHttp(reTry + 1); } else { throw error; } } }; const resGet = new Promise((resolve, reject) => {if (cd < 1 && onen) return resGet; getHttp(1) .then((data) => { resolve(data); }) .catch(reject); }); spMap.set(n, resGet); return resGet; };
|
||||
const iaMap = new Map(); async function INIA(e) { const t = getinid(e); if (iaMap.has(t)) return iaMap.get(t); const cached = scriptResourceCache.get(t); if (cached) {apiRead++;return cached;} else {inapi++;}; const maxRE = 2; const url = `http://ip-api.com/json/${e}?lang=zh-CN&fields=status,message,country,city,query,regionName,countryCode`; const getHttp = async (reTry) => { try { delog(url); const response = await Promise.race([ $.http.get({ url: url }), new Promise((_, reject) => setTimeout(() => reject(new Error("timeout-INIA")), timeout) ), ]); const data = JSON.parse(response.body); if (data.status === "success") { scriptResourceCache.set(t, data); return data; } else { throw new Error(resdata.message); } } catch (error) { if (reTry < maxRE) { await sleep(GRa()); delog(e + "-> [inipApi超时查询次数] " + reTry); return getHttp(reTry + 1); } else { throw error; } } }; const resGet = new Promise((resolve, reject) => { if (cd < 1 && onen) return resGet; getHttp(1) .then((data) => { resolve(data); }) .catch(reject); }); iaMap.set(t, resGet); return resGet; } function GRa() { return Math.floor(Math.random() * (500 - 50 + 1) + 50); };
|
||||
function delog(...arg) { if (debug) { console.log("[CNAME] :" + arg); } } function removels(e) { const t = new Set(); const n = []; for (const s of e) { if (s.qc && !t.has(s.qc)) { t.add(s.qc); n.push(s); } } return n; } function removeqc(e) { const t = new Set(); const n = []; for (const s of e) { if (!t.has(s.qc)) { t.add(s.qc); const e = { ...s }; delete e.qc; n.push(e); } } return n; } function jxh(e) { const t = e.reduce((e, t) => { const n = e.find((e) => e.name === t.name); if (n) { n.count++; n.items.push({ ...t, name: `${t.name}${XHFGF}${n.count.toString().padStart(2, "0")}`, }); } else { e.push({ name: t.name, count: 1, items: [{ ...t, name: `${t.name}${XHFGF}01` }], }); } return e; }, []); const n = t.flatMap((e) => e.items); e.splice(0, e.length, ...n); return e; }
|
||||
function onee(e) { const t = e.reduce((e, t) => { const n = t.name.replace(/[^A-Za-z0-9\u00C0-\u017F\u4E00-\u9FFF]+\d+$/, ""); if (!e[n]) { e[n] = []; } e[n].push(t); return e; }, {}); for (const e in t) { if (t[e].length === 1 && t[e][0].name.endsWith("01")) { t[e][0].name= t[e][0].name.replace(/[^.]01/, "") } } return e; }
|
||||
function zhTime(e) { e = e.toString().replace(/-/g, ""); if (e < 1e3) { return `${Math.round(e)}毫秒`; } else if (e < 6e4) { return `${Math.round(e / 1e3)}秒`; } else if (e < 36e5) { return `${Math.round(e / 6e4)}分钟`; } else if (e >= 36e5) { return `${Math.round(e / 36e5)}小时`; } }
|
||||
var MD5=function(e){var t=M(V(Y(X(e),8*e.length)));return t.toLowerCase()};function M(e){for(var t,n="0123456789ABCDEF",s="",o=0;o<e.length;o++)t=e.charCodeAt(o),s+=n.charAt(t>>>4&15)+n.charAt(15&t);return s}function X(e){for(var t=Array(e.length>>2),n=0;n<t.length;n++)t[n]=0;for(n=0;n<8*e.length;n+=8)t[n>>5]|=(255&e.charCodeAt(n/8))<<n%32;return t}function V(e){for(var t="",n=0;n<32*e.length;n+=8)t+=String.fromCharCode(e[n>>5]>>>n%32&255);return t}function Y(e,t){e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;for(var n=1732584193,s=-271733879,o=-1732584194,r=271733878,i=0;i<e.length;i+=16){var c=n,a=s,u=o,m=r;s=md5_ii(s=md5_ii(s=md5_ii(s=md5_ii(s=md5_hh(s=md5_hh(s=md5_hh(s=md5_hh(s=md5_gg(s=md5_gg(s=md5_gg(s=md5_gg(s=md5_ff(s=md5_ff(s=md5_ff(s=md5_ff(s,o=md5_ff(o,r=md5_ff(r,n=md5_ff(n,s,o,r,e[i+0],7,-680876936),s,o,e[i+1],12,-389564586),n,s,e[i+2],17,606105819),r,n,e[i+3],22,-1044525330),o=md5_ff(o,r=md5_ff(r,n=md5_ff(n,s,o,r,e[i+4],7,-176418897),s,o,e[i+5],12,1200080426),n,s,e[i+6],17,-1473231341),r,n,e[i+7],22,-45705983),o=md5_ff(o,r=md5_ff(r,n=md5_ff(n,s,o,r,e[i+8],7,1770035416),s,o,e[i+9],12,-1958414417),n,s,e[i+10],17,-42063),r,n,e[i+11],22,-1990404162),o=md5_ff(o,r=md5_ff(r,n=md5_ff(n,s,o,r,e[i+12],7,1804603682),s,o,e[i+13],12,-40341101),n,s,e[i+14],17,-1502002290),r,n,e[i+15],22,1236535329),o=md5_gg(o,r=md5_gg(r,n=md5_gg(n,s,o,r,e[i+1],5,-165796510),s,o,e[i+6],9,-1069501632),n,s,e[i+11],14,643717713),r,n,e[i+0],20,-373897302),o=md5_gg(o,r=md5_gg(r,n=md5_gg(n,s,o,r,e[i+5],5,-701558691),s,o,e[i+10],9,38016083),n,s,e[i+15],14,-660478335),r,n,e[i+4],20,-405537848),o=md5_gg(o,r=md5_gg(r,n=md5_gg(n,s,o,r,e[i+9],5,568446438),s,o,e[i+14],9,-1019803690),n,s,e[i+3],14,-187363961),r,n,e[i+8],20,1163531501),o=md5_gg(o,r=md5_gg(r,n=md5_gg(n,s,o,r,e[i+13],5,-1444681467),s,o,e[i+2],9,-51403784),n,s,e[i+7],14,1735328473),r,n,e[i+12],20,-1926607734),o=md5_hh(o,r=md5_hh(r,n=md5_hh(n,s,o,r,e[i+5],4,-378558),s,o,e[i+8],11,-2022574463),n,s,e[i+11],16,1839030562),r,n,e[i+14],23,-35309556),o=md5_hh(o,r=md5_hh(r,n=md5_hh(n,s,o,r,e[i+1],4,-1530992060),s,o,e[i+4],11,1272893353),n,s,e[i+7],16,-155497632),r,n,e[i+10],23,-1094730640),o=md5_hh(o,r=md5_hh(r,n=md5_hh(n,s,o,r,e[i+13],4,681279174),s,o,e[i+0],11,-358537222),n,s,e[i+3],16,-722521979),r,n,e[i+6],23,76029189),o=md5_hh(o,r=md5_hh(r,n=md5_hh(n,s,o,r,e[i+9],4,-640364487),s,o,e[i+12],11,-421815835),n,s,e[i+15],16,530742520),r,n,e[i+2],23,-995338651),o=md5_ii(o,r=md5_ii(r,n=md5_ii(n,s,o,r,e[i+0],6,-198630844),s,o,e[i+7],10,1126891415),n,s,e[i+14],15,-1416354905),r,n,e[i+5],21,-57434055),o=md5_ii(o,r=md5_ii(r,n=md5_ii(n,s,o,r,e[i+12],6,1700485571),s,o,e[i+3],10,-1894986606),n,s,e[i+10],15,-1051523),r,n,e[i+1],21,-2054922799),o=md5_ii(o,r=md5_ii(r,n=md5_ii(n,s,o,r,e[i+8],6,1873313359),s,o,e[i+15],10,-30611744),n,s,e[i+6],15,-1560198380),r,n,e[i+13],21,1309151649),o=md5_ii(o,r=md5_ii(r,n=md5_ii(n,s,o,r,e[i+4],6,-145523070),s,o,e[i+11],10,-1120210379),n,s,e[i+2],15,718787259),r,n,e[i+9],21,-343485551),n=safe_add(n,c),s=safe_add(s,a),o=safe_add(o,u),r=safe_add(r,m)}return Array(n,s,o,r)}function md5_cmn(e,t,n,s,o,r){return safe_add(bit_rol(safe_add(safe_add(t,e),safe_add(s,r)),o),n)}function md5_ff(e,t,n,s,o,r,i){return md5_cmn(t&n|~t&s,e,t,o,r,i)}function md5_gg(e,t,n,s,o,r,i){return md5_cmn(t&s|n&~s,e,t,o,r,i)}function md5_hh(e,t,n,s,o,r,i){return md5_cmn(t^n^s,e,t,o,r,i)}function md5_ii(e,t,n,s,o,r,i){return md5_cmn(n^(t|~s),e,t,o,r,i)}function safe_add(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function bit_rol(e,t){return e<<t|e>>>32-t}function getid(e){let t="ld";return MD5(`${t}-${e.server}-${e.port}`)}function getinid(e){let t="ia";return MD5(`${t}-${e}`)};
|
||||
177
Scripts/SubStore/rename_simple.js
Normal file
177
Scripts/SubStore/rename_simple.js
Normal file
@ -0,0 +1,177 @@
|
||||
//############################################
|
||||
// 脚本作者:@奶茶姐 感谢@key,@sub-store-org
|
||||
// 重要提示:无缓存版本可能会出现超时现象,建议上传至gist后订阅gist链接
|
||||
// 脚本地址:https://github.com/fmz200/wool_scripts/raw/main/Scripts/SubStore/rename_simple.js
|
||||
// 脚本作用:在SubStore内对节点重命名,排序,去除ping失败的节点
|
||||
// 使用方法:SubStore内选择“脚本操作”,然后填写上面的脚本地址
|
||||
// 支持平台:✅Loon,✅Surge,❌QuanX(待QX开发者支持),❌Stash(待开发者支持),❌ShadowRocket(待开发者支持)
|
||||
// 更新时间:2023.05.07 20:25
|
||||
//############################################
|
||||
|
||||
const $ = $substore;
|
||||
const DELIMITER = "|"; // 分隔符
|
||||
const {isLoon, isSurge, isQX} = $substore.env;
|
||||
// 节点转换的目标类型
|
||||
const target = isLoon ? "Loon" : isSurge ? "Surge" : isQX ? "QX" : undefined;
|
||||
// 判断传入超时 值,单位:ms
|
||||
const timeout = $arguments['timeout'] ? $arguments['timeout'] : 5000;
|
||||
// argument传入 flag 时候,添加国旗
|
||||
const flag = $arguments['flag'];
|
||||
// 每一次处理的节点个数
|
||||
const batch_size = $arguments['batch']? $arguments['batch'] : 10;
|
||||
|
||||
async function operator(proxies) {
|
||||
const startTime = new Date(); // 获取当前时间作为开始时间
|
||||
console.log("✅💕初始节点个数 = " + proxies.length);
|
||||
console.log("✅💕节点超时时间 = " + timeout);
|
||||
console.log("✅💕批处理的节点个数 = " + batch_size);
|
||||
// console.log("✅💕去重前的节点信息 = " + JSON.stringify(proxies));
|
||||
|
||||
const support = (isLoon || (isSurge && parseInt($environment['surge-build']) >= 2000));
|
||||
if (!support) {
|
||||
$.error(`🚫该脚本只支持Loon、Surge,其他平台待开发者支持!`);
|
||||
return proxies;
|
||||
}
|
||||
|
||||
let i = 0;
|
||||
while (i < proxies.length) {
|
||||
const batch = proxies.slice(i, i + batch_size);
|
||||
await Promise.allSettled(batch.map(async proxy => {
|
||||
try {
|
||||
// 查询入口IP信息
|
||||
const in_info = await queryInInfo(proxy.server);
|
||||
// console.log(proxy.server + "✅💕in节点信息 = " + JSON.stringify(in_info));
|
||||
|
||||
// 查询出口IP信息
|
||||
const out_info = await queryOutInfo(proxy);
|
||||
// console.log(proxy.server + "✅💕out节点信息 = " + JSON.stringify(out_info));
|
||||
|
||||
// 节点重命名为:旗帜|策略|序号
|
||||
const type = in_info.data === out_info.query ? "直连" : "中转";
|
||||
proxy.name = getFlagEmoji(out_info.countryCode) + DELIMITER + type + "→" + out_info.country;
|
||||
|
||||
// 新增一个去重用字段,该字段重复就是重复节点:入口IP|出口IP,无此字段表示ping失败
|
||||
proxy.qc = in_info.data + DELIMITER + out_info.query;
|
||||
proxy.px = out_info.countryCode;
|
||||
} catch (err) {
|
||||
console.log(`⚠️while err = ${err}`);
|
||||
}
|
||||
}));
|
||||
|
||||
// await sleep(300);
|
||||
i += batch_size;
|
||||
}
|
||||
// console.log("💰💕去重前的节点信息 = " + JSON.stringify(proxies));
|
||||
// 去除重复的节点,排序,再加个序号
|
||||
proxies = rmDupNameAndGroupAndEnumerate(proxies);
|
||||
// console.log("✅💕去重后的节点信息 = " + JSON.stringify(proxies));
|
||||
console.log(`✅💕去重后的节点个数 = ${proxies.length}`);
|
||||
|
||||
const endTime = new Date(); // 获取当前时间作为结束时间
|
||||
const timeDiff = endTime.getTime() - startTime.getTime(); // 获取时间差(以毫秒为单位)
|
||||
console.log(`✅💕方法总耗时: ${timeDiff / 1000} seconds`); // 将时间差转换为秒并打印到控制台上
|
||||
|
||||
return proxies;
|
||||
}
|
||||
|
||||
// 查询入口 阿里dns
|
||||
async function queryInInfo(server) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = {data: server};
|
||||
const url = `http://223.5.5.5/resolve?name=${server}`;
|
||||
$.http.get({
|
||||
url
|
||||
}).then(resp => {
|
||||
const body = JSON.parse(resp.body);
|
||||
if (body.Status === 0) {
|
||||
// Status: 0,成功,返回最下面的ip
|
||||
resolve(body.Answer[body.Answer.length - 1]);
|
||||
} else {
|
||||
resolve(data);
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("⚠️In err = " + err);
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function queryOutInfo(proxy) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = `http://ip-api.com/json?lang=zh-CN&fields=status,message,country,countryCode,city,query`;
|
||||
let node = ProxyUtils.produce([proxy], target);
|
||||
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error("请求超时"));
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
const queryPromise =
|
||||
$.http.get({
|
||||
url,
|
||||
opts: {policy: node}, // QX的写法,目前QX本身不支持
|
||||
node: node, // Loon,Surge IOS
|
||||
"policy-descriptor": node // Surge MAC
|
||||
}).then(resp => {
|
||||
const body = JSON.parse(resp.body);
|
||||
if (body.status === "success") {
|
||||
resolve(body);
|
||||
} else {
|
||||
reject(new Error(body.message));
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
// 超时处理
|
||||
Promise.race([timeoutPromise, queryPromise])
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getFlagEmoji(countryCode) {
|
||||
const codePoints = countryCode
|
||||
.toUpperCase()
|
||||
.split('')
|
||||
.map(char => 127397 + char.charCodeAt());
|
||||
return String
|
||||
.fromCodePoint(...codePoints)
|
||||
.replace(/🇹🇼/g, '🇨🇳');
|
||||
}
|
||||
|
||||
function rmDupNameAndGroupAndEnumerate(arr) {
|
||||
// 去重
|
||||
const nameSet = new Set();
|
||||
const result = [];
|
||||
for (const e of arr) {
|
||||
if (e.qc && !nameSet.has(e.qc)) {
|
||||
nameSet.add(e.qc);
|
||||
result.push(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 将对象按照 sort 属性分组
|
||||
const groups = result.reduce((result, item) => {
|
||||
const key = item.px;
|
||||
if (!result[key]) {
|
||||
result[key] = [];
|
||||
}
|
||||
result[key].push(item);
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
// 给每个分组中的对象的 name 属性加上两位数序号
|
||||
for (const groupKey in groups) {
|
||||
if (groups.hasOwnProperty(groupKey)) {
|
||||
const group = groups[groupKey];
|
||||
group.forEach((item, index) => {
|
||||
item.name = `${item.name}${DELIMITER}${index < 9 ? '0' : ''}${index + 1}`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 将修改后的集合返回
|
||||
return Object.values(groups).flat();
|
||||
}
|
||||
174
Scripts/SubStore/rename_simple_dev.js
Normal file
174
Scripts/SubStore/rename_simple_dev.js
Normal file
@ -0,0 +1,174 @@
|
||||
//############################################
|
||||
// 脚本作者:@奶茶姐 感谢@key,@sub-store-org
|
||||
// 重要提示:该脚本是测试脚本,请使用 https://github.com/fmz200/wool_scripts/raw/main/Scripts/SubStore/rename_simple.js
|
||||
// 脚本地址:https://github.com/fmz200/wool_scripts/raw/main/Scripts/SubStore/rename_simple_dev.js
|
||||
// 脚本作用:在SubStore内对节点重命名,排序,去除ping失败的节点
|
||||
// 使用方法:SubStore内选择“脚本操作”,然后填写上面的脚本地址
|
||||
// 支持平台:✅Loon,✅Surge,❌QuanX(待开发者支持),❌Stash(待开发者支持),❌ShadowRocket(待开发者支持)
|
||||
// 更新时间:2023.05.07 20:25
|
||||
//############################################
|
||||
|
||||
const $ = $substore;
|
||||
const DELIMITER = "|"; // 分隔符
|
||||
const {isLoon, isSurge, isQX} = $substore.env;
|
||||
// 节点转换的目标类型
|
||||
const target = isLoon ? "Loon" : isSurge ? "Surge" : isQX ? "QX" : undefined;
|
||||
// 判断传入超时 值,单位:ms
|
||||
const timeout = $arguments['timeout'] ? $arguments['timeout'] : 5000;
|
||||
// argument传入 flag 时候,添加国旗
|
||||
const flag = $arguments['flag'];
|
||||
// 每一次处理的节点个数
|
||||
const batch_size = $arguments['batch'] ? $arguments['batch'] : 10;
|
||||
|
||||
async function operator(proxies) {
|
||||
const startTime = new Date(); // 获取当前时间作为开始时间
|
||||
const server_count = proxies.length;
|
||||
console.log("✅💕去重前节点个数 = " + server_count);
|
||||
console.log("✅💕节点超时时间 = " + timeout);
|
||||
console.log("✅💕批处理节点个数 = " + batch_size);
|
||||
// console.log("✅💕$environment = " + JSON.stringify($environment));
|
||||
// console.log("✅💕$arguments = " + JSON.stringify($arguments));
|
||||
// console.log("✅💕去重前的节点信息 = " + JSON.stringify(proxies));
|
||||
|
||||
const support = (isLoon || (isSurge && parseInt($environment['surge-build']) >= 2000));
|
||||
if (!support) {
|
||||
$.error(`🚫该脚本只支持Loon、Surge,其他平台待开发者支持!`);
|
||||
return proxies;
|
||||
}
|
||||
|
||||
await Promise.allSettled(proxies.map(async proxy => {
|
||||
try {
|
||||
// 查询入口IP信息
|
||||
const in_info = await queryInInfo(proxy.server);
|
||||
// console.log(proxy.server + "✅💕in节点信息 = " + JSON.stringify(in_info));
|
||||
|
||||
// 查询出口IP信息
|
||||
const out_info = await queryOutInfo(proxy);
|
||||
// console.log(proxy.server + "✅💕out节点信息 = " + JSON.stringify(out_info));
|
||||
|
||||
// 节点重命名为:旗帜|策略|序号
|
||||
const type = in_info.data === out_info.query ? "直连" : "中转";
|
||||
proxy.name = getFlagEmoji(out_info.countryCode) + DELIMITER + type + "→" + out_info.country;
|
||||
|
||||
// 新增一个去重用字段,该字段重复就是重复节点:入口IP|出口IP,无此字段表示ping失败
|
||||
proxy.qc = in_info.data + DELIMITER + out_info.query;
|
||||
proxy.px = out_info.countryCode;
|
||||
} catch (err) {
|
||||
console.log(`⚠️while err = ${err}`);
|
||||
}
|
||||
}));
|
||||
|
||||
// 去除重复的节点,排序,再加个序号
|
||||
proxies = rmDupNameAndGroupAndEnumerate(proxies);
|
||||
// console.log("✅💕去重后的节点信息 = " + JSON.stringify(proxies));
|
||||
console.log(`✅💕去重后节点个数 = ${proxies.length},共去除 ${server_count - proxies.length} 个节点`);
|
||||
|
||||
const endTime = new Date(); // 获取当前时间作为结束时间
|
||||
const timeDiff = endTime.getTime() - startTime.getTime(); // 获取时间差(以毫秒为单位)
|
||||
console.log(`✅💕脚本运行总耗时: ${timeDiff / 1000} seconds`); // 将时间差转换为秒并打印到控制台上
|
||||
|
||||
return proxies;
|
||||
}
|
||||
|
||||
// 查询入口 阿里dns
|
||||
async function queryInInfo(server) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = {data: server};
|
||||
const url = `http://223.5.5.5/resolve?name=${server}`;
|
||||
$.http.get({
|
||||
url
|
||||
}).then(resp => {
|
||||
const body = JSON.parse(resp.body);
|
||||
if (body.Status === 0) {
|
||||
// Status: 0,成功,返回最下面的ip
|
||||
resolve(body.Answer[body.Answer.length - 1]);
|
||||
} else {
|
||||
resolve(data);
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("⚠️In err = " + err);
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function queryOutInfo(proxy) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = `http://ip-api.com/json?lang=zh-CN&fields=status,message,country,countryCode,city,query`;
|
||||
let node = ProxyUtils.produce([proxy], target);
|
||||
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error("请求超时"));
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
const queryPromise =
|
||||
$.http.get({
|
||||
url,
|
||||
opts: {policy: node}, // QX的写法,目前QX本身不支持
|
||||
node: node, // Loon,Surge IOS
|
||||
"policy-descriptor": node, // Surge MAC
|
||||
// timeout: 2000, // 请求超时,单位ms,默认5000ms
|
||||
}).then(resp => {
|
||||
const body = JSON.parse(resp.body);
|
||||
if (body.status === "success") {
|
||||
resolve(body);
|
||||
} else {
|
||||
reject(new Error(body.message));
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
// 超时处理
|
||||
Promise.race([timeoutPromise, queryPromise])
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getFlagEmoji(countryCode) {
|
||||
const codePoints = countryCode
|
||||
.toUpperCase()
|
||||
.split('')
|
||||
.map(char => 127397 + char.charCodeAt());
|
||||
return String
|
||||
.fromCodePoint(...codePoints)
|
||||
.replace(/🇹🇼/g, '🇨🇳');
|
||||
}
|
||||
|
||||
function rmDupNameAndGroupAndEnumerate(arr) {
|
||||
// 去重
|
||||
const nameSet = new Set();
|
||||
const result = [];
|
||||
for (const e of arr) {
|
||||
if (e.qc && !nameSet.has(e.qc)) {
|
||||
nameSet.add(e.qc);
|
||||
result.push(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 将对象按照 sort 属性分组
|
||||
const groups = result.reduce((result, item) => {
|
||||
const key = item.px;
|
||||
if (!result[key]) {
|
||||
result[key] = [];
|
||||
}
|
||||
result[key].push(item);
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
// 给每个分组中的对象的 name 属性加上两位数序号
|
||||
for (const groupKey in groups) {
|
||||
if (groups.hasOwnProperty(groupKey)) {
|
||||
const group = groups[groupKey];
|
||||
group.forEach((item, index) => {
|
||||
item.name = `${item.name}${DELIMITER}${index < 9 ? '0' : ''}${index + 1}`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 将修改后的集合返回
|
||||
return Object.values(groups).flat();
|
||||
}
|
||||
275
Scripts/SubStore/server_rename.js
Normal file
275
Scripts/SubStore/server_rename.js
Normal file
@ -0,0 +1,275 @@
|
||||
//############################################
|
||||
// 脚本作者:@奶茶姐 感谢@key,@sub-store-org
|
||||
// 原始地址:https://github.com/sub-store-org/Sub-Store/blob/master/scripts/ip-flag.js
|
||||
// 脚本地址:https://github.com/fmz200/wool_scripts/raw/main/Scripts/SubStore/server_rename.js
|
||||
// 脚本作用:在SubStore内对节点重命名为:旗帜|地区代码|地区名称|IP|序号,
|
||||
// 使用方法:SubStore内选择“脚本操作”,然后填写上面的脚本地址
|
||||
// 支持平台:✅Loon,✅Surge,❌QuanX(待开发者支持),❌Stash(待开发者支持),❌ShadowRocket(待开发者支持)
|
||||
// 更新时间:2023.05.07 20:25
|
||||
//############################################
|
||||
|
||||
const RESOURCE_CACHE_KEY = '#sub-store-cached-resource';
|
||||
const CACHE_EXPIRATION_TIME_MS = 10 * 60 * 1000;
|
||||
const $ = $substore;
|
||||
|
||||
class ResourceCache {
|
||||
constructor(expires) {
|
||||
this.expires = expires;
|
||||
const cachedData = $.read(RESOURCE_CACHE_KEY);
|
||||
if (!cachedData) {
|
||||
this.resourceCache = {};
|
||||
this._persist();
|
||||
} else {
|
||||
this.resourceCache = JSON.parse(cachedData);
|
||||
}
|
||||
this._cleanup();
|
||||
}
|
||||
|
||||
_cleanup() {
|
||||
// clear obsolete cached resource
|
||||
let clear = false;
|
||||
const now = new Date().getTime();
|
||||
Object.keys(this.resourceCache).forEach((id) => {
|
||||
const updated = this.resourceCache[id];
|
||||
if (!updated.time || now - updated.time > this.expires) {
|
||||
delete this.resourceCache[id];
|
||||
$.delete(`#${id}`);
|
||||
clear = true;
|
||||
}
|
||||
});
|
||||
if (clear) this._persist();
|
||||
}
|
||||
|
||||
revokeAll() {
|
||||
this.resourceCache = {};
|
||||
this._persist();
|
||||
}
|
||||
|
||||
_persist() {
|
||||
$.write(JSON.stringify(this.resourceCache), RESOURCE_CACHE_KEY);
|
||||
}
|
||||
|
||||
get(id) {
|
||||
const updated = this.resourceCache[id] && this.resourceCache[id].time;
|
||||
if (updated && new Date().getTime() - updated <= this.expires) {
|
||||
return this.resourceCache[id].data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
set(id, value) {
|
||||
this.resourceCache[id] = {time: new Date().getTime(), data: value}
|
||||
this._persist();
|
||||
}
|
||||
}
|
||||
|
||||
const resourceCache = new ResourceCache(CACHE_EXPIRATION_TIME_MS);
|
||||
// let nodes = [];
|
||||
const DELIMITER = "|"; // 分隔符
|
||||
|
||||
const {isLoon, isSurge, isQX} = $substore.env;
|
||||
|
||||
let target; // 节点转换的目标类型
|
||||
if (isLoon) {
|
||||
target = "Loon";
|
||||
} else if (isSurge) {
|
||||
target = "Surge";
|
||||
} else if (isQX) {
|
||||
target = "QX";
|
||||
}
|
||||
|
||||
async function operator(proxies) {
|
||||
// console.log("✅💕proxies = " + JSON.stringify(proxies));
|
||||
console.log("✅💕初始节点个数 = " + proxies.length);
|
||||
// $.write(JSON.stringify(proxies), "#sub-store-proxies");
|
||||
|
||||
let support = false;
|
||||
if (isLoon || isQX) {
|
||||
support = true;
|
||||
} else if (isSurge) {
|
||||
const build = $environment['surge-build'];
|
||||
if (build && parseInt(build) >= 2407) {
|
||||
support = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!support) {
|
||||
$.error(`🚫该脚本只支持Loon、Surge,其他平台待开发者支持!`);
|
||||
return proxies;
|
||||
}
|
||||
|
||||
const BATCH_SIZE = 10; // 每一次处理的节点个数
|
||||
let i = 0;
|
||||
while (i < proxies.length) {
|
||||
const batch = proxies.slice(i, i + BATCH_SIZE);
|
||||
await Promise.allSettled(batch.map(async proxy => {
|
||||
try {
|
||||
// 这里最理想的处理方式是只把节点名字中的旗帜和地区名字删除,但保留其他信息
|
||||
// 例如:[🇭🇰香港 专线|3倍率] 只保留👉🏻 [专线|3倍率]
|
||||
// 最后节点重命名为:旗帜|地区代码|地区名称|ip|其他信息
|
||||
// 例如:[🇺🇸|US|美国|1.2.3.4|专线|3倍率]
|
||||
|
||||
// remove the original flag 移除旗帜
|
||||
// let proxyName = removeFlag(proxy.name);
|
||||
// 本来想把原来的标签加上删除线或者下划线,但是实现不了
|
||||
// query ip-api
|
||||
const code_name = await queryIpApi(proxy);
|
||||
// 地区代码|地区名称|IP
|
||||
const countryCode = code_name.substring(0, code_name.indexOf(DELIMITER));
|
||||
// 节点重命名为:旗帜|地区代码|地区名称|IP|序号
|
||||
proxy.name = getFlagEmoji(countryCode) + DELIMITER + code_name;
|
||||
} catch (err) {
|
||||
console.log(`✅💕err=${err}`);
|
||||
}
|
||||
}));
|
||||
|
||||
await sleep(1000);
|
||||
i += BATCH_SIZE;
|
||||
}
|
||||
// 去除重复的节点
|
||||
// 直接写proxies = removeDuplicateName(proxies);不生效
|
||||
proxies = removeDuplicateName(proxies);
|
||||
console.log(`✅💕去重后的节点个数 = ${proxies.length}`);
|
||||
// 再加个序号
|
||||
for (let j = 0; j < proxies.length; j++) {
|
||||
const index = (j + 1).toString().padStart(2, '0');
|
||||
proxies[j].name = proxies[j].name + DELIMITER + index;
|
||||
}
|
||||
|
||||
// $.write(JSON.stringify(nodes), "#sub-store-nodes");
|
||||
return proxies;
|
||||
}
|
||||
|
||||
// JS数组中去除重复元素
|
||||
function removeDuplicatesItem(arr) {
|
||||
return Array.from(new Set(arr));
|
||||
}
|
||||
|
||||
// 根据节点名字去除重复的节点
|
||||
function removeDuplicateName(arr) {
|
||||
const nameSet = new Set();
|
||||
const result = [];
|
||||
for (const e of arr) {
|
||||
if (!nameSet.has(e.name)) {
|
||||
result.push(e);
|
||||
nameSet.add(e.name);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 假设你有一个包含对象的数组,每个对象中有多个属性,你想根据其中的某一个或多个属性去除重复的元素并返回一个新数组。
|
||||
* 示例用法:
|
||||
* const arr = [
|
||||
* { name: "John", age: 30, country: "USA" },
|
||||
* { name: "Jane", age: 25, country: "Canada" },
|
||||
* { name: "John", age: 40, country: "USA" },
|
||||
* { name: "Bob", age: 50, country: "UK" },
|
||||
* ];
|
||||
* const uniqueArr = removeDuplicates(arr, ["name", "country"]);
|
||||
* console.log(uniqueArr); // 输出 [{ name: "John", age: 30, country: "USA" }, { name: "Jane", age: 25, country: "Canada" }, { name: "Bob", age: 50, country: "UK" }]
|
||||
*
|
||||
* @param arr 一个对象数组
|
||||
* @param fields 一个字段名数组,表示根据哪些属性去除重复的元素
|
||||
* @returns {*}
|
||||
*/
|
||||
function removeDuplicates(arr, fields) {
|
||||
const map = new Map();
|
||||
return arr.filter(item => {
|
||||
const key = fields.map(field => item[field]).join("-");
|
||||
if (map.has(key)) {
|
||||
return false;
|
||||
} else {
|
||||
map.set(key, true);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const tasks = new Map();
|
||||
|
||||
async function queryIpApi(proxy) {
|
||||
// 如果节点的server和port一样就认为是重复的,这里就不会去重新请求而是直接返回
|
||||
const id = getId(proxy);
|
||||
if (tasks.has(id)) {
|
||||
return tasks.get(id);
|
||||
}
|
||||
|
||||
const ua = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:78.0) Gecko/20100101 Firefox/78.0";
|
||||
const headers = {
|
||||
"User-Agent": ua
|
||||
};
|
||||
|
||||
const result = new Promise((resolve, reject) => {
|
||||
const cached = resourceCache.get(id);
|
||||
if (cached) {
|
||||
resolve(cached);
|
||||
}
|
||||
// http://ip-api.com/json/24.48.0.1?lang=zh-CN
|
||||
const url = `http://ip-api.com/json?lang=zh-CN`;
|
||||
let node = ProxyUtils.produce([proxy], target);
|
||||
|
||||
// Loon 需要去掉节点名字
|
||||
if (isLoon) {
|
||||
const s = node.indexOf("=");
|
||||
node = node.substring(s + 1);
|
||||
}
|
||||
// nodes.push(node);
|
||||
|
||||
// QX只要tag的名字,目前QX不支持
|
||||
const QXTag = node.substring(node.lastIndexOf("=") + 1);
|
||||
const opts = {
|
||||
policy: QXTag
|
||||
};
|
||||
|
||||
$.http.get({
|
||||
url,
|
||||
headers,
|
||||
opts: opts, // QX的写法
|
||||
node: node
|
||||
}).then(resp => {
|
||||
const body = resp.body;
|
||||
const data = JSON.parse(body);
|
||||
if (data.status === "success") {
|
||||
// 地区代码|地区名称|IP :SG|新加坡|13.215.162.99
|
||||
const nodeInfo = data.countryCode + DELIMITER + data.country + DELIMITER + data.query;
|
||||
resourceCache.set(id, nodeInfo);
|
||||
resolve(nodeInfo);
|
||||
} else {
|
||||
reject(new Error(data.message));
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("💕err =" + err);
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
tasks.set(id, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
function getId(proxy) {
|
||||
return MD5(`IP-FLAG-${proxy.server}-${proxy.port}`);
|
||||
}
|
||||
|
||||
function getFlagEmoji(countryCode) {
|
||||
const codePoints = countryCode
|
||||
.toUpperCase()
|
||||
.split('')
|
||||
.map(char => 127397 + char.charCodeAt());
|
||||
return String
|
||||
.fromCodePoint(...codePoints)
|
||||
.replace(/🇹🇼/g, '🇨🇳');
|
||||
}
|
||||
|
||||
function removeFlag(str) {
|
||||
return str
|
||||
.replace(/[\uD83C][\uDDE6-\uDDFF][\uD83C][\uDDE6-\uDDFF]/g, '')
|
||||
.trim();
|
||||
}
|
||||
|
||||
function sleep(ms) {
|
||||
return new Promise((resolve) => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
var MD5 = function (d) { var r = M(V(Y(X(d), 8 * d.length))); return r.toLowerCase() }; function M(d) { for (var _, m = "0123456789ABCDEF", f = "", r = 0; r < d.length; r++)_ = d.charCodeAt(r), f += m.charAt(_ >>> 4 & 15) + m.charAt(15 & _); return f } function X(d) { for (var _ = Array(d.length >> 2), m = 0; m < _.length; m++)_[m] = 0; for (m = 0; m < 8 * d.length; m += 8)_[m >> 5] |= (255 & d.charCodeAt(m / 8)) << m % 32; return _ } function V(d) { for (var _ = "", m = 0; m < 32 * d.length; m += 8)_ += String.fromCharCode(d[m >> 5] >>> m % 32 & 255); return _ } function Y(d, _) { d[_ >> 5] |= 128 << _ % 32, d[14 + (_ + 64 >>> 9 << 4)] = _; for (var m = 1732584193, f = -271733879, r = -1732584194, i = 271733878, n = 0; n < d.length; n += 16) { var h = m, t = f, g = r, e = i; f = md5_ii(f = md5_ii(f = md5_ii(f = md5_ii(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_ff(f = md5_ff(f = md5_ff(f = md5_ff(f, r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 0], 7, -680876936), f, r, d[n + 1], 12, -389564586), m, f, d[n + 2], 17, 606105819), i, m, d[n + 3], 22, -1044525330), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 4], 7, -176418897), f, r, d[n + 5], 12, 1200080426), m, f, d[n + 6], 17, -1473231341), i, m, d[n + 7], 22, -45705983), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 8], 7, 1770035416), f, r, d[n + 9], 12, -1958414417), m, f, d[n + 10], 17, -42063), i, m, d[n + 11], 22, -1990404162), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 12], 7, 1804603682), f, r, d[n + 13], 12, -40341101), m, f, d[n + 14], 17, -1502002290), i, m, d[n + 15], 22, 1236535329), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 1], 5, -165796510), f, r, d[n + 6], 9, -1069501632), m, f, d[n + 11], 14, 643717713), i, m, d[n + 0], 20, -373897302), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 5], 5, -701558691), f, r, d[n + 10], 9, 38016083), m, f, d[n + 15], 14, -660478335), i, m, d[n + 4], 20, -405537848), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 9], 5, 568446438), f, r, d[n + 14], 9, -1019803690), m, f, d[n + 3], 14, -187363961), i, m, d[n + 8], 20, 1163531501), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 13], 5, -1444681467), f, r, d[n + 2], 9, -51403784), m, f, d[n + 7], 14, 1735328473), i, m, d[n + 12], 20, -1926607734), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 5], 4, -378558), f, r, d[n + 8], 11, -2022574463), m, f, d[n + 11], 16, 1839030562), i, m, d[n + 14], 23, -35309556), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 1], 4, -1530992060), f, r, d[n + 4], 11, 1272893353), m, f, d[n + 7], 16, -155497632), i, m, d[n + 10], 23, -1094730640), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 13], 4, 681279174), f, r, d[n + 0], 11, -358537222), m, f, d[n + 3], 16, -722521979), i, m, d[n + 6], 23, 76029189), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 9], 4, -640364487), f, r, d[n + 12], 11, -421815835), m, f, d[n + 15], 16, 530742520), i, m, d[n + 2], 23, -995338651), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 0], 6, -198630844), f, r, d[n + 7], 10, 1126891415), m, f, d[n + 14], 15, -1416354905), i, m, d[n + 5], 21, -57434055), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 12], 6, 1700485571), f, r, d[n + 3], 10, -1894986606), m, f, d[n + 10], 15, -1051523), i, m, d[n + 1], 21, -2054922799), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 8], 6, 1873313359), f, r, d[n + 15], 10, -30611744), m, f, d[n + 6], 15, -1560198380), i, m, d[n + 13], 21, 1309151649), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 4], 6, -145523070), f, r, d[n + 11], 10, -1120210379), m, f, d[n + 2], 15, 718787259), i, m, d[n + 9], 21, -343485551), m = safe_add(m, h), f = safe_add(f, t), r = safe_add(r, g), i = safe_add(i, e) } return Array(m, f, r, i) } function md5_cmn(d, _, m, f, r, i) { return safe_add(bit_rol(safe_add(safe_add(_, d), safe_add(f, i)), r), m) } function md5_ff(d, _, m, f, r, i, n) { return md5_cmn(_ & m | ~_ & f, d, _, r, i, n) } function md5_gg(d, _, m, f, r, i, n) { return md5_cmn(_ & f | m & ~f, d, _, r, i, n) } function md5_hh(d, _, m, f, r, i, n) { return md5_cmn(_ ^ m ^ f, d, _, r, i, n) } function md5_ii(d, _, m, f, r, i, n) { return md5_cmn(m ^ (_ | ~f), d, _, r, i, n) } function safe_add(d, _) { var m = (65535 & d) + (65535 & _); return (d >> 16) + (_ >> 16) + (m >> 16) << 16 | 65535 & m } function bit_rol(d, _) { return d << _ | d >>> 32 - _ }
|
||||
252
Scripts/SubStore/server_rename_dev.js
Normal file
252
Scripts/SubStore/server_rename_dev.js
Normal file
@ -0,0 +1,252 @@
|
||||
//############################################
|
||||
// 脚本作者:@奶茶姐 感谢@key,@sub-store-org
|
||||
// 重要提示:该脚本是测试脚本,请使用 https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/rename_simple.js
|
||||
// 脚本地址:https://github.com/fmz200/wool_scripts/raw/main/Scripts/SubStore/server_rename_dev.js
|
||||
// 脚本作用:在SubStore内对节点重命名,并去除ping失败的节点
|
||||
// 使用方法:SubStore内选择“脚本操作”,然后填写上面的脚本地址
|
||||
// 支持平台:✅Loon,✅Surge,❌QuanX(待开发者支持),❌Stash(待开发者支持),❌ShadowRocket(待开发者支持)
|
||||
// 更新时间:2023.05.07 20:25
|
||||
//############################################
|
||||
|
||||
const RESOURCE_CACHE_KEY = '#sub-store-cached-resource';
|
||||
const CACHE_EXPIRATION_TIME_MS = 10 * 60 * 1000;
|
||||
const $ = $substore;
|
||||
|
||||
class ResourceCache {
|
||||
constructor(expires) {
|
||||
this.expires = expires;
|
||||
const cachedData = $.read(RESOURCE_CACHE_KEY);
|
||||
if (!cachedData) {
|
||||
this.resourceCache = {};
|
||||
this._persist();
|
||||
} else {
|
||||
this.resourceCache = JSON.parse(cachedData);
|
||||
}
|
||||
this._cleanup();
|
||||
}
|
||||
|
||||
_cleanup() {
|
||||
// clear obsolete cached resource
|
||||
let clear = false;
|
||||
const now = new Date().getTime();
|
||||
Object.keys(this.resourceCache).forEach((id) => {
|
||||
const updated = this.resourceCache[id];
|
||||
if (!updated.time || now - updated.time > this.expires) {
|
||||
delete this.resourceCache[id];
|
||||
$.delete(`#${id}`);
|
||||
clear = true;
|
||||
}
|
||||
});
|
||||
if (clear) this._persist();
|
||||
}
|
||||
|
||||
revokeAll() {
|
||||
this.resourceCache = {};
|
||||
this._persist();
|
||||
}
|
||||
|
||||
_persist() {
|
||||
$.write(JSON.stringify(this.resourceCache), RESOURCE_CACHE_KEY);
|
||||
}
|
||||
|
||||
get(id) {
|
||||
const updated = this.resourceCache[id] && this.resourceCache[id].time;
|
||||
if (updated && new Date().getTime() - updated <= this.expires) {
|
||||
return this.resourceCache[id].data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
set(id, value) {
|
||||
this.resourceCache[id] = {time: new Date().getTime(), data: value}
|
||||
this._persist();
|
||||
}
|
||||
}
|
||||
|
||||
const resourceCache = new ResourceCache(CACHE_EXPIRATION_TIME_MS);
|
||||
|
||||
const DELIMITER = "|"; // 分隔符
|
||||
const {isLoon, isSurge, isQX, isNode, isStash, isShadowRocket} = $substore.env;
|
||||
// 节点转换的目标类型
|
||||
const target = isLoon ? "Loon" : isSurge ? "Surge" : isQX ? "QX" : undefined;
|
||||
// 判断传入超时 值,单位:ms
|
||||
const timeout = $arguments['timeout'] ? $arguments['timeout'] : 5000;
|
||||
// argument传入 flag 时候,添加国旗
|
||||
const flag = $arguments['flag'];
|
||||
// 每一次处理的节点个数
|
||||
const batch_size = $arguments['batch']? $arguments['batch'] : 10;
|
||||
|
||||
async function operator(proxies) {
|
||||
const startTime = new Date(); // 获取当前时间作为开始时间
|
||||
console.log("✅💕初始节点个数 = " + proxies.length);
|
||||
console.log("✅💕节点超时时间 = " + timeout);
|
||||
console.log("✅💕批处理的节点个数 = " + batch_size);
|
||||
// console.log("✅💕去重前的节点信息 = " + JSON.stringify(proxies));
|
||||
|
||||
const support = (isLoon || (isSurge && parseInt($environment['surge-build']) >= 2000));
|
||||
if (!support) {
|
||||
$.error(`🚫该脚本只支持Loon、Surge,其他平台待开发者支持!`);
|
||||
// $notify("♥♥重命名脚本只支持Loon 和 Surge!", "不支持01", "不支持02");
|
||||
return proxies;
|
||||
}
|
||||
|
||||
let i = 0;
|
||||
while (i < proxies.length) {
|
||||
const batch = proxies.slice(i, i + batch_size);
|
||||
await Promise.allSettled(batch.map(async proxy => {
|
||||
try {
|
||||
// 查询入口IP信息
|
||||
const in_info = await queryInInfo(proxy.server);
|
||||
// console.log(proxy.server + "✅💕in节点信息 = " + JSON.stringify(in_info));
|
||||
|
||||
// 查询出口IP信息
|
||||
const out_info = await queryOutInfo(proxy);
|
||||
// console.log(proxy.server + "✅💕out节点信息 = " + JSON.stringify(out_info));
|
||||
|
||||
// 节点重命名为:旗帜|策略|序号
|
||||
const type = in_info.data === out_info.query ? "直连" : "中转";
|
||||
proxy.name = getFlagEmoji(out_info.countryCode) + DELIMITER + type + "→" + out_info.country;
|
||||
|
||||
// 新增一个去重用字段,该字段重复就是重复节点:入口IP|出口IP,无此字段表示ping失败
|
||||
proxy.qc = in_info.data + DELIMITER + out_info.query;
|
||||
proxy.px = out_info.countryCode;
|
||||
} catch (err) {
|
||||
console.log(`⚠️while err = ${err}`);
|
||||
}
|
||||
}));
|
||||
|
||||
// await sleep(300);
|
||||
i += batch_size;
|
||||
}
|
||||
// console.log("💰💕去重前的节点信息 = " + JSON.stringify(proxies));
|
||||
// 去除重复的节点,排序,再加个序号
|
||||
proxies = rmDupNameAndGroupAndEnumerate(proxies);
|
||||
// console.log("✅💕去重后的节点信息 = " + JSON.stringify(proxies));
|
||||
console.log(`✅💕去重后的节点个数 = ${proxies.length}`);
|
||||
|
||||
const endTime = new Date(); // 获取当前时间作为结束时间
|
||||
const timeDiff = endTime.getTime() - startTime.getTime(); // 获取时间差(以毫秒为单位)
|
||||
console.log(`✅💕方法总耗时: ${timeDiff / 1000} seconds`); // 将时间差转换为秒并打印到控制台上
|
||||
|
||||
return proxies;
|
||||
}
|
||||
|
||||
// 查询入口 阿里dns
|
||||
async function queryInInfo(server) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const data = {data: server};
|
||||
const url = `http://223.5.5.5/resolve?name=${server}`;
|
||||
$.http.get({
|
||||
url
|
||||
}).then(resp => {
|
||||
const body = JSON.parse(resp.body);
|
||||
if (body.Status === 0) {
|
||||
// Status: 0,成功,返回最下面的ip
|
||||
resolve(body.Answer[body.Answer.length - 1]);
|
||||
} else {
|
||||
resolve(data);
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("⚠️In err = " + err);
|
||||
resolve(data);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
const tasks = new Map();
|
||||
async function queryOutInfo(proxy) {
|
||||
const id = getId(proxy);
|
||||
const cached = resourceCache.get(id);
|
||||
if (cached) {
|
||||
return (cached);
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const url = `http://ip-api.com/json?lang=zh-CN&fields=status,message,country,countryCode,city,query`;
|
||||
let node = ProxyUtils.produce([proxy], target);
|
||||
|
||||
// Loon 需要去掉节点名字
|
||||
// if (isLoon) {
|
||||
// node = node.substring(node.indexOf("=") + 1);
|
||||
// }
|
||||
// QX只要tag的名字,目前QX本身不支持
|
||||
const opts = {policy: node.substring(node.lastIndexOf("=") + 1)};
|
||||
|
||||
const timeoutPromise = new Promise((_, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error("请求超时"));
|
||||
}, timeout);
|
||||
});
|
||||
|
||||
const queryPromise =
|
||||
$.http.get({
|
||||
url,
|
||||
opts: opts, // QX的写法
|
||||
node: node, // Loon和Surge IOS
|
||||
"policy-descriptor": node // Surge MAC
|
||||
}).then(resp => {
|
||||
const body = JSON.parse(resp.body);
|
||||
if (body.status === "success") {
|
||||
resourceCache.set(id, body);
|
||||
tasks.set(id, body);
|
||||
resolve(body);
|
||||
} else {
|
||||
reject(new Error(body.message));
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
// 超时处理
|
||||
Promise.race([timeoutPromise, queryPromise])
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getFlagEmoji(countryCode) {
|
||||
const codePoints = countryCode
|
||||
.toUpperCase()
|
||||
.split('')
|
||||
.map(char => 127397 + char.charCodeAt());
|
||||
return String
|
||||
.fromCodePoint(...codePoints)
|
||||
.replace(/🇹🇼/g, '🇨🇳');
|
||||
}
|
||||
|
||||
function rmDupNameAndGroupAndEnumerate(arr) {
|
||||
// 去重
|
||||
const nameSet = new Set();
|
||||
const result = [];
|
||||
for (const e of arr) {
|
||||
if (e.qc && !nameSet.has(e.qc)) {
|
||||
nameSet.add(e.qc);
|
||||
result.push(e);
|
||||
}
|
||||
}
|
||||
|
||||
// 将对象按照 sort 属性分组
|
||||
const groups = result.reduce((result, item) => {
|
||||
const key = item.px;
|
||||
if (!result[key]) {
|
||||
result[key] = [];
|
||||
}
|
||||
result[key].push(item);
|
||||
return result;
|
||||
}, {});
|
||||
|
||||
// 给每个分组中的对象的 name 属性加上两位数序号
|
||||
for (const groupKey in groups) {
|
||||
if (groups.hasOwnProperty(groupKey)) {
|
||||
const group = groups[groupKey];
|
||||
group.forEach((item, index) => {
|
||||
item.name = `${item.name}${DELIMITER}${index < 10 ? '0' : ''}${index + 1}`;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 将修改后的集合返回
|
||||
return Object.values(groups).flat();
|
||||
}
|
||||
|
||||
var MD5 = function (d) { var r = M(V(Y(X(d), 8 * d.length))); return r.toLowerCase() }; function M(d) { for (var _, m = "0123456789ABCDEF", f = "", r = 0; r < d.length; r++)_ = d.charCodeAt(r), f += m.charAt(_ >>> 4 & 15) + m.charAt(15 & _); return f } function X(d) { for (var _ = Array(d.length >> 2), m = 0; m < _.length; m++)_[m] = 0; for (m = 0; m < 8 * d.length; m += 8)_[m >> 5] |= (255 & d.charCodeAt(m / 8)) << m % 32; return _ } function V(d) { for (var _ = "", m = 0; m < 32 * d.length; m += 8)_ += String.fromCharCode(d[m >> 5] >>> m % 32 & 255); return _ } function Y(d, _) { d[_ >> 5] |= 128 << _ % 32, d[14 + (_ + 64 >>> 9 << 4)] = _; for (var m = 1732584193, f = -271733879, r = -1732584194, i = 271733878, n = 0; n < d.length; n += 16) { var h = m, t = f, g = r, e = i; f = md5_ii(f = md5_ii(f = md5_ii(f = md5_ii(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_hh(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_gg(f = md5_ff(f = md5_ff(f = md5_ff(f = md5_ff(f, r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 0], 7, -680876936), f, r, d[n + 1], 12, -389564586), m, f, d[n + 2], 17, 606105819), i, m, d[n + 3], 22, -1044525330), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 4], 7, -176418897), f, r, d[n + 5], 12, 1200080426), m, f, d[n + 6], 17, -1473231341), i, m, d[n + 7], 22, -45705983), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 8], 7, 1770035416), f, r, d[n + 9], 12, -1958414417), m, f, d[n + 10], 17, -42063), i, m, d[n + 11], 22, -1990404162), r = md5_ff(r, i = md5_ff(i, m = md5_ff(m, f, r, i, d[n + 12], 7, 1804603682), f, r, d[n + 13], 12, -40341101), m, f, d[n + 14], 17, -1502002290), i, m, d[n + 15], 22, 1236535329), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 1], 5, -165796510), f, r, d[n + 6], 9, -1069501632), m, f, d[n + 11], 14, 643717713), i, m, d[n + 0], 20, -373897302), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 5], 5, -701558691), f, r, d[n + 10], 9, 38016083), m, f, d[n + 15], 14, -660478335), i, m, d[n + 4], 20, -405537848), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 9], 5, 568446438), f, r, d[n + 14], 9, -1019803690), m, f, d[n + 3], 14, -187363961), i, m, d[n + 8], 20, 1163531501), r = md5_gg(r, i = md5_gg(i, m = md5_gg(m, f, r, i, d[n + 13], 5, -1444681467), f, r, d[n + 2], 9, -51403784), m, f, d[n + 7], 14, 1735328473), i, m, d[n + 12], 20, -1926607734), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 5], 4, -378558), f, r, d[n + 8], 11, -2022574463), m, f, d[n + 11], 16, 1839030562), i, m, d[n + 14], 23, -35309556), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 1], 4, -1530992060), f, r, d[n + 4], 11, 1272893353), m, f, d[n + 7], 16, -155497632), i, m, d[n + 10], 23, -1094730640), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 13], 4, 681279174), f, r, d[n + 0], 11, -358537222), m, f, d[n + 3], 16, -722521979), i, m, d[n + 6], 23, 76029189), r = md5_hh(r, i = md5_hh(i, m = md5_hh(m, f, r, i, d[n + 9], 4, -640364487), f, r, d[n + 12], 11, -421815835), m, f, d[n + 15], 16, 530742520), i, m, d[n + 2], 23, -995338651), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 0], 6, -198630844), f, r, d[n + 7], 10, 1126891415), m, f, d[n + 14], 15, -1416354905), i, m, d[n + 5], 21, -57434055), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 12], 6, 1700485571), f, r, d[n + 3], 10, -1894986606), m, f, d[n + 10], 15, -1051523), i, m, d[n + 1], 21, -2054922799), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 8], 6, 1873313359), f, r, d[n + 15], 10, -30611744), m, f, d[n + 6], 15, -1560198380), i, m, d[n + 13], 21, 1309151649), r = md5_ii(r, i = md5_ii(i, m = md5_ii(m, f, r, i, d[n + 4], 6, -145523070), f, r, d[n + 11], 10, -1120210379), m, f, d[n + 2], 15, 718787259), i, m, d[n + 9], 21, -343485551), m = safe_add(m, h), f = safe_add(f, t), r = safe_add(r, g), i = safe_add(i, e) } return Array(m, f, r, i) } function md5_cmn(d, _, m, f, r, i) { return safe_add(bit_rol(safe_add(safe_add(_, d), safe_add(f, i)), r), m) } function md5_ff(d, _, m, f, r, i, n) { return md5_cmn(_ & m | ~_ & f, d, _, r, i, n) } function md5_gg(d, _, m, f, r, i, n) { return md5_cmn(_ & f | m & ~f, d, _, r, i, n) } function md5_hh(d, _, m, f, r, i, n) { return md5_cmn(_ ^ m ^ f, d, _, r, i, n) } function md5_ii(d, _, m, f, r, i, n) { return md5_cmn(m ^ (_ | ~f), d, _, r, i, n) } function safe_add(d, _) { var m = (65535 & d) + (65535 & _); return (d >> 16) + (_ >> 16) + (m >> 16) << 16 | 65535 & m } function bit_rol(d, _) { return d << _ | d >>> 32 - _ }
|
||||
3
Scripts/T3.js
Normal file
3
Scripts/T3.js
Normal file
@ -0,0 +1,3 @@
|
||||
let obj = JSON.parse($response.body);
|
||||
delete obj.data;
|
||||
$done({body: JSON.stringify(obj)});
|
||||
124
Scripts/TestFlight/AutoJoinTF.js
Normal file
124
Scripts/TestFlight/AutoJoinTF.js
Normal file
File diff suppressed because one or more lines are too long
58
Scripts/TestFlight/AutoJoinTFKeys.js
Normal file
58
Scripts/TestFlight/AutoJoinTFKeys.js
Normal file
File diff suppressed because one or more lines are too long
154
Scripts/TestFlight/QL_AutoJoinTestFlight.js
Normal file
154
Scripts/TestFlight/QL_AutoJoinTestFlight.js
Normal file
File diff suppressed because one or more lines are too long
292
Scripts/TestFlight/TestFlightAccount.js
Normal file
292
Scripts/TestFlight/TestFlightAccount.js
Normal file
File diff suppressed because one or more lines are too long
3
Scripts/YouTube/request.js
Normal file
3
Scripts/YouTube/request.js
Normal file
File diff suppressed because one or more lines are too long
7
Scripts/YouTube/response.js
Normal file
7
Scripts/YouTube/response.js
Normal file
File diff suppressed because one or more lines are too long
40
Scripts/adrive/adrive.js
Normal file
40
Scripts/adrive/adrive.js
Normal file
@ -0,0 +1,40 @@
|
||||
// 2024-07-15 21:30
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/v1/users/onboard_list")) {
|
||||
if (obj.result?.length > 0) {
|
||||
obj.result = obj.result.filter(
|
||||
(i) =>
|
||||
![
|
||||
"backup_list_under_mydevice_banner",
|
||||
"backup_top_banner",
|
||||
"home_bulletin_board",
|
||||
"home_top_banner",
|
||||
"resource_top_banner",
|
||||
"video_top_banner"
|
||||
]?.includes(i?.anchor)
|
||||
);
|
||||
}
|
||||
} else if (url.includes("/v2/users/home/news")) {
|
||||
if (obj.result?.length > 0) {
|
||||
obj.result = obj.result.filter((i) => !i?.code?.includes("productUpdate"));
|
||||
}
|
||||
} else if (url.includes("/v1/user/home/widgets") || url.includes("/v2/users/home/widgets")) {
|
||||
const item = [
|
||||
"album", // 相册
|
||||
"banners", // 顶部奖励
|
||||
"coreFeatures", // 横版图标
|
||||
"introduceAlipan", // 认识阿里云盘
|
||||
"mainBackup", // 手机备份
|
||||
"minorBackup", // 备份设备列表
|
||||
"signIn" // 签到
|
||||
];
|
||||
item.forEach((i) => {
|
||||
delete obj[i];
|
||||
});
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
3
Scripts/alittle-tea.js
Normal file
3
Scripts/alittle-tea.js
Normal file
@ -0,0 +1,3 @@
|
||||
let obj=JSON.parse($response.body);
|
||||
delete obj.data;
|
||||
$done({body: JSON.stringify(obj)});
|
||||
13
Scripts/amdc.js
Normal file
13
Scripts/amdc.js
Normal file
@ -0,0 +1,13 @@
|
||||
// 使用AMDC的APP有:咸鱼、淘宝、盒马、高德、菜鸟、飞猪
|
||||
var ua = $request.headers["User-Agent"] || $request.headers["user-agent"];
|
||||
|
||||
if (
|
||||
ua.indexOf("AMap") !== -1 ||
|
||||
ua.indexOf("Cainiao") !== -1 ||
|
||||
ua.indexOf("Moon") !== -1 ||
|
||||
ua.indexOf("%E9%A3%9E%E7%8C%AA%E6%97%85%E8%A1%8C") !== -1
|
||||
) {
|
||||
$done({body: ""});
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
9
Scripts/applet.js
Normal file
9
Scripts/applet.js
Normal file
@ -0,0 +1,9 @@
|
||||
//############################################
|
||||
//#!name=微信小程序去广告脚本
|
||||
//#!date:2023-03-19
|
||||
//#############################################
|
||||
|
||||
|
||||
re('"excitationAd":"\\d"@Ad":"\d"@ad":true@AdId":"[^"]*"@adid":"[^"]*"@fr_videp_if":"1@adunit[^"]*"','"excitationAd":"0"@Ad":"0"@ad":false@AdId":""@adid":""@fr_videp_if":"0@"')
|
||||
|
||||
function re(){var e=$response.body;if(arguments[0].includes("@")){var r=arguments[0].split("@"),l=arguments[1].split("@");for(i=0;i<r.length;i++){var a=RegExp(r[i],"g");e=e.replace(a,l[i])}}else{var a=RegExp(arguments[0],"g");e=e.replace(a,arguments[1])}$done(e)}
|
||||
27
Scripts/baidu/baiduLib.js
Normal file
27
Scripts/baidu/baiduLib.js
Normal file
@ -0,0 +1,27 @@
|
||||
/***********************************
|
||||
> 应用名称:百度文库
|
||||
> 脚本功能:解锁VIP文档阅读权限
|
||||
> 特别说明:本脚本仅供学习交流使用,禁止转载、售卖
|
||||
|
||||
[rewrite_local]
|
||||
# 百度文库☆解锁VIP文档阅读权限(2022-10-17)
|
||||
^https:\/\/appwk\.baidu\.com\/naapi\/user\/getinfo url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/baidu/baiduLib.js
|
||||
|
||||
[mitm]
|
||||
hostname=appwk.baidu.com
|
||||
***********************************/
|
||||
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
obj.data.vip.base_vip_info = {
|
||||
uid: 12345678,
|
||||
type: 2,
|
||||
start_time: 1622222200,
|
||||
end_time: 4622222200,
|
||||
is_vip: 1,
|
||||
remain_day: 999,
|
||||
pro_total: 5,
|
||||
normal_total: 5
|
||||
};
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
89
Scripts/baidumap.js
Normal file
89
Scripts/baidumap.js
Normal file
File diff suppressed because one or more lines are too long
41
Scripts/bilibili/bilibiliShare.cookie.js
Normal file
41
Scripts/bilibili/bilibiliShare.cookie.js
Normal file
File diff suppressed because one or more lines are too long
37
Scripts/bilibili/bilibiliShare.js
Normal file
37
Scripts/bilibili/bilibiliShare.js
Normal file
File diff suppressed because one or more lines are too long
210
Scripts/bilibili/json.js
Normal file
210
Scripts/bilibili/json.js
Normal file
@ -0,0 +1,210 @@
|
||||
// 2024-10-19 12:35
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/x/resource/show/tab/v2")) {
|
||||
// 底部选项卡
|
||||
if (obj?.data?.bottom?.length > 0) {
|
||||
const sortLists = ["首页", "动态", "我的"];
|
||||
obj.data.bottom = obj.data.bottom
|
||||
.filter((i) => sortLists?.includes(i?.name))
|
||||
.sort((a, b) => sortLists.indexOf(a?.name) - sortLists.indexOf(b?.name));
|
||||
}
|
||||
// 首页导航栏
|
||||
if (obj?.data?.tab?.length > 0) {
|
||||
const sortLists = ["推荐", "热门", "影视", "动画"];
|
||||
obj.data.tab = obj.data.tab
|
||||
.filter((i) => sortLists?.includes(i?.name))
|
||||
.sort((a, b) => sortLists.indexOf(a?.name) - sortLists.indexOf(b?.name));
|
||||
}
|
||||
// 右上角按钮
|
||||
if (obj?.data?.top?.length > 0) {
|
||||
obj.data.top = obj.data.top.filter((i) => i?.name === "消息");
|
||||
if (obj?.data?.top?.[0]?.pos) {
|
||||
obj.data.top[0].pos = 1;
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/x/v2/account/mine?")) {
|
||||
// 我的页面
|
||||
const del = ["rework_v1", "vip_section", "vip_section_v2"];
|
||||
for (let i of del) {
|
||||
// 不必要项目
|
||||
delete obj.data[i];
|
||||
}
|
||||
if (obj?.data?.sections_v2?.length > 0) {
|
||||
let newSects = [];
|
||||
for (let item of obj.data.sections_v2) {
|
||||
delete item.button;
|
||||
if (item?.style) {
|
||||
if (item?.style === 1 || item?.style === 2) {
|
||||
if (item?.title) {
|
||||
if (item?.title === "创作中心" || item?.title === "推荐服务") {
|
||||
// 创作中心 推荐服务
|
||||
continue;
|
||||
} else if (item?.title === "更多服务") {
|
||||
delete item.title;
|
||||
if (item?.items?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let i of item.items) {
|
||||
if (/user_center\/feedback/g.test(i?.uri)) {
|
||||
// 联系客服
|
||||
newItems.push(i);
|
||||
} else if (/user_center\/setting/g.test(i?.uri)) {
|
||||
// 设置
|
||||
newItems.push(i);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
item.items = newItems;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 其他style
|
||||
continue;
|
||||
}
|
||||
}
|
||||
newSects.push(item);
|
||||
}
|
||||
obj.data.sections_v2 = newSects;
|
||||
}
|
||||
// 非会员开启本地会员标识
|
||||
if (obj?.data?.vip) {
|
||||
if (obj?.data?.vip?.status === 0) {
|
||||
obj.data.vip_type = 2;
|
||||
obj.data.vip.type = 2;
|
||||
obj.data.vip.status = 1;
|
||||
obj.data.vip.due_date = 3818419199; // Unix 时间戳 2090-12-31 23:59:59
|
||||
obj.data.vip.label = {
|
||||
path: "",
|
||||
text: "年度大会员",
|
||||
label_theme: "annual_vip",
|
||||
text_color: "#FFFFFF",
|
||||
bg_style: 1,
|
||||
bg_color: "#FB7299",
|
||||
border_color: "",
|
||||
image: "https://i0.hdslb.com/bfs/vip/8d4f8bfc713826a5412a0a27eaaac4d6b9ede1d9.png"
|
||||
};
|
||||
obj.data.vip.nickname_color = "#FB7299";
|
||||
obj.data.vip.role = 3;
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/x/v2/account/mine/ipad")) {
|
||||
// ipad我的页面
|
||||
delete obj.data.ipad_upper_sections; // 投稿 创作首页 稿件管理 有奖活动
|
||||
if (obj?.data?.ipad_recommend_sections?.length > 0) {
|
||||
// 789我的关注 790我的消息 791我的钱包 792直播中心 793大会员 794我的课程 2542我的游戏
|
||||
const itemList = [789, 790];
|
||||
obj.data.ipad_recommend_sections = obj.data.ipad_recommend_sections.filter((i) => itemList?.includes(i.id));
|
||||
}
|
||||
if (obj?.data?.ipad_more_sections?.length > 0) {
|
||||
// 797我的客服 798设置 1070青少年守护
|
||||
const itemList = [797, 798];
|
||||
obj.data.ipad_more_sections = obj.data.ipad_more_sections.filter((i) => itemList?.includes(i.id));
|
||||
}
|
||||
} else if (url.includes("/x/v2/account/myinfo")) {
|
||||
// 非会员开启会员专属清晰度
|
||||
if (obj?.data?.vip) {
|
||||
if (obj?.data?.vip?.status === 0) {
|
||||
obj.data.vip.type = 2;
|
||||
obj.data.vip.status = 1;
|
||||
obj.data.vip.due_date = 3818419199; // Unix 时间戳 2090-12-31 23:59:59
|
||||
obj.data.vip.role = 3;
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/x/v2/feed/index?")) {
|
||||
// 首页推荐信息流
|
||||
if (obj?.data?.items?.length > 0) {
|
||||
// 白名单
|
||||
obj.data.items = obj.data.items.filter((i) => i?.card_goto === "av");
|
||||
}
|
||||
if (obj?.data?.config?.toast?.has_toast) {
|
||||
obj.data.config.toast.has_toast = false;
|
||||
}
|
||||
} else if (url.includes("/x/v2/feed/index/story")) {
|
||||
// 竖屏模式信息流
|
||||
if (obj?.data?.items?.length > 0) {
|
||||
// vertical_live 直播内容
|
||||
// vertical_pgc 大会员专享
|
||||
let newItems = [];
|
||||
for (let item of obj.data.items) {
|
||||
if (item?.hasOwnProperty("ad_info")) {
|
||||
continue;
|
||||
} else if (["vertical_ad_av", "vertical_live", "vertical_pgc"]?.includes(item?.card_goto)) {
|
||||
continue;
|
||||
} else {
|
||||
delete item.creative_entrance; // 推荐话题搜索框
|
||||
delete item.story_cart_icon; // 相关话题图标
|
||||
newItems.push(item);
|
||||
}
|
||||
}
|
||||
obj.data.items = newItems;
|
||||
}
|
||||
} else if (url.includes("/x/v2/search/square")) {
|
||||
// 搜索框
|
||||
if (obj?.data) {
|
||||
obj.data = { type: "history", title: "搜索历史", search_hotword_revision: 2 };
|
||||
}
|
||||
} else if (url.includes("/x/v2/splash")) {
|
||||
// 开屏广告
|
||||
if (obj?.data) {
|
||||
const item = ["account", "event_list", "preload", "show"];
|
||||
item.forEach((i) => {
|
||||
delete obj.data[i];
|
||||
});
|
||||
if (obj?.data?.max_time) {
|
||||
obj.data.max_time = 0;
|
||||
}
|
||||
if (obj?.data?.min_interval) {
|
||||
obj.data.min_interval = 31536000;
|
||||
}
|
||||
if (obj?.data?.pull_interval) {
|
||||
obj.data.pull_interval = 31536000;
|
||||
}
|
||||
if (obj?.data?.list?.length > 0) {
|
||||
for (let i of obj.data.list) {
|
||||
i.duration = 0;
|
||||
i.enable_pre_download = false;
|
||||
i.begin_time = 3818332800; // Unix 时间戳 2090-12-31 00:00:00
|
||||
i.end_time = 3818419199; // Unix 时间戳 2090-12-31 23:59:59
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/pgc/page/bangumi") || url.includes("/pgc/page/cinema/tab")) {
|
||||
// 观影页
|
||||
if (obj.result?.modules?.length > 0) {
|
||||
obj.result.modules.forEach((i) => {
|
||||
if (i?.style?.startsWith("banner")) {
|
||||
if (i?.items?.length > 0) {
|
||||
i.items = i.items.filter((ii) => ii?.link?.includes("play"));
|
||||
}
|
||||
} else if (i?.style?.startsWith("function")) {
|
||||
if (i?.items?.length > 0) {
|
||||
i.items = i.items.filter((ii) => ii?.blink?.startsWith("bilibili"));
|
||||
}
|
||||
} else if ([241, 1283, 1284, 1441]?.includes(i?.module_id)) {
|
||||
if (i?.items?.length > 0) {
|
||||
i.items = [];
|
||||
}
|
||||
} else if (i?.style?.startsWith("tip")) {
|
||||
if (i?.items?.length > 0) {
|
||||
i.items = [];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (url.includes("/xlive/app-room/v1/index/getInfoByRoom")) {
|
||||
// 直播
|
||||
delete obj.data.activity_banner_info;
|
||||
if (obj?.data?.shopping_info) {
|
||||
obj.data.shopping_info = { is_show: 0 };
|
||||
}
|
||||
if (obj?.data?.new_tab_info?.outer_list?.length > 0) {
|
||||
obj.data.new_tab_info.outer_list = obj.data.new_tab_info.outer_list.filter((i) => i?.biz_id !== 33);
|
||||
}
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
3
Scripts/bilibili/protoA.js
Normal file
3
Scripts/bilibili/protoA.js
Normal file
File diff suppressed because one or more lines are too long
3
Scripts/bilibili/protoC.js
Normal file
3
Scripts/bilibili/protoC.js
Normal file
File diff suppressed because one or more lines are too long
8
Scripts/blued.js
Normal file
8
Scripts/blued.js
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
let rsp_body = JSON.parse($response.body);
|
||||
rsp_body.data[0].banner = {};
|
||||
rsp_body.data[0].service = [];
|
||||
rsp_body.data[0].healthy = {};
|
||||
rsp_body.data[0].healthy_banner = [];
|
||||
rsp_body.data[0].emotions = [];
|
||||
$done({body: JSON.stringify(rsp_body)});
|
||||
34
Scripts/bohe/bohe_ads.js
Normal file
34
Scripts/bohe/bohe_ads.js
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 薄荷健康去广告
|
||||
* 移除记录页大家都在看、移除各类弹窗,移除广场横幅推广,精简代谢中心页面。
|
||||
* 2024-08-16 18:28:28
|
||||
*/
|
||||
const url = $request.url;
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/index/plaza-flow?")) {
|
||||
if (obj.data && obj.data.contents && Array.isArray(obj.data.contents)) {
|
||||
obj.data.contents = obj.data.contents.filter(item => item.type !== 4);
|
||||
}
|
||||
}
|
||||
|
||||
if (url.includes("/meta-interface/v2/index?")) {
|
||||
delete obj.data.recom_cards;
|
||||
delete obj.data.recom_btns;
|
||||
}
|
||||
|
||||
if (url.includes("/meta-interface/v1/index/plaza?")) {
|
||||
delete obj.data.tabs[1].badge;
|
||||
delete obj.data.recommend_ads;
|
||||
}
|
||||
|
||||
if (url.includes("/open-interface/v1/string/market_page?title=metabolism_config")) {
|
||||
delete obj.dtop_banner;
|
||||
delete obj.diagnos_config;
|
||||
delete obj.partner_hospital;
|
||||
delete obj.question_answer;
|
||||
delete obj.product;
|
||||
delete obj.brand_story;
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
158
Scripts/cainiao/cainiao.js
Normal file
158
Scripts/cainiao/cainiao.js
Normal file
@ -0,0 +1,158 @@
|
||||
// 2024-09-27 11:50
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/mtop.cainiao.guoguo.nbnetflow.ads.mshow")) {
|
||||
// 首页
|
||||
if (obj?.data) {
|
||||
const items = [
|
||||
"10", // 物流详情页 底部横图
|
||||
"498", // 物流详情页 左上角
|
||||
"328", // 3位数为家乡版本
|
||||
"366",
|
||||
"369",
|
||||
"615",
|
||||
"616",
|
||||
"727",
|
||||
"793", // 支付宝 小程序 搜索框
|
||||
"954", // 支付宝 小程序 置顶图标
|
||||
"1275", // 果酱即将到期
|
||||
"1308", // 支付宝 小程序 横图
|
||||
"1316", // 头部 banner
|
||||
"1332", // 我的页面 横图
|
||||
"1340", // 查快递 小妙招
|
||||
"1391", // 支付宝 小程序 寄包裹
|
||||
"1410", // 导入拼多多、抖音快递
|
||||
"1428", // 幸运号
|
||||
"1524", // 抽现金
|
||||
"1525", // 幸运包裹
|
||||
"1638", // 为你精选了一些商品
|
||||
"1910" // 618促销红包
|
||||
];
|
||||
for (let i of items) {
|
||||
if (obj.data?.[i]) {
|
||||
delete obj.data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/mtop.cainiao.guoguo.nbnetflow.ads.show")) {
|
||||
// 我的页面
|
||||
if (obj?.data?.result?.length > 0) {
|
||||
// 29338 寄件会员
|
||||
// 29339 裹酱积分
|
||||
// 33927 绿色能量
|
||||
// 36649 回收旧物
|
||||
obj.data.result = obj.data.result.filter(
|
||||
(i) =>
|
||||
!(
|
||||
i?.materialContentMapper?.adItemDetail ||
|
||||
(i?.materialContentMapper?.bgImg && i?.materialContentMapper?.advRecGmtModifiedTime) ||
|
||||
["common_header_banner", "entertainment", "interests", "kuaishou_banner"]?.includes(
|
||||
i?.materialContentMapper?.group_id
|
||||
) ||
|
||||
["29338", "29339", "32103", "33927", "36649"]?.includes(i?.id)
|
||||
)
|
||||
);
|
||||
for (let i of obj.data.result) {
|
||||
if (i?.materialContentMapper?.show_tips_content) {
|
||||
// 清空红点标记
|
||||
i.materialContentMapper.show_tips_content = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/mtop.cainiao.nbpresentation.pickup.empty.page.get")) {
|
||||
// 取件页面
|
||||
if (obj?.data?.result) {
|
||||
let ggContent = obj.data.result.content;
|
||||
if (ggContent?.middle?.length > 0) {
|
||||
ggContent.middle = ggContent.middle.filter(
|
||||
(i) =>
|
||||
![
|
||||
"guoguo_pickup_empty_page_relation_add", // 添加亲友
|
||||
"guoguo_pickup_helper_feedback", // 反馈组件
|
||||
"guoguo_pickup_helper_tip_view" // 取件小助手
|
||||
]?.includes(i?.template?.name)
|
||||
);
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/mtop.cainiao.nbpresentation.protocol.homepage.get")) {
|
||||
// 首页
|
||||
if (obj?.data?.result?.dataList?.length > 0) {
|
||||
let newLists = [];
|
||||
for (let item of obj.data.result.dataList) {
|
||||
if (item?.type?.includes("kingkong")) {
|
||||
if (item?.bizData?.items?.length > 0) {
|
||||
for (let i of item.bizData.items) {
|
||||
i.rightIcon = null;
|
||||
i.bubbleText = null;
|
||||
}
|
||||
}
|
||||
} else if (item?.type?.includes("icons_scroll")) {
|
||||
// 顶部图标
|
||||
if (item?.bizData?.items?.length > 0) {
|
||||
let newBizs = [];
|
||||
for (let i of item.bizData.items) {
|
||||
const lists = [
|
||||
"618cjhb", // 超级红包
|
||||
"bgxq", // 包裹星球
|
||||
"cncy", // 填字赚现金
|
||||
"cngy", // 免费领水果
|
||||
"cngreen", // 绿色家园
|
||||
"cnhs", // 菜鸟回收
|
||||
"dtxb", // 地图寻宝
|
||||
"gjjf", // 裹酱积分
|
||||
"jkymd", // 集卡赢免单
|
||||
"ljjq", // 领寄件券
|
||||
"ttlhb", // 天天领红包
|
||||
"xybg" // 幸运包裹
|
||||
];
|
||||
if (lists?.includes(i?.key)) {
|
||||
continue;
|
||||
}
|
||||
newBizs.push(i);
|
||||
}
|
||||
item.bizData.items = newBizs;
|
||||
for (let i of item.bizData.items) {
|
||||
i.rightIcon = null;
|
||||
i.bubbleText = null;
|
||||
}
|
||||
}
|
||||
} else if (item?.type?.includes("banner_area")) {
|
||||
// 新人福利 幸运抽奖
|
||||
continue;
|
||||
} else if (item?.type?.includes("promotion")) {
|
||||
// 促销活动
|
||||
continue;
|
||||
}
|
||||
newLists.push(item);
|
||||
}
|
||||
obj.data.result.dataList = newLists;
|
||||
}
|
||||
} else if (url.includes("/mtop.nbfriend.message.conversation.list")) {
|
||||
// 消息中心
|
||||
if (obj?.data?.data?.length > 0) {
|
||||
obj.data.data = obj.data.data.filter((i) => i?.conversationId?.includes("logistic_message"));
|
||||
}
|
||||
} else if (url.includes("/mtop.cainiao.app.mine.main")) {
|
||||
// 我的页面
|
||||
if (obj?.data) {
|
||||
const items = [
|
||||
"activity", // 热门活动
|
||||
"asset", // 我的权益
|
||||
"banner", // 底部滚动横图
|
||||
"content"
|
||||
// "header", // 头部信息
|
||||
// "order" // 我的订单
|
||||
// "packageArea", // 包裹导入
|
||||
];
|
||||
for (let i of items) {
|
||||
if (obj.data?.[i]) {
|
||||
delete obj.data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
104
Scripts/caixin/caixin.js
Normal file
104
Scripts/caixin/caixin.js
Normal file
@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 阅读财新APP会员文章,需要去某宝购买会员卡密
|
||||
* @date 2023-11-22 18:30:13
|
||||
*
|
||||
* hostname = mappsv5.caixin.com
|
||||
* [rewrite_local]
|
||||
* https://mappsv5\.caixin\.com/articlev5/(\d+)/(\d+)\.html url script-response-body caixin.js
|
||||
*/
|
||||
|
||||
let req_url = $request.url;
|
||||
let rsp_body = $response.body;
|
||||
let kami = ''; // 这里填写卡密
|
||||
let articleProperties = {};
|
||||
let articleURL = "";
|
||||
try {
|
||||
modifyMain();
|
||||
} catch (e) {
|
||||
console.log('脚本运行出现错误⚠️');
|
||||
console.log('错误信息:' + e.message);
|
||||
}
|
||||
|
||||
function modifyMain() {
|
||||
console.log('脚本运行开始');
|
||||
if (rsp_body.includes("浏览完整内容,请订阅《财新周刊》")) {
|
||||
console.log('会员文章💕');
|
||||
sign();
|
||||
} else {
|
||||
console.log('普通文章💕');
|
||||
$done({rsp_body});
|
||||
}
|
||||
}
|
||||
|
||||
function sign() {
|
||||
console.log('开始登录💕');
|
||||
const url = `http://113.207.49.170:8801/api/login.php`;
|
||||
const method = `POST`;
|
||||
const headers = {
|
||||
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/119.0.6045.169 Mobile/15E148 Safari/604.1`,
|
||||
'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundarylAGNzd3p4Uf34hmM'
|
||||
};
|
||||
const body = `------WebKitFormBoundarylAGNzd3p4Uf34hmM\nContent-Disposition: form-data; name="kami"\n\n${kami}\n------WebKitFormBoundarylAGNzd3p4Uf34hmM--\n`;
|
||||
const myRequest = {
|
||||
url: url, method: method, headers: headers, body: body
|
||||
};
|
||||
|
||||
$task.fetch(myRequest).then(response => {
|
||||
console.log("登录响应码:" + response.statusCode + "\n\n" + response.body + "\n\n");
|
||||
let authData = JSON.parse(response.body);
|
||||
if (authData.code === 200) {
|
||||
fetchArticle(authData.token);
|
||||
} else {
|
||||
console.log('登录失败❌');
|
||||
}
|
||||
}, reason => {
|
||||
console.log('请求异常❗️');
|
||||
console.log(reason.error);
|
||||
$done({rsp_body});
|
||||
});
|
||||
}
|
||||
|
||||
// 拉取文章
|
||||
function fetchArticle(authData) {
|
||||
// 文章链接示例:https://www.caixin.com/2023-11-20/102137746.html
|
||||
const htmlString = rsp_body;
|
||||
const startTag = '<script';
|
||||
const endTag = '</script>';
|
||||
const keyword = 'articleProperties';
|
||||
const startIndex = htmlString.indexOf(keyword);
|
||||
const startScriptIndex = htmlString.lastIndexOf(startTag, startIndex);
|
||||
const endIndex = htmlString.indexOf(endTag, startIndex);
|
||||
|
||||
if (startIndex !== -1 && startScriptIndex !== -1 && endIndex !== -1) {
|
||||
articleProperties = htmlString.substring(startIndex + 20, endIndex + endTag.length - 10);
|
||||
// console.log(articleProperties);
|
||||
} else {
|
||||
console.log('未找到匹配的内容或者没有包含articleProperties。');
|
||||
}
|
||||
articleURL = JSON.parse(articleProperties).from_web_url;
|
||||
console.log("文章链接:" + articleURL);
|
||||
|
||||
const url = `http://113.207.49.170:8801/api/news.php`;
|
||||
const method = `POST`;
|
||||
const headers = {
|
||||
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/119.0.6045.169 Mobile/15E148 Safari/604.1`,
|
||||
'Cookie': `kami=${kami}; token=${authData}`,
|
||||
};
|
||||
const body = `url=${articleURL}`;
|
||||
|
||||
const myRequest = {
|
||||
url: url, method: method, headers: headers, body: body
|
||||
};
|
||||
|
||||
$task.fetch(myRequest).then(response => {
|
||||
console.log("拉取文章响应码:" + response.statusCode + "\n\n");
|
||||
rsp_body = response.body;
|
||||
console.log("拉取文章结束💕");
|
||||
// console.log("会员文章内容:\n" + new_rsp_body);
|
||||
$done({body: rsp_body});
|
||||
}, reason => {
|
||||
console.log(reason.error);
|
||||
$done({rsp_body});
|
||||
});
|
||||
}
|
||||
4
Scripts/caixin/caixinAd.js
Normal file
4
Scripts/caixin/caixinAd.js
Normal file
@ -0,0 +1,4 @@
|
||||
// 财新
|
||||
|
||||
var __encode ='jsjiami.com',_a={}, _0xb483=["\x5F\x64\x65\x63\x6F\x64\x65","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x6F\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x6F\x62\x66\x75\x73\x63\x61\x74\x6F\x72\x2E\x68\x74\x6D\x6C"];(function(_0xd642x1){_0xd642x1[_0xb483[0]]= _0xb483[1]})(_a);var __Oxf34c4=["\x69\x6E\x74\x76\x61\x6C\x22\x3A\x30","\x72\x65\x70\x6C\x61\x63\x65","\x65\x64\x61\x79\x22\x3A\x22\x32\x30\x32\x39\x2D\x31\x32\x2D\x33\x30\x20\x30\x30\x3A\x30\x30\x3A\x30\x30\x22","\x73\x64\x61\x79\x22\x3A\x22\x32\x30\x32\x39\x2D\x31\x32\x2D\x30\x31\x20\x30\x30\x3A\x30\x30\x3A\x30\x30\x22","\x62\x6F\x64\x79","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6C\x6F\x67","\u5220\u9664","\u7248\u672C\u53F7\uFF0C\x6A\x73\u4F1A\u5B9A","\u671F\u5F39\u7A97\uFF0C","\u8FD8\u8BF7\u652F\u6301\u6211\u4EEC\u7684\u5DE5\u4F5C","\x6A\x73\x6A\x69\x61","\x6D\x69\x2E\x63\x6F\x6D"];var body=$response[__Oxf34c4[0x4]][__Oxf34c4[0x1]](/sday":"[^"]*"/g,__Oxf34c4[0x3])[__Oxf34c4[0x1]](/eday":"[^"]*"/g,__Oxf34c4[0x2])[__Oxf34c4[0x1]](/intval":\d/g,__Oxf34c4[0x0]);$done({body});;;(function(_0x510dx2,_0x510dx3,_0x510dx4,_0x510dx5,_0x510dx6,_0x510dx7){_0x510dx7= __Oxf34c4[0x5];_0x510dx5= function(_0x510dx8){if( typeof alert!== _0x510dx7){alert(_0x510dx8)};if( typeof console!== _0x510dx7){console[__Oxf34c4[0x6]](_0x510dx8)}};_0x510dx4= function(_0x510dx9,_0x510dx2){return _0x510dx9+ _0x510dx2};_0x510dx6= _0x510dx4(__Oxf34c4[0x7],_0x510dx4(_0x510dx4(__Oxf34c4[0x8],__Oxf34c4[0x9]),__Oxf34c4[0xa]));try{_0x510dx2= __encode;if(!( typeof _0x510dx2!== _0x510dx7&& _0x510dx2=== _0x510dx4(__Oxf34c4[0xb],__Oxf34c4[0xc]))){_0x510dx5(_0x510dx6)}}catch(e){_0x510dx5(_0x510dx6)}})({})
|
||||
|
||||
110
Scripts/caiyun/caiyun.js
Normal file
110
Scripts/caiyun/caiyun.js
Normal file
@ -0,0 +1,110 @@
|
||||
// 2024-09-28 10:30
|
||||
|
||||
const url = $request.url;
|
||||
const isQuanX = typeof $task !== "undefined";
|
||||
let header = $request.headers;
|
||||
|
||||
if (typeof $response === "undefined") {
|
||||
const cyTK =
|
||||
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2ZXJzaW9uIjoxLCJ1c2VyX2lkIjoiNWY1YmZjNTdkMmM2ODkwMDE0ZTI2YmI4Iiwic3ZpcF9leHBpcmVkX2F0IjoxNzA1MzMxMTY2LjQxNjc3MSwidmlwX2V4cGlyZWRfYXQiOjB9.h_Cem89QarTXxVX9Z_Wt-Mak6ZHAjAJqgv3hEY6wpps";
|
||||
header["device-token"] = cyTK;
|
||||
if (compareVersions(header.version, "7.19.0") > 0) {
|
||||
if (isQuanX) {
|
||||
header["Authorization"] = "Bearer " + cyTK;
|
||||
} else {
|
||||
header["authorization"] = "Bearer " + cyTK;
|
||||
}
|
||||
}
|
||||
$done({ headers: header });
|
||||
} else {
|
||||
let obj = JSON.parse($response.body);
|
||||
if (url.includes("/api.caiyunapp.com/v1/activity")) {
|
||||
if (url.includes("&type_id=A03&")) {
|
||||
// 底栏控制项目 主页图标 天气助手 彩云ai
|
||||
if (obj?.interval) {
|
||||
obj.interval = 2592000; // 30天===2592000秒
|
||||
}
|
||||
if (obj?.activities?.length > 0) {
|
||||
for (let item of obj.activities) {
|
||||
if (item?.name && item?.type && item?.feature) {
|
||||
item.feature = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 其他请求
|
||||
obj = { status: "ok", activities: [{ items: [] }] };
|
||||
}
|
||||
} else if (url.includes("/api/v1/user_detail")) {
|
||||
// 新版本 我的页面
|
||||
if (obj?.vip_info?.show_upcoming_renewal) {
|
||||
obj.vip_info.show_upcoming_renewal = false;
|
||||
}
|
||||
if (obj?.vip_info?.svip) {
|
||||
if (obj?.vip_info?.svip) {
|
||||
obj.vip_info.svip.is_auto_renewal = true;
|
||||
obj.vip_info.svip.expires_time = "3742732800";
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/wrapper.cyapi.cn/v1/activity")) {
|
||||
// 彩云推广
|
||||
if (["&type_id=A03&"]?.includes(url)) {
|
||||
// 天气助手 彩云ai
|
||||
if (obj?.interval) {
|
||||
obj.interval = 2592000; // 30天===2592000秒
|
||||
}
|
||||
if (obj?.activities?.length > 0) {
|
||||
obj.activities = [];
|
||||
}
|
||||
} else {
|
||||
// 其他请求
|
||||
obj = { status: "ok", activities: [{ items: [] }] };
|
||||
}
|
||||
} else if (url.includes("/v1/vip_info")) {
|
||||
// 我的页面
|
||||
if (obj?.vip) {
|
||||
obj.vip.expires_time = "4030000000";
|
||||
}
|
||||
if (obj?.svip) {
|
||||
obj.svip.expires_time = "4030000000";
|
||||
}
|
||||
if (obj?.show_upcoming_renewal) {
|
||||
obj.show_upcoming_renewal = false;
|
||||
}
|
||||
} else if (url.includes("/v2/user")) {
|
||||
// 我的页面
|
||||
if (obj?.result) {
|
||||
obj.result.svip_given = 730;
|
||||
obj.result.is_phone_verified = true;
|
||||
obj.result.is_xy_vip = true;
|
||||
obj.result.vip_expired_at = 4030000000.16;
|
||||
obj.result.is_vip = true;
|
||||
obj.result.xy_svip_expire = 4030000000.16;
|
||||
if (obj?.result?.wt) {
|
||||
if (obj.result.wt.vip) {
|
||||
obj.result.wt.vip.enabled = true;
|
||||
obj.result.wt.vip.expired_at = 4030000000.16;
|
||||
obj.result.wt.vip.svip_expired_at = 4030000000.16;
|
||||
}
|
||||
obj.result.wt.svip_given = 730;
|
||||
}
|
||||
obj.result.is_primary = true;
|
||||
obj.result.xy_vip_expire = 4030000000.16;
|
||||
obj.result.svip_expired_at = 4030000000.16;
|
||||
obj.result.vip_type = "s";
|
||||
}
|
||||
}
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
}
|
||||
|
||||
function compareVersions(t, r) {
|
||||
const e = t.split(".").map(Number);
|
||||
const n = r.split(".").map(Number);
|
||||
for (let t = 0; t < Math.max(e.length, n.length); t++) {
|
||||
const r = e[t] || 0;
|
||||
const i = n[t] || 0;
|
||||
if (r > i) return 1;
|
||||
if (r < i) return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
220
Scripts/ccbLife/A3341AB05.json
Normal file
220
Scripts/ccbLife/A3341AB05.json
Normal file
@ -0,0 +1,220 @@
|
||||
{
|
||||
"errMsg" : "",
|
||||
"data" : {
|
||||
"MEB_GREETINGWORD" : [
|
||||
{
|
||||
"SHOW_TYPE" : "01",
|
||||
"CONTENT" : "四方食事,不过一碗人间烟火"
|
||||
}
|
||||
],
|
||||
"SYSTEM_TIME" : "2023-07-13 09:05:33",
|
||||
"STOREY_DISPLAY_INFO" : [
|
||||
{
|
||||
"STOREY_NM" : "生活精选",
|
||||
"STOREY_TYPE" : "03",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "限时抢券",
|
||||
"STOREY_TYPE" : "06",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "首页专题广告",
|
||||
"STOREY_TYPE" : "10",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "分行广告",
|
||||
"STOREY_TYPE" : "14",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "节日广告",
|
||||
"STOREY_TYPE" : "15",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "发现好店广告",
|
||||
"STOREY_TYPE" : "25",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "生活卡专区精彩活动",
|
||||
"STOREY_TYPE" : "34",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "每日好券精彩活动",
|
||||
"STOREY_TYPE" : "35",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "标签广告",
|
||||
"STOREY_TYPE" : "36",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "今日优选广告",
|
||||
"STOREY_TYPE" : "37",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "数字人民币专区广告",
|
||||
"STOREY_TYPE" : "38",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "数字人民币活动广告",
|
||||
"STOREY_TYPE" : "39",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "数字人民币知识广告",
|
||||
"STOREY_TYPE" : "40",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "场景聚合",
|
||||
"STOREY_TYPE" : "49",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "美食好店",
|
||||
"STOREY_TYPE" : "50",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好花-美食券",
|
||||
"STOREY_TYPE" : "83",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好花-文娱充值",
|
||||
"STOREY_TYPE" : "84",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好花-大牌",
|
||||
"STOREY_TYPE" : "85",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好物-全积分兑换",
|
||||
"STOREY_TYPE" : "86",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好物-积分随心抵",
|
||||
"STOREY_TYPE" : "87",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "信用卡-商品",
|
||||
"STOREY_TYPE" : "88",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好赚楼层",
|
||||
"STOREY_TYPE" : "90",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "精选TAB",
|
||||
"STOREY_TYPE" : "91",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好店TAB",
|
||||
"STOREY_TYPE" : "92",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "热门资讯",
|
||||
"STOREY_TYPE" : "75",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "支付有礼",
|
||||
"STOREY_TYPE" : "52",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "支付有礼",
|
||||
"STOREY_TYPE" : "54",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "安心保障",
|
||||
"STOREY_TYPE" : "58",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "功能区广告",
|
||||
"STOREY_TYPE" : "60",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "节日广告2.0",
|
||||
"STOREY_TYPE" : "61",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "会员有礼广告",
|
||||
"STOREY_TYPE" : "63",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "信用卡专享广告2.0",
|
||||
"STOREY_TYPE" : "64",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "本地优惠",
|
||||
"STOREY_TYPE" : "65",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "种草",
|
||||
"STOREY_TYPE" : "66",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "好评",
|
||||
"STOREY_TYPE" : "67",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "热门资讯",
|
||||
"STOREY_TYPE" : "68",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "金刚区",
|
||||
"STOREY_TYPE" : "45",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "今日推荐",
|
||||
"STOREY_TYPE" : "46",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "大牌精选",
|
||||
"STOREY_TYPE" : "47",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "固定广告",
|
||||
"STOREY_TYPE" : "48",
|
||||
"IS_DISPLAY" : "1"
|
||||
},
|
||||
{
|
||||
"STOREY_NM" : "小编推荐",
|
||||
"STOREY_TYPE" : "156",
|
||||
"IS_DISPLAY" : "1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"errCode" : "0"
|
||||
}
|
||||
27
Scripts/ccbLife/ccbLifeAds.js
Normal file
27
Scripts/ccbLife/ccbLifeAds.js
Normal file
@ -0,0 +1,27 @@
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let body = $response.body;
|
||||
let obj = JSON.parse(body);
|
||||
if (url.includes("A3341AB04")) {
|
||||
if (obj?.data?.ICON_SKIN_INFO) {
|
||||
delete obj.data.ICON_SKIN_INFO;
|
||||
}
|
||||
} else if (url.includes("A3341AB03")) {
|
||||
if (obj?.data?.TAG_AD_INFO) {
|
||||
delete obj.data.TAG_AD_INFO;
|
||||
}
|
||||
if (obj?.data?.MEBCT_AD_INFO) {
|
||||
delete obj.data.MEBCT_AD_INFO;
|
||||
}
|
||||
// 我的页-财富会员入口
|
||||
if (obj?.data?.MYSELF_ENTRANCE_AD) {
|
||||
delete obj.data.MYSELF_ENTRANCE_AD;
|
||||
}
|
||||
} else if (url.includes("A3341A120")) {
|
||||
if (obj?.data?.POP_AD_INFO) {
|
||||
delete obj.data.POP_AD_INFO;
|
||||
}
|
||||
}
|
||||
|
||||
body = JSON.stringify(obj);
|
||||
$done({body});
|
||||
453
Scripts/ccbLife/ccbLife_signin.js
Normal file
453
Scripts/ccbLife/ccbLife_signin.js
Normal file
File diff suppressed because one or more lines are too long
273
Scripts/chery/chery.js
Normal file
273
Scripts/chery/chery.js
Normal file
File diff suppressed because one or more lines are too long
189
Scripts/chery/cheryAppSignin.js
Normal file
189
Scripts/chery/cheryAppSignin.js
Normal file
File diff suppressed because one or more lines are too long
18
Scripts/cmschina/cmschina.js
Normal file
18
Scripts/cmschina/cmschina.js
Normal file
@ -0,0 +1,18 @@
|
||||
try {
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
// 去除首页横幅广告
|
||||
if (obj.body?.app_home_banner?.data) {
|
||||
obj.body.app_home_banner.data = [];
|
||||
}
|
||||
|
||||
// 去除理财页横幅广告
|
||||
if (obj.body?.tagbanner2024?.data) {
|
||||
obj.body.tagbanner2024.data = [];
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
} catch (e) {
|
||||
console.log("招商证券广告去除脚本异常:" + e);
|
||||
$done({});
|
||||
}
|
||||
873
Scripts/cnftp.js
Normal file
873
Scripts/cnftp.js
Normal file
@ -0,0 +1,873 @@
|
||||
// 2025-03-08 22:15
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
const isIQY = url.includes("iqiyi.com/");
|
||||
const isMG = url.includes("mgtv.com/");
|
||||
const isYK = url.includes("youku.com/");
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (isIQY) {
|
||||
if (url.includes("/bottom_theme?")) {
|
||||
// 爱奇艺 底部tab
|
||||
if (obj?.cards?.length > 0) {
|
||||
let card = obj.cards[0];
|
||||
if (card?.items?.length > 0) {
|
||||
// 29首页 31会员中心 34我的 35发现 184随刻视频
|
||||
card.items = card.items.filter((i) => ["29", "31", "34"]?.includes(i?._id));
|
||||
// 修复位置
|
||||
for (let i = 0; i < card.items.length; i++) {
|
||||
card.items[i].show_order = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/common_switch?")) {
|
||||
// 爱奇艺 通用配置
|
||||
if (obj?.content?.resource) {
|
||||
const items = [
|
||||
"activities",
|
||||
"ai_guide", // ai指引
|
||||
"cast_device_ad",
|
||||
"flow_promotion", // 播放器 右上角免流按钮
|
||||
"growth_award", // 播放器 会员成长积分
|
||||
"ip_restriction_ad",
|
||||
"member",
|
||||
"ppc_feed_insert",
|
||||
"second_floor_guide",
|
||||
"speed_ad",
|
||||
"vip_tips",
|
||||
"vipgrowth_value", // 播放器 会员成长体系
|
||||
"vr"
|
||||
];
|
||||
for (let i of items) {
|
||||
delete obj.content.resource[i];
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/control/")) {
|
||||
// 爱奇艺 首页左上角天气图标
|
||||
if (obj?.content?.weather) {
|
||||
delete obj.content.weather;
|
||||
}
|
||||
} else if (url.includes("/getMyMenus?")) {
|
||||
// 爱奇艺 我的页面
|
||||
if (obj?.data?.length > 0) {
|
||||
let newMenus = [];
|
||||
for (let item of obj.data) {
|
||||
if (["wd_liebiao_2", "wd_liebiao_3", "wd_liebiao_4"]?.includes(item?.statistic?.block)) {
|
||||
// 精简列表
|
||||
continue;
|
||||
} else {
|
||||
if (item?.menuList?.length > 0) {
|
||||
let newLists = [];
|
||||
for (let i of item.menuList) {
|
||||
if (i?.menuType === 121) {
|
||||
// 121有奖限时问卷
|
||||
continue;
|
||||
} else {
|
||||
newLists.push(i);
|
||||
}
|
||||
}
|
||||
item.menuList = newLists;
|
||||
newMenus.push(item);
|
||||
} else {
|
||||
newMenus.push(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
obj.data = newMenus;
|
||||
}
|
||||
} else if (url.includes("/home_top_menu?")) {
|
||||
// 爱奇艺 顶部tab
|
||||
if (obj?.cards?.length > 0) {
|
||||
let card = obj.cards[0];
|
||||
if (card?.items?.length > 0) {
|
||||
// 1017直播 8196热点 4525518866820370中国梦
|
||||
card.items = card.items.filter((i) => !["1017", "8196", "4525518866820370"]?.includes(i?._id));
|
||||
for (let i = 0; i < card.items.length; i++) {
|
||||
card.items[i].show_order = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/mixer?")) {
|
||||
// 爱奇艺 开屏广告 播放广告
|
||||
if (obj?.errorCode === 0) {
|
||||
const items = ["adSlots", "splashLottieFile", "splashUiConfig"];
|
||||
for (let i of items) {
|
||||
delete obj[i];
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/search.video.iqiyi.com/")) {
|
||||
// 爱奇艺 搜索框填充
|
||||
if (obj?.cache_expired_sec) {
|
||||
obj.cache_expired_sec = 1;
|
||||
}
|
||||
if (obj?.data) {
|
||||
obj.data = [{query: "搜索内容"}];
|
||||
}
|
||||
if (obj?.show_style?.roll_period) {
|
||||
obj.show_style.roll_period = 1000;
|
||||
}
|
||||
} else if (url.includes("/views_category/")) {
|
||||
// 爱奇艺 各菜单列表 剧集 电影 综艺 信息流
|
||||
if (obj?.base?.statistics?.ad_str) {
|
||||
delete obj.base.statistics.ad_str;
|
||||
}
|
||||
if (obj?.cards?.length > 0) {
|
||||
let newCards = [];
|
||||
for (let card of obj.cards) {
|
||||
if (card?.blocks?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let item of card.blocks) {
|
||||
// block_321顶部轮播广告 block_415横版独占广告标题 block_416 横版独占视频广告
|
||||
if (["block_321", "block_415", "block_416"]?.includes(item?.block_name)) {
|
||||
continue;
|
||||
} else if (item?.buttons?.[0]?.id === "ad") {
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(item);
|
||||
}
|
||||
}
|
||||
card.blocks = newItems;
|
||||
newCards.push(card);
|
||||
} else {
|
||||
newCards.push(card);
|
||||
}
|
||||
}
|
||||
obj.cards = newCards;
|
||||
}
|
||||
} else if (url.includes("/views_comment/")) {
|
||||
// 爱奇艺 播放页评论区
|
||||
if (obj?.cards?.length > 0) {
|
||||
// 评论资源位 无alias_name字段的为广告
|
||||
obj.cards = obj.cards.filter(
|
||||
(i) => i.hasOwnProperty("alias_name") && !["comment_resource_card", "comment_resource_convention_card"]?.includes(i?.alias_name)
|
||||
);
|
||||
}
|
||||
} else if (url.includes("/views_home/")) {
|
||||
// 爱奇艺 信息流样式1
|
||||
if (obj?.base?.statistics?.ad_str) {
|
||||
delete obj.base.statistics.ad_str;
|
||||
}
|
||||
if (obj?.cards?.length > 0) {
|
||||
let newCards = [];
|
||||
for (let card of obj.cards) {
|
||||
// ad_mobile_flow信息流广告 ad_trueview信息流广告 focus顶部横版广告 qy_home_vip_opr_banner会员营销banner
|
||||
if (["ad_mobile_flow", "ad_trueview", "focus", "qy_home_vip_opr_banner"]?.includes(card?.alias_name)) {
|
||||
continue;
|
||||
} else {
|
||||
if (card?.top_banner?.l_blocks?.length > 0) {
|
||||
// 模块右边文字按钮
|
||||
for (let item of card.top_banner.l_blocks) {
|
||||
if (item?.buttons?.length > 0) {
|
||||
// 移除按钮 娱乐资源
|
||||
delete item.buttons;
|
||||
}
|
||||
}
|
||||
newCards.push(card);
|
||||
} else {
|
||||
newCards.push(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
obj.cards = newCards;
|
||||
}
|
||||
} else if (url.includes("/views_plt/")) {
|
||||
// 爱奇艺 播放详情页组件
|
||||
if (obj?.kv_pair) {
|
||||
// activity_tab活动标签页 cloud_cinema云影院卡片 vip_fixed_card会员优惠购买卡片
|
||||
const items = ["activity_tab", "cloud_cinema", "vip_fixed_card"];
|
||||
for (let i of items) {
|
||||
delete obj.kv_pair[i];
|
||||
}
|
||||
}
|
||||
if (obj?.cards?.length > 0) {
|
||||
obj.cards = obj.cards.filter(
|
||||
(i) =>
|
||||
![
|
||||
"bi_playlist", // 必播单 当下最热电影推荐
|
||||
// "cloud_cinema_detail_character", // 云影院演员列表
|
||||
// "cloud_cinema_detail_synopsis", // 云影院详情简介
|
||||
// "cloud_cinema_play_detail_tag", // 云影院详情标签
|
||||
"cloud_cinema_play_privilege", // 云影院底部文字
|
||||
"cloud_cinema_playlist", // 云影院播单
|
||||
"cloud_cinema_playlist_1", // 云影院播单2
|
||||
"cloud_cinema_playlist_2", // 云影院播单3
|
||||
// "cloud_cinema_preview_collection", // 云影院预告片选集
|
||||
"cloud_cinema_privilege_icon", // 云影院内容权益
|
||||
"cloud_cinema_star_activities", // 云影院推广横幅
|
||||
"play_ad_no_vip", // 视频关联广告
|
||||
"play_around", // 周边视频 短视频
|
||||
// "play_collection", // 选集
|
||||
"play_custom_card", // 偶像练习生定制卡片
|
||||
// "play_detail_tag", // 详情标签
|
||||
// "play_rap_custom", // 综艺 svip舞台纯享
|
||||
// "play_series_collection", // 综艺 选集 看点
|
||||
"play_splendid_collection", // 综艺 合集 正片没有的都在这里
|
||||
"play_type_topical_card_3", // 综艺 幕后花絮
|
||||
"play_type_topical_card_4", // 综艺 精彩二创
|
||||
"play_variety_custom_2", // 综艺 精彩看点
|
||||
"play_vertical", // 综艺 竖屏内容
|
||||
"play_vip_promotion", // 会员推广
|
||||
"play_water_fall_like", // 猜你喜欢
|
||||
"play_water_fall_like_title", // 猜你喜欢标题
|
||||
"plt_cloud_cinema_photo", // 云影院剧照 清晰度低
|
||||
// "plt_cloud_cinema_short1", // 云影院官方短视频
|
||||
"plt_cloud_cinema_short2", // 云影院短视频剪辑
|
||||
"plt_playlist", // 播单
|
||||
"plt_playlist_1", // 播单2
|
||||
"plt_playlist_2", // 播单3
|
||||
"funny_short_video" // 精彩短视频
|
||||
]?.includes(i?.alias_name)
|
||||
);
|
||||
}
|
||||
} else if (url.includes("/views_search/")) {
|
||||
// 爱奇艺 搜索结果列表
|
||||
if (obj?.cards?.length > 0) {
|
||||
let newCards = [];
|
||||
for (let card of obj.cards) {
|
||||
if (
|
||||
[
|
||||
"ad_mobile_flow", // 信息流广告
|
||||
"hot_query_bottom", // 底部图标
|
||||
"hot_query_search_top_ad", //顶部广告
|
||||
"search_com_related_query", // 相关搜索
|
||||
"search_intent_detail_onesearch", // 为你推荐信息流
|
||||
"search_mid_text_ad", // 底部广告
|
||||
"search_onebox_v2", // 搜索界面 赢年卡
|
||||
"search_small_card_ad", // 搜索短视频小图广告
|
||||
"search_topbanner_text", // 为你推荐标题
|
||||
"search_vip_banner" // vip营销
|
||||
]?.includes(card?.strategy_com_id)
|
||||
) {
|
||||
continue;
|
||||
} else {
|
||||
// 相关内容推荐 相关短视频
|
||||
if (card?.blocks?.length > 0) {
|
||||
let newBlocks = [];
|
||||
for (let i of card.blocks) {
|
||||
if (i.hasOwnProperty("block_name")) {
|
||||
newBlocks.push(i);
|
||||
} else if (i.hasOwnProperty("block_type")) {
|
||||
if (![861, 959]?.includes(i?.block_type)) {
|
||||
// 861搜索页精确搜索时 第一个自动播放的内容
|
||||
// 959广告
|
||||
newBlocks.push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
card.blocks = newBlocks;
|
||||
newCards.push(card);
|
||||
} else {
|
||||
newCards.push(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
obj.cards = newCards;
|
||||
}
|
||||
} else if (url.includes("/waterfall/")) {
|
||||
// 爱奇艺 信息流样式2
|
||||
if (obj?.base?.statistics?.ad_str) {
|
||||
delete obj.base.statistics.ad_str;
|
||||
}
|
||||
if (obj?.cards?.length > 0) {
|
||||
let newCards = [];
|
||||
for (let card of obj.cards) {
|
||||
if (card.hasOwnProperty("block_class")) {
|
||||
// 有block_class字段的为广告
|
||||
continue;
|
||||
} else {
|
||||
if (card?.blocks?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let item of card.blocks) {
|
||||
if (item.hasOwnProperty("block_class")) {
|
||||
// 有block_class字段的为广告
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(item);
|
||||
}
|
||||
}
|
||||
card.blocks = newItems;
|
||||
newCards.push(card);
|
||||
} else {
|
||||
newCards.push(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
obj.cards = newCards;
|
||||
}
|
||||
}
|
||||
} else if (isMG) {
|
||||
if (url.includes("/dynamic/v1/channel/index/")) {
|
||||
// 芒果 首页信息流
|
||||
if (obj?.adInfo) {
|
||||
delete obj.adInfo;
|
||||
}
|
||||
if (obj?.data?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let item of obj.data) {
|
||||
// 908热剧轮播
|
||||
if (item?.moduleEntityId === "91") {
|
||||
// 首页正在追模块
|
||||
if (item?.DSLList?.length > 0) {
|
||||
let newLists = [];
|
||||
for (let i of item.DSLList) {
|
||||
if (i?.data?.items?.length > 0) {
|
||||
let newII = [];
|
||||
for (let ii of i.data.items) {
|
||||
if (ii?.id === 0) {
|
||||
// 正在追模块 艺人周边 小芒
|
||||
continue;
|
||||
} else if (["热门", "推荐"]?.includes(ii?.cornerTitle)) {
|
||||
continue;
|
||||
} else {
|
||||
newII.push(ii);
|
||||
}
|
||||
}
|
||||
i.data.items = newII;
|
||||
newLists.push(i);
|
||||
} else {
|
||||
newLists.push(i);
|
||||
}
|
||||
}
|
||||
item.DSLList = newLists;
|
||||
newItems.push(item);
|
||||
} else {
|
||||
newItems.push(item);
|
||||
}
|
||||
} else if (["842", "2237", "5418"]?.includes(item?.moduleEntityId)) {
|
||||
// 842会员首月特惠 2237横版购物tab 5418横版推广图片
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(item);
|
||||
}
|
||||
}
|
||||
obj.data = newItems;
|
||||
}
|
||||
if (obj?.moduleIDS?.length > 0) {
|
||||
obj.moduleIDS = obj.moduleIDS.filter((i) => !["842", "2237", "5418"]?.includes(i?.moduleEntityId));
|
||||
}
|
||||
} else if (url.includes("/dynamic/v1/channel/vrsList/")) {
|
||||
// 芒果 顶部tab
|
||||
if (obj?.data?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let item of obj.data) {
|
||||
if (item?.vclassId > 100033 && item?.vclassId !== 100160) {
|
||||
// 100033热门 100043短剧 100160会员频道精选 100308短视频
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(item);
|
||||
}
|
||||
}
|
||||
obj.data = newItems;
|
||||
}
|
||||
} else if (url.includes("/mobile/config?")) {
|
||||
// 芒果 底部tab
|
||||
const items = [
|
||||
"XmVideoB",
|
||||
"XmsellSwitch",
|
||||
"damang_duanju_tab",
|
||||
"damang_tab",
|
||||
"dc_adConfig",
|
||||
"relative_ads",
|
||||
"second_floor_guide_switch"
|
||||
];
|
||||
for (let i of items) {
|
||||
if (obj?.data?.[i]) {
|
||||
obj.data[i] = "0";
|
||||
}
|
||||
}
|
||||
if (obj?.data?.XmFsLvlCatAddr) {
|
||||
obj.data.XmFsLvlCatAddr = "";
|
||||
}
|
||||
} else if (url.includes("/mobile/recommend/v2?")) {
|
||||
// 芒果 搜索框填充词
|
||||
if (obj?.data?.default) {
|
||||
obj.data.default = {0: ["搜索内容"]};
|
||||
}
|
||||
if (obj?.data?.recommend) {
|
||||
obj.data.recommend = [];
|
||||
}
|
||||
if (obj?.data?.interval) {
|
||||
obj.data.interval = 1000;
|
||||
}
|
||||
} else if (url.includes("/odin/c1/channel/index?")) {
|
||||
// 芒果 首页信息流
|
||||
if (obj?.data?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let item of obj.data) {
|
||||
if (item?.moduleType === "childslideicon") {
|
||||
// 横版按钮
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(item);
|
||||
}
|
||||
}
|
||||
obj.data = newItems;
|
||||
}
|
||||
} else if (url.includes("/v1/vod/info?")) {
|
||||
// 芒果 播放页详情页组件
|
||||
if (obj?.data?.config?.ad) {
|
||||
// 播放广告
|
||||
obj.data.config.ad.wmShowTime = 0;
|
||||
}
|
||||
if (obj?.data?.config?.videoRcMod) {
|
||||
// 播放弹窗
|
||||
obj.data.config.videoRcMod.toastStatus = 0;
|
||||
obj.data.config.videoRcMod.toastTime = 0;
|
||||
}
|
||||
if (obj?.data?.tabs?.length > 0) {
|
||||
// 播放标签页 1视频 2讨论
|
||||
obj.data.tabs = obj.data.tabs.filter((i) => ["1", "2"]?.includes(i?.type));
|
||||
}
|
||||
if (obj?.data?.template?.modules?.length > 0) {
|
||||
// 播放页组件
|
||||
// 101简介 102点赞评论收藏 201正片列表 205会员衍生模块 206音频有声剧
|
||||
// 202精彩短片 203精选特辑 301热门内容 601周边大放送 701通栏广告 702大风车浮层广告
|
||||
let newMods = [];
|
||||
for (let item of obj.data.template.modules) {
|
||||
if ([202, 203, 301, 601, 701, 702]?.includes(item?.dataType)) {
|
||||
continue;
|
||||
} else {
|
||||
if (item?.clipInfo?.rcInfo) {
|
||||
// 播放界面推荐语
|
||||
delete item.clipInfo.rcInfo;
|
||||
}
|
||||
newMods.push(item);
|
||||
}
|
||||
}
|
||||
obj.data.template.modules = newMods;
|
||||
}
|
||||
if (obj?.data?.template?.theme) {
|
||||
// 播放页主题皮肤
|
||||
delete obj.data.template.theme;
|
||||
}
|
||||
} else if (url.includes("/v3/module/list?")) {
|
||||
// 芒果 我的页面组件
|
||||
if (obj?.data?.list?.length > 0) {
|
||||
let newList = [];
|
||||
for (let item of obj.data.list) {
|
||||
// 1顶部模块 扫一扫 消息 搜索 设置
|
||||
// 2用户信息模块 芒果卡 个人信息
|
||||
// 3推荐位模块 购买会员 会员周边
|
||||
// 4用户内容模块 播放记录 追更
|
||||
// 5大芒计划 创作中心 热门作品 征稿活动
|
||||
// 5我的小芒 电商 订单
|
||||
// 6banner图模块 广告轮播图
|
||||
// 7我的服务 客服 皮肤 意见反馈
|
||||
// 8运营商专区 芒果卡 免流
|
||||
// 8兴趣中心 抓娃娃
|
||||
// 8推荐功能 钱包 福袋 芒果公益
|
||||
if ([3, 5, 6, 8]?.includes(item?.moduleType)) {
|
||||
// 推广模块
|
||||
continue;
|
||||
} else if (item?.moduleType === 2 && item?.title === "用户信息模块") {
|
||||
// 用户信息
|
||||
if (item?.data?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let i of item.data) {
|
||||
if (["领取芒果卡权益", "签到赢积分"]?.includes(i?.title)) {
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(i);
|
||||
}
|
||||
}
|
||||
item.data = newItems;
|
||||
newList.push(item);
|
||||
} else {
|
||||
newList.push(item);
|
||||
}
|
||||
} else if (item?.moduleType === 7 && item?.title === "我的服务") {
|
||||
// 我的服务
|
||||
if (item?.data?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let i of item.data) {
|
||||
if (["功能实验室", "芒果壁纸", "我的音乐"]?.includes(i?.title)) {
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(i);
|
||||
}
|
||||
}
|
||||
item.data = newItems;
|
||||
newList.push(item);
|
||||
} else {
|
||||
newList.push(item);
|
||||
}
|
||||
} else {
|
||||
newList.push(item);
|
||||
}
|
||||
}
|
||||
obj.data.list = newList;
|
||||
}
|
||||
} else if (url.includes("/v10/video/info?")) {
|
||||
// 芒果 播放详情页组件
|
||||
if (obj?.data?.categoryList?.length > 0) {
|
||||
// 1正片 2花絮片段 6设备信息 7未知 8看了还会看 9精华打包 10未知 14vip
|
||||
// 15未知 17周边大放送 18未知 20出品人 22未知 30未知 31系列推荐
|
||||
// 35音乐fm入口 36为你推荐 37音乐fm入口
|
||||
obj.data.categoryList = obj.data.categoryList.filter((i) => ![2, 8, 9, 14, 17]?.includes(i?.dataType));
|
||||
}
|
||||
}
|
||||
} else if (isYK) {
|
||||
if (url.includes("/collect-api/get_push_interval_config_wx?")) {
|
||||
// 优酷 热剧弹窗
|
||||
if (obj?.data) {
|
||||
const items = ["tipContent", "tipContentNew"];
|
||||
for (let i of items) {
|
||||
delete obj.data[i];
|
||||
}
|
||||
}
|
||||
} else if (url.includes("columbus.gateway.new.execute")) {
|
||||
// 优酷 播放详情页组件
|
||||
if (obj?.data?.["2019030100"]?.data) {
|
||||
let objData = obj.data["2019030100"].data;
|
||||
if (objData?.data?.global) {
|
||||
let config = objData.data.global;
|
||||
if (config?.PHONE_DETAIL_TOP_TAB?.pageTabs?.length > 0) {
|
||||
// detail视频 list热门 planet讨论
|
||||
config.PHONE_DETAIL_TOP_TAB.pageTabs = config.PHONE_DETAIL_TOP_TAB.pageTabs.filter((i) =>
|
||||
["detail", "planet"]?.includes(i?.code)
|
||||
);
|
||||
}
|
||||
}
|
||||
if (objData?.nodes?.length > 0) {
|
||||
if (objData?.nodes?.length === 1) {
|
||||
let node0 = objData.nodes[0];
|
||||
if (node0?.nodes?.length > 0) {
|
||||
if (node0?.typeName === "NORMAL") {
|
||||
node0.nodes = node0.nodes.filter(
|
||||
(i) =>
|
||||
![
|
||||
"PHONE_CHD_AGE_DETAIL_2",
|
||||
"PHONE_CHILD_SERIES_A",
|
||||
"PHONE_CHILD_STAR_A",
|
||||
"PHONE_DEFALT_SCROLL_C",
|
||||
"Phone运营banner",
|
||||
"播放页触达组件", // 新版
|
||||
"播放页广告组件",
|
||||
"播放页会员引导组件",
|
||||
"播放页活动组件",
|
||||
"播放页全屏播后推荐组件",
|
||||
"播放页少儿品牌专区组件",
|
||||
"播放页推荐组件",
|
||||
"播放页用户触达组件", // 旧版
|
||||
"播放页有料不能停组件",
|
||||
"球区自动化组件",
|
||||
"优酷购"
|
||||
]?.includes(i?.typeName)
|
||||
);
|
||||
} else if (node0?.typeName === "FEED_CHILD_DRAWER_PAGINATION") {
|
||||
// 播放页推荐信息流
|
||||
if (node0?.nodes) {
|
||||
node0.nodes = [];
|
||||
}
|
||||
} else if (node0?.typeName === "FEED_DRAWER_PAGINATION") {
|
||||
// 播放页推荐信息流
|
||||
if (node0?.nodes) {
|
||||
node0.nodes = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
objData.nodes = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("columbus.home.feed/")) {
|
||||
// 优酷 首页信息流
|
||||
if (obj?.data?.["2019061000"]?.data) {
|
||||
let objData = obj.data["2019061000"].data;
|
||||
if (objData?.nodes?.length > 0) {
|
||||
let newNodes1 = [];
|
||||
for (let node1 of objData.nodes) {
|
||||
if (node1?.typeName === "PHONE_FEED_CARD_GROUP") {
|
||||
if (node1?.nodes?.length > 0) {
|
||||
let newNode2 = [];
|
||||
for (let node2 of node1.nodes) {
|
||||
if (node2?.typeName === "PHONE_FEED_CARD_S_AD") {
|
||||
// 首页 四格小图广告
|
||||
continue;
|
||||
} else if (node2?.typeName === "PHONE_H_UC_AD") {
|
||||
// 首页 横版独占广告
|
||||
continue;
|
||||
} else {
|
||||
newNode2.push(node2);
|
||||
}
|
||||
}
|
||||
node1.nodes = newNode2;
|
||||
newNodes1.push(node1);
|
||||
} else {
|
||||
newNodes1.push(node1);
|
||||
}
|
||||
} else {
|
||||
newNodes1.push(node1);
|
||||
}
|
||||
}
|
||||
objData.nodes = newNodes1;
|
||||
}
|
||||
}
|
||||
} else if (url.includes("columbus.home.query/")) {
|
||||
// 优酷 各菜单列表 剧集 电影 综艺 信息流
|
||||
if (obj?.data?.["2019061000"]?.data) {
|
||||
let objData = obj.data["2019061000"].data;
|
||||
if (objData?.data?.indexPositionResult?.length > 0) {
|
||||
// 首页 第零层级 二楼
|
||||
objData.data.indexPositionResult = [];
|
||||
}
|
||||
if (objData?.nodes?.length > 0) {
|
||||
let newNodes1 = [];
|
||||
for (let node1 of objData.nodes) { // 第一层级node,属于obj.data[2019061000].data.nodes
|
||||
if (["CHILD", "COMIC2", "20230929GREATWORKMFK"]?.includes(node1?.data?.nodeKey)) {
|
||||
// 首页 少儿 动漫 国庆长假免费看
|
||||
continue;
|
||||
} else {
|
||||
if (node1?.data?.indexPositionResult?.length > 0) {
|
||||
// 剧集 电影 二楼
|
||||
node1.data.indexPositionResult = [];
|
||||
}
|
||||
if (node1?.data?.refreshImg) {
|
||||
// 电影 综艺 纪录片 下拉刷新的背景图片
|
||||
delete node1.data.refreshImg;
|
||||
}
|
||||
// 首页 剧集 电影 全都有信息流广告
|
||||
// 去掉nodeKey的判断 直接处理下一层级
|
||||
if (node1?.nodes?.length > 0) {
|
||||
let newNode2 = [];
|
||||
for (let node2 of node1.nodes) { // 第二层级循环 node
|
||||
if (node2?.data?.crmSale) {
|
||||
// 季卡会员横幅
|
||||
delete node2.data.crmSale;
|
||||
}
|
||||
if (["UC广告抽屉", "橱窗广告"].includes(node2?.typeName)) {
|
||||
// 横版独占广告
|
||||
continue;
|
||||
} else if (node2?.id === 31476) {
|
||||
// 正在热播
|
||||
if (node2?.data?.keywords?.length > 0) {
|
||||
// 滚动热词
|
||||
delete node2.data.keywords;
|
||||
}
|
||||
} else if (node2?.id === 35505) {
|
||||
// 优惠购会员横幅
|
||||
continue;
|
||||
} else if (node2?.id === 37335) {
|
||||
// 首页二楼
|
||||
continue;
|
||||
} else {
|
||||
// 16214 猜你在追
|
||||
// 38820 首页顶部轮播图
|
||||
if (node2?.nodes?.length > 0) {
|
||||
let newNode3 = [];
|
||||
for (let node3 of node2.nodes) { // 第三层级循环 node
|
||||
if (
|
||||
[
|
||||
"PHONE_FEED_CARD_B_AD", // 横版独占广告
|
||||
"PHONE_FEED_CARD_S_AD", // 四格小图广告
|
||||
"PHONE_H_UC_AD", // 剧集 横版独占广告
|
||||
"PHONE_IMG_A", // 剧集 开通会员卡片
|
||||
"PHONE_YK_AD_BANNER" // 剧集 横版独占广告
|
||||
].includes(node3?.typeName)
|
||||
) {
|
||||
continue;
|
||||
} else if (node3.id === 272768) { // 首页的轮播广告
|
||||
console.log("移除首页的轮播广告");
|
||||
continue;
|
||||
} else {
|
||||
if (node3?.nodes?.length > 0) {
|
||||
let newNode4 = [];
|
||||
for (let node4 of node3.nodes) { // 第四层级循环
|
||||
if (node4?.typeName === "PHONE_FEED_CARD_S_AD") {
|
||||
// 剧集 四格小图广告
|
||||
continue;
|
||||
} else if (node4?.data.hasOwnProperty("ad")) {
|
||||
// 有ad字段的为广告
|
||||
continue;
|
||||
} else {
|
||||
newNode4.push(node4);
|
||||
}
|
||||
}
|
||||
node3.nodes = newNode4;
|
||||
newNode3.push(node3);
|
||||
} else {
|
||||
newNode3.push(node3);
|
||||
}
|
||||
}
|
||||
}
|
||||
node2.nodes = newNode3;
|
||||
newNode2.push(node2);
|
||||
} else {
|
||||
newNode2.push(node2);
|
||||
}
|
||||
}
|
||||
}
|
||||
node1.nodes = newNode2;
|
||||
}
|
||||
newNodes1.push(node1);
|
||||
}
|
||||
}
|
||||
objData.nodes = newNodes1;
|
||||
}
|
||||
}
|
||||
} else if (url.includes("columbus.uc.query/")) {
|
||||
// 优酷 我的页面组件
|
||||
if (obj?.data?.["2019061000"]?.data) {
|
||||
let objData = obj.data["2019061000"].data;
|
||||
if (objData?.nodes?.length > 0) {
|
||||
let objNodes = objData.nodes[0];
|
||||
if (objNodes?.nodes?.length > 0) {
|
||||
let newNodes = [];
|
||||
for (let item of objNodes.nodes) {
|
||||
if (item?.id === 32133) {
|
||||
// 横幅视频广告
|
||||
continue;
|
||||
} else if (item?.id === 32775) {
|
||||
// 个人中心二楼
|
||||
continue;
|
||||
} else if (item?.id === 22570) {
|
||||
// 横版轮播图
|
||||
continue;
|
||||
} else if (item?.id === 28912) {
|
||||
// 我的下载 收藏 购买 场景
|
||||
if (item?.nodes?.length > 0) {
|
||||
let newII = [];
|
||||
for (let ii of item.nodes) {
|
||||
if (ii?.id === 110429) {
|
||||
// 免费兑换VIP
|
||||
continue;
|
||||
}
|
||||
newII.push(ii);
|
||||
}
|
||||
item.nodes = newII;
|
||||
newNodes.push(item);
|
||||
} else {
|
||||
newNodes.push(item);
|
||||
}
|
||||
} else if (item?.id === 35942) {
|
||||
// 我的专属推荐
|
||||
continue;
|
||||
} else if (item?.id === 36014) {
|
||||
// 业务区 星光币 优酷购 数字藏品
|
||||
continue;
|
||||
} else if (item?.id === 36015) {
|
||||
// 功能区 卡卷包 商城 设置
|
||||
if (item?.nodes?.length > 0) {
|
||||
let node0 = item.nodes[0];
|
||||
if (node0?.nodes?.length > 0) {
|
||||
let newII = [];
|
||||
for (let ii of node0.nodes) {
|
||||
// 683364卡卷包 683359个性商城 683501TV助手 683367设置
|
||||
// 683368我的客服 683502意见反馈 683366有奖调研 683372更多
|
||||
if ([683367, 683368, 683372, 683502]?.includes(ii?.id)) {
|
||||
newII.push(ii);
|
||||
}
|
||||
}
|
||||
node0.nodes = newII;
|
||||
newNodes.push(item);
|
||||
} else {
|
||||
newNodes.push(item);
|
||||
}
|
||||
} else {
|
||||
newNodes.push(item);
|
||||
}
|
||||
} else if (item?.id === 38466) {
|
||||
// 横幅广告
|
||||
continue;
|
||||
} else {
|
||||
newNodes.push(item);
|
||||
}
|
||||
}
|
||||
objNodes.nodes = newNodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("columbus.ycp.query/")) {
|
||||
// 优酷 播放页评论区
|
||||
if (obj?.data?.["2019061000"]?.data) {
|
||||
let objData = obj.data["2019061000"].data;
|
||||
if (objData?.nodes?.length > 0) {
|
||||
let objNodes = objData.nodes[0];
|
||||
if (objNodes?.nodes?.length > 0) {
|
||||
let newNodes = [];
|
||||
for (let item of objNodes.nodes) {
|
||||
if (item?.id === 23242) {
|
||||
// 评论区顶部
|
||||
if (item?.nodes?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let i of item.nodes) {
|
||||
if (i?.typeName === "COMPONENT_YCP_NOTICE") {
|
||||
// 评论区守则 轮播通告
|
||||
continue;
|
||||
} else if (i?.id === 113941) {
|
||||
// 明星空降评论区
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(i);
|
||||
}
|
||||
}
|
||||
item.nodes = newItems;
|
||||
newNodes.push(item);
|
||||
} else {
|
||||
newNodes.push(item);
|
||||
}
|
||||
} else if (item?.id === 23243) {
|
||||
// 评论区留言
|
||||
if (item?.nodes?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let i of item.nodes) {
|
||||
if (i?.id === -1000) {
|
||||
// 评论区广告
|
||||
continue;
|
||||
} else {
|
||||
newItems.push(i);
|
||||
}
|
||||
}
|
||||
item.nodes = newItems;
|
||||
newNodes.push(item);
|
||||
} else {
|
||||
newNodes.push(item);
|
||||
}
|
||||
} else {
|
||||
newNodes.push(item);
|
||||
}
|
||||
}
|
||||
objNodes.nodes = newNodes;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("haidai.lantern.appconfig.get/")) {
|
||||
// 优酷 底部tab
|
||||
if (obj?.data?.model?.configInfo?.bottomNavigate) {
|
||||
let bottom = obj.data.model.configInfo.bottomNavigate;
|
||||
if (bottom?.data?.bottomTabList?.length > 0) {
|
||||
// HOME首页 DONGTAI短视频 SEARCH淘好片 VIP_MEMBER会员 NEW_UCENTER我的
|
||||
bottom.data.bottomTabList = bottom.data.bottomTabList.filter((i) =>
|
||||
["HOME", "NEW_UCENTER", "VIP_MEMBER"]?.includes(i?.type)
|
||||
);
|
||||
// 修复位置
|
||||
for (let i = 0; i < bottom.data.bottomTabList.length; i++) {
|
||||
bottom.data.bottomTabList[i].menuIndex = i + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (url.includes("huluwa.dispatcher.youthmode.config2/")) {
|
||||
// 优酷 青少年模式弹窗
|
||||
if (obj?.data?.result) {
|
||||
obj.data.result = {};
|
||||
}
|
||||
} else if (url.includes("play.ups.appinfo.get/")) {
|
||||
// 优酷 开屏广告 播放广告
|
||||
if (obj?.data?.data) {
|
||||
const items = ["ad", "watermark", "ykad"];
|
||||
for (let i of items) {
|
||||
delete obj.data.data[i];
|
||||
}
|
||||
}
|
||||
} else if (url.includes("soku.yksearch/")) {
|
||||
// 优酷 搜索页面组件
|
||||
if (obj?.data?.nodes?.length > 0) {
|
||||
// 仅保留搜索tab
|
||||
obj.data.nodes = obj.data.nodes.filter((i) => i.hasOwnProperty("data"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
4
Scripts/coco.js
Normal file
4
Scripts/coco.js
Normal file
@ -0,0 +1,4 @@
|
||||
let obj=JSON.parse($response.body);
|
||||
delete obj.data.top_background_url ;
|
||||
delete obj.data.bottom_banner_list ;
|
||||
$done({body: JSON.stringify(obj)});
|
||||
344
Scripts/cookie/get_cookie.js
Normal file
344
Scripts/cookie/get_cookie.js
Normal file
File diff suppressed because one or more lines are too long
84
Scripts/coolapk.js
Normal file
84
Scripts/coolapk.js
Normal file
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* @function 酷安广告
|
||||
* @date 2023-11-15 17:20:00
|
||||
* @quote RuCu6
|
||||
*/
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/feed/detail")) {
|
||||
if (obj.data?.hotReplyRows?.length > 0) {
|
||||
obj.data.hotReplyRows = obj.data.hotReplyRows.filter((item) => item?.id);
|
||||
}
|
||||
if (obj.data?.topReplyRows?.length > 0) {
|
||||
obj.data.topReplyRows = obj.data.topReplyRows.filter((item) => item?.id);
|
||||
}
|
||||
const item = ["detailSponsorCard", "include_goods", "include_goods_ids"];
|
||||
for (let i of item) {
|
||||
if (obj.data?.[i]) {
|
||||
obj.data[i] = [];
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/feed/replyList")) {
|
||||
if (obj.data?.length > 0) {
|
||||
obj.data = obj.data.filter((item) => item?.id);
|
||||
}
|
||||
} else if (url.includes("/main/dataList")) {
|
||||
if (obj.data?.length > 0) {
|
||||
obj.data = obj.data.filter((item) => !(item?.entityTemplate === "sponsorCard" || item?.title === "精选配件"));
|
||||
}
|
||||
} else if (url.includes("/main/indexV8")) {
|
||||
if (obj.data?.length > 0) {
|
||||
obj.data = obj.data.filter(
|
||||
(item) =>
|
||||
!(
|
||||
item?.entityTemplate === "sponsorCard" ||
|
||||
item?.entityId === 8639 ||
|
||||
item?.entityId === 29349 ||
|
||||
item?.entityId === 33006 ||
|
||||
item?.entityId === 32557 ||
|
||||
item?.title?.includes("值得买") ||
|
||||
item?.title?.includes("红包")
|
||||
)
|
||||
);
|
||||
}
|
||||
} else if (url.includes("/main/init")) {
|
||||
// 整体配置
|
||||
if (obj.data?.length > 0) {
|
||||
let newDatas = [];
|
||||
for (let item of obj.data) {
|
||||
// 944热门搜索 945开屏广告 6390首页Tab
|
||||
if ([944, 945, 6390]?.includes(item?.entityId)) {
|
||||
continue;
|
||||
} else {
|
||||
if (item?.entityId === 20131) {
|
||||
// 发现页 顶部项目
|
||||
if (item?.entities?.length > 0) {
|
||||
let newEnts = [];
|
||||
for (let i of item.entities) {
|
||||
if (i?.title === "酷品") {
|
||||
continue;
|
||||
} else {
|
||||
newEnts.push(i);
|
||||
}
|
||||
}
|
||||
item.entities = newEnts;
|
||||
}
|
||||
}
|
||||
newDatas.push(item);
|
||||
}
|
||||
}
|
||||
obj.data = newDatas;
|
||||
}
|
||||
} else if (url.includes("/page/dataList")) {
|
||||
if (obj.data?.length > 0) {
|
||||
obj.data = obj.data.filter(
|
||||
(item) =>
|
||||
!(item?.title === "酷安热搜" || item?.entityTemplate === "imageScaleCard" || item?.entityTemplate === "sponsorCard")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
9
Scripts/cyys.js
Normal file
9
Scripts/cyys.js
Normal file
@ -0,0 +1,9 @@
|
||||
let obj=JSON.parse($response.body);
|
||||
delete obj.data.INDEX_SLOT_01;
|
||||
delete obj.data.INDEX_SLOT_02;
|
||||
obj.data?.INDEX_TOP_BANNER?.contents?.forEach(item => {
|
||||
delete item.bubble;
|
||||
delete item.figure;
|
||||
item.value = "https://raw.githubusercontent.com/jizhi0520/QX/main/cyyss.jpg";
|
||||
});
|
||||
$done({body: JSON.stringify(obj)});
|
||||
37
Scripts/dianyinglieshou.js
Normal file
37
Scripts/dianyinglieshou.js
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 电影猎手
|
||||
* @date 2024-10-11 20:16:13
|
||||
*/
|
||||
|
||||
let requestUrl = $request.url;
|
||||
let responseBody = $response.body;
|
||||
|
||||
let obj = JSON.parse(responseBody);
|
||||
|
||||
// ^https:\/\/app-v1\.ecoliving168\.com\/api\/v1\/movie\/index_recommend\? url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/dianyinglieshou.js
|
||||
//
|
||||
// hostname = app-v1.ecoliving168.com
|
||||
if (requestUrl.includes("/api/v1/movie/index_recommend?")) {
|
||||
// 判断obj.data是否存在且是数组
|
||||
if (Array.isArray(obj.data)) {
|
||||
console.log('去广告开始💕');
|
||||
// 遍历obj.data中的每个元素
|
||||
obj.data = obj.data.filter(item => {
|
||||
// 如果item.layout等于'advert_self',则不保留这个元素
|
||||
if (item.layout === 'advert_self') {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 如果item.list是数组,则遍历并处理list中的元素
|
||||
if (Array.isArray(item.list)) {
|
||||
item.list = item.list.filter(subItem => subItem.type !== 3);
|
||||
}
|
||||
|
||||
return true; // 保留其他元素
|
||||
});
|
||||
}
|
||||
console.log('去广告结束💕');
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
78
Scripts/didi/didiAds.js
Normal file
78
Scripts/didi/didiAds.js
Normal file
@ -0,0 +1,78 @@
|
||||
// 2024-08-20 09:49
|
||||
/*需要分流禁用掉
|
||||
ip-cidr, 123.207.209.39/32, reject
|
||||
ip-cidr, 123.207.209.60/32, reject
|
||||
ip-cidr, 139.199.240.12/32, reject
|
||||
ip-cidr, 162.14.157.2/32, reject
|
||||
ip-cidr, 162.14.157.24/32, reject
|
||||
群友EDDA分享
|
||||
ip-cidr, 139.199.240.15/32, reject
|
||||
*/
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/other/pGetSceneList")) {
|
||||
if (obj.data?.scene_list instanceof Array) {
|
||||
obj.data.scene_list = obj.data.scene_list.filter(item => item.text !== "优惠商城");
|
||||
}
|
||||
if (obj.data?.show_data instanceof Array) {
|
||||
obj.data.show_data.forEach((block) => {
|
||||
if (block.scene_ids instanceof Array) {
|
||||
block.scene_ids = block.scene_ids.filter(id => id !== "scene_coupon_mall");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (url.includes("/homepage/v1/core")) {
|
||||
const keepNavIds = ['dache_anycar', 'driverservice', 'bike'];
|
||||
if (obj.data?.order_cards?.nav_list_card?.data) {
|
||||
obj.data.order_cards.nav_list_card.data = obj.data.order_cards.nav_list_card.data.filter(item => keepNavIds.includes(item.nav_id));
|
||||
}
|
||||
const keepBottomNavIds = ['v6x_home', 'home_page', 'user_center'];
|
||||
if (obj.data?.disorder_cards?.bottom_nav_list?.data) {
|
||||
obj.data.disorder_cards.bottom_nav_list.data = obj.data.disorder_cards.bottom_nav_list.data.filter(item => keepBottomNavIds.includes(item.id));
|
||||
}
|
||||
}
|
||||
|
||||
if (url.includes("/ota/na/yuantu/infoList")) {
|
||||
if (obj.data?.disorder_cards?.top_banner_card?.data[0]?.T === "yuentu_top_banner") {
|
||||
obj.data.disorder_cards.top_banner_card.data.splice(0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (url.includes("/gulfstream/passenger-center/v2/other/pInTripLayout")) {
|
||||
const namesToRemove = ["passenger_common_casper"];
|
||||
obj.data.order_components = obj.data.order_components.filter(
|
||||
component => !(component.name && namesToRemove.includes(component.name))
|
||||
);
|
||||
}
|
||||
|
||||
if (url.includes("/usercenter/me")) {
|
||||
const excludedTitles = ['天天领福利', '金融服务', '更多服务', '企业服务', '安全中心'];
|
||||
|
||||
if (obj.data?.cards) {
|
||||
obj.data.cards = obj.data.cards.filter(card => !excludedTitles.includes(card.title));
|
||||
|
||||
obj.data.cards.forEach(card => {
|
||||
if (card.tag === "wallet") {
|
||||
if (card.items) {
|
||||
card.items = card.items.filter(item => item.title === "优惠券");
|
||||
}
|
||||
if (card.card_type === 4 && card.bottom_items) {
|
||||
card.bottom_items = card.bottom_items.filter(item => item.title === "省钱套餐" || item.title === "天天神券");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 微信小程序
|
||||
if (url.includes("/common/v5")) {
|
||||
obj.data.sections = obj.data.sections.filter(item => ["center_v2", "head_v2", "core_function"].includes(item.sectionId));
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
42
Scripts/douyin/my_girl_video.js
Normal file
42
Scripts/douyin/my_girl_video.js
Normal file
File diff suppressed because one or more lines are too long
172
Scripts/douyu/yubaSign.js
Normal file
172
Scripts/douyu/yubaSign.js
Normal file
File diff suppressed because one or more lines are too long
146
Scripts/emby/unlock2.js
Normal file
146
Scripts/emby/unlock2.js
Normal file
@ -0,0 +1,146 @@
|
||||
/*
|
||||
引用地址 https://github.com/qiangxinglin/Emby/blob/main/scripts/emby.js
|
||||
2020-12-20
|
||||
|
||||
[rewrite_local]
|
||||
^https?:\/\/mb3admin\.com\/admin\/service(\/registration\/validateDevice|\/appstore\/register|\/registration\/validate|\/registration\/getStatus|\/supporter\/retrievekey) url script-echo-response https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/emby/unlock2.js
|
||||
|
||||
[mitm]
|
||||
hostname = mb3admin.com
|
||||
*/
|
||||
|
||||
var url = $request.url;
|
||||
const myStatus = "HTTP/1.1 200 OK";
|
||||
|
||||
const myHeaders = {
|
||||
Crack: "KS",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Headers": "*",
|
||||
"Access-Control-Allow-Method": "*",
|
||||
"Access-Control-Allow-Credentials": "true"
|
||||
};
|
||||
|
||||
if (url.indexOf("/admin/service/registration/validateDevice") != -1) {
|
||||
obj = {
|
||||
cacheExpirationDays: 365,
|
||||
message: "Device Valid",
|
||||
resultCode: "GOOD"
|
||||
};
|
||||
} else if (url.indexOf("/admin/service/appstore/register") != -1) {
|
||||
obj = {
|
||||
featId: "",
|
||||
registered: true,
|
||||
expDate: "2099-01-01",
|
||||
key: ""
|
||||
};
|
||||
} else if (url.indexOf("/admin/service/registration/validate") != -1) {
|
||||
obj = {
|
||||
featId: "",
|
||||
registered: true,
|
||||
expDate: "2099-01-01",
|
||||
key: ""
|
||||
};
|
||||
} else if (url.indexOf("/admin/service/registration/getStatus") != -1) {
|
||||
obj = {
|
||||
planType: "Cracked",
|
||||
deviceStatus: "",
|
||||
subscriptions: []
|
||||
};
|
||||
} else if (url.indexOf("/admin/service/supporter/retrievekey") != -1) {
|
||||
obj = {
|
||||
Success: false,
|
||||
ErrorMessage: "Supporter not found"
|
||||
};
|
||||
}
|
||||
|
||||
myData = JSON.stringify(obj);
|
||||
|
||||
const myResponse = {
|
||||
status: myStatus,
|
||||
headers: myHeaders, // Optional.
|
||||
body: myData // Optional.
|
||||
};
|
||||
|
||||
var $util = util();
|
||||
//$util.notify('Emby Premiere 已激活');
|
||||
$util.done(myResponse);
|
||||
|
||||
function util() {
|
||||
const isRequest = typeof $request != "undefined";
|
||||
const isSurge = typeof $httpClient != "undefined";
|
||||
const isQuanX = typeof $task != "undefined";
|
||||
const notify = (title, subtitle = "", message = "") => {
|
||||
if (isQuanX) $notify(title, subtitle, message);
|
||||
if (isSurge) $notification.post(title, subtitle, message);
|
||||
};
|
||||
const write = (value, key) => {
|
||||
if (isQuanX) return $prefs.setValueForKey(value, key);
|
||||
if (isSurge) return $persistentStore.write(value, key);
|
||||
};
|
||||
const read = (key) => {
|
||||
if (isQuanX) return $prefs.valueForKey(key);
|
||||
if (isSurge) return $persistentStore.read(key);
|
||||
};
|
||||
const adapterStatus = (response) => {
|
||||
if (response) {
|
||||
if (response.status) {
|
||||
response["statusCode"] = response.status;
|
||||
} else if (response.statusCode) {
|
||||
response["status"] = response.statusCode;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
};
|
||||
const get = (options, callback) => {
|
||||
if (isQuanX) {
|
||||
if (typeof options == "string")
|
||||
options = {
|
||||
url: options,
|
||||
method: "GET"
|
||||
};
|
||||
$task.fetch(options).then(
|
||||
(response) => {
|
||||
callback(null, adapterStatus(response), response.body);
|
||||
},
|
||||
(reason) => callback(reason.error, null, null)
|
||||
);
|
||||
}
|
||||
if (isSurge)
|
||||
$httpClient.get(options, (error, response, body) => {
|
||||
callback(error, adapterStatus(response), body);
|
||||
});
|
||||
};
|
||||
const post = (options, callback) => {
|
||||
if (isQuanX) {
|
||||
if (typeof options == "string")
|
||||
options = {
|
||||
url: options,
|
||||
method: "POST"
|
||||
};
|
||||
$task.fetch(options).then(
|
||||
(response) => {
|
||||
callback(null, adapterStatus(response), response.body);
|
||||
},
|
||||
(reason) => callback(reason.error, null, null)
|
||||
);
|
||||
}
|
||||
if (isSurge) {
|
||||
$httpClient.post(options, (error, response, body) => {
|
||||
callback(error, adapterStatus(response), body);
|
||||
});
|
||||
}
|
||||
};
|
||||
const done = (value = {}) => {
|
||||
if (isQuanX) return $done(value);
|
||||
if (isSurge) isRequest ? $done(value) : $done();
|
||||
};
|
||||
return {
|
||||
isRequest,
|
||||
notify,
|
||||
write,
|
||||
read,
|
||||
get,
|
||||
post,
|
||||
done
|
||||
};
|
||||
}
|
||||
3
Scripts/ems.js
Normal file
3
Scripts/ems.js
Normal file
@ -0,0 +1,3 @@
|
||||
let obj = JSON.parse($response.body);
|
||||
obj.info.moduleJson = JSON.stringify(JSON.parse(obj.info.moduleJson).filter(item => !item.moduleName.includes("广告")));
|
||||
$done({body: JSON.stringify(obj)});
|
||||
894
Scripts/env/Env.js
vendored
Normal file
894
Scripts/env/Env.js
vendored
Normal file
@ -0,0 +1,894 @@
|
||||
function Env(name, opts) {
|
||||
class Http {
|
||||
constructor(env) {
|
||||
this.env = env
|
||||
}
|
||||
|
||||
send(opts, method = 'GET') {
|
||||
opts = typeof opts === 'string' ? { url: opts } : opts
|
||||
let sender = this.get
|
||||
if (method === 'POST') {
|
||||
sender = this.post
|
||||
}
|
||||
|
||||
const delayPromise = (promise, delay = 1000) => {
|
||||
return Promise.race([
|
||||
promise,
|
||||
new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error('请求超时'))
|
||||
}, delay)
|
||||
})
|
||||
])
|
||||
}
|
||||
|
||||
const call = new Promise((resolve, reject) => {
|
||||
sender.call(this, opts, (err, resp, body) => {
|
||||
if (err) reject(err)
|
||||
else resolve(resp)
|
||||
})
|
||||
})
|
||||
|
||||
return opts.timeout ? delayPromise(call, opts.timeout) : call
|
||||
}
|
||||
|
||||
get(opts) {
|
||||
return this.send.call(this.env, opts)
|
||||
}
|
||||
|
||||
post(opts) {
|
||||
return this.send.call(this.env, opts, 'POST')
|
||||
}
|
||||
}
|
||||
|
||||
return new (class {
|
||||
constructor(name, opts) {
|
||||
this.logLevels = { debug: 0, info: 1, warn: 2, error: 3 }
|
||||
this.logLevelPrefixs = {
|
||||
debug: '[DEBUG] ',
|
||||
info: '[INFO] ',
|
||||
warn: '[WARN] ',
|
||||
error: '[ERROR] '
|
||||
}
|
||||
this.logLevel = 'info'
|
||||
this.name = name
|
||||
this.http = new Http(this)
|
||||
this.data = null
|
||||
this.dataFile = 'box.dat'
|
||||
this.logs = []
|
||||
this.isMute = false
|
||||
this.isNeedRewrite = false
|
||||
this.logSeparator = '\n'
|
||||
this.encoding = 'utf-8'
|
||||
this.startTime = new Date().getTime()
|
||||
Object.assign(this, opts)
|
||||
this.log('', `🔔${this.name}, 开始!`)
|
||||
}
|
||||
|
||||
getEnv() {
|
||||
if ('undefined' !== typeof $environment && $environment['surge-version'])
|
||||
return 'Surge'
|
||||
if ('undefined' !== typeof $environment && $environment['stash-version'])
|
||||
return 'Stash'
|
||||
if ('undefined' !== typeof module && !!module.exports) return 'Node.js'
|
||||
if ('undefined' !== typeof $task) return 'Quantumult X'
|
||||
if ('undefined' !== typeof $loon) return 'Loon'
|
||||
if ('undefined' !== typeof $rocket) return 'Shadowrocket'
|
||||
}
|
||||
|
||||
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(str, defaultValue = null) {
|
||||
try {
|
||||
return JSON.parse(str)
|
||||
} catch {
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
toStr(obj, defaultValue = null, ...args) {
|
||||
try {
|
||||
return JSON.stringify(obj, ...args)
|
||||
} catch {
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
getjson(key, defaultValue) {
|
||||
let json = defaultValue
|
||||
const val = this.getdata(key)
|
||||
if (val) {
|
||||
try {
|
||||
json = JSON.parse(this.getdata(key))
|
||||
} catch {}
|
||||
}
|
||||
return json
|
||||
}
|
||||
|
||||
setjson(val, key) {
|
||||
try {
|
||||
return this.setdata(JSON.stringify(val), key)
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
getScript(url) {
|
||||
return new Promise((resolve) => {
|
||||
this.get({ url }, (err, resp, body) => resolve(body))
|
||||
})
|
||||
}
|
||||
|
||||
runScript(script, runOpts) {
|
||||
return new Promise((resolve) => {
|
||||
let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi')
|
||||
httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi
|
||||
let httpapi_timeout = this.getdata(
|
||||
'@chavy_boxjs_userCfgs.httpapi_timeout'
|
||||
)
|
||||
httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20
|
||||
httpapi_timeout =
|
||||
runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout
|
||||
const [key, addr] = httpapi.split('@')
|
||||
const opts = {
|
||||
url: `http://${addr}/v1/scripting/evaluate`,
|
||||
body: {
|
||||
script_text: script,
|
||||
mock_type: 'cron',
|
||||
timeout: httpapi_timeout
|
||||
},
|
||||
headers: {
|
||||
'X-Key': key,
|
||||
'Accept': '*/*'
|
||||
},
|
||||
policy: 'DIRECT',
|
||||
timeout: httpapi_timeout
|
||||
}
|
||||
this.post(opts, (err, resp, body) => resolve(body))
|
||||
}).catch((e) => this.logErr(e))
|
||||
}
|
||||
|
||||
loaddata() {
|
||||
if (this.isNode()) {
|
||||
this.fs = this.fs ? this.fs : require('fs')
|
||||
this.path = this.path ? this.path : require('path')
|
||||
const curDirDataFilePath = this.path.resolve(this.dataFile)
|
||||
const rootDirDataFilePath = this.path.resolve(
|
||||
process.cwd(),
|
||||
this.dataFile
|
||||
)
|
||||
const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
|
||||
const isRootDirDataFile =
|
||||
!isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
|
||||
if (isCurDirDataFile || isRootDirDataFile) {
|
||||
const datPath = isCurDirDataFile
|
||||
? curDirDataFilePath
|
||||
: rootDirDataFilePath
|
||||
try {
|
||||
return JSON.parse(this.fs.readFileSync(datPath))
|
||||
} catch (e) {
|
||||
return {}
|
||||
}
|
||||
} else return {}
|
||||
} else return {}
|
||||
}
|
||||
|
||||
writedata() {
|
||||
if (this.isNode()) {
|
||||
this.fs = this.fs ? this.fs : require('fs')
|
||||
this.path = this.path ? this.path : require('path')
|
||||
const curDirDataFilePath = this.path.resolve(this.dataFile)
|
||||
const rootDirDataFilePath = this.path.resolve(
|
||||
process.cwd(),
|
||||
this.dataFile
|
||||
)
|
||||
const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath)
|
||||
const isRootDirDataFile =
|
||||
!isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath)
|
||||
const jsondata = JSON.stringify(this.data)
|
||||
if (isCurDirDataFile) {
|
||||
this.fs.writeFileSync(curDirDataFilePath, jsondata)
|
||||
} else if (isRootDirDataFile) {
|
||||
this.fs.writeFileSync(rootDirDataFilePath, jsondata)
|
||||
} else {
|
||||
this.fs.writeFileSync(curDirDataFilePath, jsondata)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lodash_get(source, path, defaultValue = undefined) {
|
||||
const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.')
|
||||
let result = source
|
||||
for (const p of paths) {
|
||||
result = Object(result)[p]
|
||||
if (result === undefined) {
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
lodash_set(obj, path, value) {
|
||||
if (Object(obj) !== obj) return obj
|
||||
if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || []
|
||||
path
|
||||
.slice(0, -1)
|
||||
.reduce(
|
||||
(a, c, i) =>
|
||||
Object(a[c]) === a[c]
|
||||
? a[c]
|
||||
: (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {}),
|
||||
obj
|
||||
)[path[path.length - 1]] = value
|
||||
return obj
|
||||
}
|
||||
|
||||
getdata(key) {
|
||||
let val = this.getval(key)
|
||||
// 如果以 @
|
||||
if (/^@/.test(key)) {
|
||||
const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
|
||||
const objval = objkey ? this.getval(objkey) : ''
|
||||
if (objval) {
|
||||
try {
|
||||
const objedval = JSON.parse(objval)
|
||||
val = objedval ? this.lodash_get(objedval, paths, '') : val
|
||||
} catch (e) {
|
||||
val = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
return val
|
||||
}
|
||||
|
||||
setdata(val, key) {
|
||||
let issuc = false
|
||||
if (/^@/.test(key)) {
|
||||
const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key)
|
||||
const objdat = this.getval(objkey)
|
||||
const objval = objkey
|
||||
? objdat === 'null'
|
||||
? null
|
||||
: objdat || '{}'
|
||||
: '{}'
|
||||
try {
|
||||
const objedval = JSON.parse(objval)
|
||||
this.lodash_set(objedval, paths, val)
|
||||
issuc = this.setval(JSON.stringify(objedval), objkey)
|
||||
} catch (e) {
|
||||
const objedval = {}
|
||||
this.lodash_set(objedval, paths, val)
|
||||
issuc = this.setval(JSON.stringify(objedval), objkey)
|
||||
}
|
||||
} else {
|
||||
issuc = this.setval(val, key)
|
||||
}
|
||||
return issuc
|
||||
}
|
||||
|
||||
getval(key) {
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Loon':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
return $persistentStore.read(key)
|
||||
case 'Quantumult X':
|
||||
return $prefs.valueForKey(key)
|
||||
case 'Node.js':
|
||||
this.data = this.loaddata()
|
||||
return this.data[key]
|
||||
default:
|
||||
return (this.data && this.data[key]) || null
|
||||
}
|
||||
}
|
||||
|
||||
setval(val, key) {
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Loon':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
return $persistentStore.write(val, key)
|
||||
case 'Quantumult X':
|
||||
return $prefs.setValueForKey(val, key)
|
||||
case 'Node.js':
|
||||
this.data = this.loaddata()
|
||||
this.data[key] = val
|
||||
this.writedata()
|
||||
return true
|
||||
default:
|
||||
return (this.data && this.data[key]) || null
|
||||
}
|
||||
}
|
||||
|
||||
initGotEnv(opts) {
|
||||
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 (opts) {
|
||||
opts.headers = opts.headers ? opts.headers : {}
|
||||
if (opts) {
|
||||
opts.headers = opts.headers ? opts.headers : {}
|
||||
if (
|
||||
undefined === opts.headers.cookie &&
|
||||
undefined === opts.headers.Cookie &&
|
||||
undefined === opts.cookieJar
|
||||
) {
|
||||
opts.cookieJar = this.ckjar
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get(request, callback = () => {}) {
|
||||
if (request.headers) {
|
||||
delete request.headers['Content-Type']
|
||||
delete request.headers['Content-Length']
|
||||
|
||||
// HTTP/2 全是小写
|
||||
delete request.headers['content-type']
|
||||
delete request.headers['content-length']
|
||||
}
|
||||
if (request.params) {
|
||||
request.url += '?' + this.queryStr(request.params)
|
||||
}
|
||||
// followRedirect 禁止重定向
|
||||
if (
|
||||
typeof request.followRedirect !== 'undefined' &&
|
||||
!request['followRedirect']
|
||||
) {
|
||||
if (this.isSurge() || this.isLoon()) request['auto-redirect'] = false // Surge & Loon
|
||||
if (this.isQuanX())
|
||||
request.opts
|
||||
? (request['opts']['redirection'] = false)
|
||||
: (request.opts = { redirection: false }) // Quantumult X
|
||||
}
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Loon':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
default:
|
||||
if (this.isSurge() && this.isNeedRewrite) {
|
||||
request.headers = request.headers || {}
|
||||
Object.assign(request.headers, { 'X-Surge-Skip-Scripting': false })
|
||||
}
|
||||
$httpClient.get(request, (err, resp, body) => {
|
||||
if (!err && resp) {
|
||||
resp.body = body
|
||||
resp.statusCode = resp.status ? resp.status : resp.statusCode
|
||||
resp.status = resp.statusCode
|
||||
}
|
||||
callback(err, resp, body)
|
||||
})
|
||||
break
|
||||
case 'Quantumult X':
|
||||
if (this.isNeedRewrite) {
|
||||
request.opts = request.opts || {}
|
||||
Object.assign(request.opts, { hints: false })
|
||||
}
|
||||
$task.fetch(request).then(
|
||||
(resp) => {
|
||||
const {
|
||||
statusCode: status,
|
||||
statusCode,
|
||||
headers,
|
||||
body,
|
||||
bodyBytes
|
||||
} = resp
|
||||
callback(
|
||||
null,
|
||||
{ status, statusCode, headers, body, bodyBytes },
|
||||
body,
|
||||
bodyBytes
|
||||
)
|
||||
},
|
||||
(err) => callback((err && err.error) || 'UndefinedError')
|
||||
)
|
||||
break
|
||||
case 'Node.js':
|
||||
let iconv = require('iconv-lite')
|
||||
this.initGotEnv(request)
|
||||
this.got(request)
|
||||
.on('redirect', (resp, nextOpts) => {
|
||||
try {
|
||||
if (resp.headers['set-cookie']) {
|
||||
const ck = resp.headers['set-cookie']
|
||||
.map(this.cktough.Cookie.parse)
|
||||
.toString()
|
||||
if (ck) {
|
||||
this.ckjar.setCookieSync(ck, null)
|
||||
}
|
||||
nextOpts.cookieJar = this.ckjar
|
||||
}
|
||||
} catch (e) {
|
||||
this.logErr(e)
|
||||
}
|
||||
// this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString())
|
||||
})
|
||||
.then(
|
||||
(resp) => {
|
||||
const {
|
||||
statusCode: status,
|
||||
statusCode,
|
||||
headers,
|
||||
rawBody
|
||||
} = resp
|
||||
const body = iconv.decode(rawBody, this.encoding)
|
||||
callback(
|
||||
null,
|
||||
{ status, statusCode, headers, rawBody, body },
|
||||
body
|
||||
)
|
||||
},
|
||||
(err) => {
|
||||
const { message: error, response: resp } = err
|
||||
callback(
|
||||
error,
|
||||
resp,
|
||||
resp && iconv.decode(resp.rawBody, this.encoding)
|
||||
)
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
post(request, callback = () => {}) {
|
||||
const method = request.method
|
||||
? request.method.toLocaleLowerCase()
|
||||
: 'post'
|
||||
|
||||
// 如果指定了请求体, 但没指定 `Content-Type`、`content-type`, 则自动生成。
|
||||
if (
|
||||
request.body &&
|
||||
request.headers &&
|
||||
!request.headers['Content-Type'] &&
|
||||
!request.headers['content-type']
|
||||
) {
|
||||
// HTTP/1、HTTP/2 都支持小写 headers
|
||||
request.headers['content-type'] = 'application/x-www-form-urlencoded'
|
||||
}
|
||||
// 为避免指定错误 `content-length` 这里删除该属性,由工具端 (HttpClient) 负责重新计算并赋值
|
||||
if (request.headers) {
|
||||
delete request.headers['Content-Length']
|
||||
delete request.headers['content-length']
|
||||
}
|
||||
// followRedirect 禁止重定向
|
||||
if (
|
||||
typeof request.followRedirect !== 'undefined' &&
|
||||
!request['followRedirect']
|
||||
) {
|
||||
if (this.isSurge() || this.isLoon()) request['auto-redirect'] = false // Surge & Loon
|
||||
if (this.isQuanX())
|
||||
request.opts
|
||||
? (request['opts']['redirection'] = false)
|
||||
: (request.opts = { redirection: false }) // Quantumult X
|
||||
}
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Loon':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
default:
|
||||
if (this.isSurge() && this.isNeedRewrite) {
|
||||
request.headers = request.headers || {}
|
||||
Object.assign(request.headers, { 'X-Surge-Skip-Scripting': false })
|
||||
}
|
||||
$httpClient[method](request, (err, resp, body) => {
|
||||
if (!err && resp) {
|
||||
resp.body = body
|
||||
resp.statusCode = resp.status ? resp.status : resp.statusCode
|
||||
resp.status = resp.statusCode
|
||||
}
|
||||
callback(err, resp, body)
|
||||
})
|
||||
break
|
||||
case 'Quantumult X':
|
||||
request.method = method
|
||||
if (this.isNeedRewrite) {
|
||||
request.opts = request.opts || {}
|
||||
Object.assign(request.opts, { hints: false })
|
||||
}
|
||||
$task.fetch(request).then(
|
||||
(resp) => {
|
||||
const {
|
||||
statusCode: status,
|
||||
statusCode,
|
||||
headers,
|
||||
body,
|
||||
bodyBytes
|
||||
} = resp
|
||||
callback(
|
||||
null,
|
||||
{ status, statusCode, headers, body, bodyBytes },
|
||||
body,
|
||||
bodyBytes
|
||||
)
|
||||
},
|
||||
(err) => callback((err && err.error) || 'UndefinedError')
|
||||
)
|
||||
break
|
||||
case 'Node.js':
|
||||
let iconv = require('iconv-lite')
|
||||
this.initGotEnv(request)
|
||||
const { url, ..._request } = request
|
||||
this.got[method](url, _request).then(
|
||||
(resp) => {
|
||||
const { statusCode: status, statusCode, headers, rawBody } = resp
|
||||
const body = iconv.decode(rawBody, this.encoding)
|
||||
callback(
|
||||
null,
|
||||
{ status, statusCode, headers, rawBody, body },
|
||||
body
|
||||
)
|
||||
},
|
||||
(err) => {
|
||||
const { message: error, response: resp } = err
|
||||
callback(
|
||||
error,
|
||||
resp,
|
||||
resp && iconv.decode(resp.rawBody, this.encoding)
|
||||
)
|
||||
}
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S')
|
||||
* :$.time('yyyyMMddHHmmssS')
|
||||
* y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒
|
||||
* 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符
|
||||
* @param {string} fmt 格式化参数
|
||||
* @param {number} 可选: 根据指定时间戳返回格式化日期
|
||||
*
|
||||
*/
|
||||
time(fmt, ts = null) {
|
||||
const date = ts ? new Date(ts) : new Date()
|
||||
let o = {
|
||||
'M+': date.getMonth() + 1,
|
||||
'd+': date.getDate(),
|
||||
'H+': date.getHours(),
|
||||
'm+': date.getMinutes(),
|
||||
's+': date.getSeconds(),
|
||||
'q+': Math.floor((date.getMonth() + 3) / 3),
|
||||
'S': date.getMilliseconds()
|
||||
}
|
||||
if (/(y+)/.test(fmt))
|
||||
fmt = fmt.replace(
|
||||
RegExp.$1,
|
||||
(date.getFullYear() + '').substr(4 - RegExp.$1.length)
|
||||
)
|
||||
for (let k in o)
|
||||
if (new RegExp('(' + k + ')').test(fmt))
|
||||
fmt = fmt.replace(
|
||||
RegExp.$1,
|
||||
RegExp.$1.length == 1
|
||||
? o[k]
|
||||
: ('00' + o[k]).substr(('' + o[k]).length)
|
||||
)
|
||||
return fmt
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Object} options
|
||||
* @returns {String} 将 Object 对象 转换成 queryStr: key=val&name=senku
|
||||
*/
|
||||
queryStr(options) {
|
||||
let queryString = ''
|
||||
|
||||
for (const key in options) {
|
||||
let value = options[key]
|
||||
if (value != null && value !== '') {
|
||||
if (typeof value === 'object') {
|
||||
value = JSON.stringify(value)
|
||||
}
|
||||
queryString += `${key}=${value}&`
|
||||
}
|
||||
}
|
||||
queryString = queryString.substring(0, queryString.length - 1)
|
||||
|
||||
return queryString
|
||||
}
|
||||
|
||||
/**
|
||||
* 系统通知
|
||||
*
|
||||
* > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知
|
||||
*
|
||||
* 示例:
|
||||
* $.msg(title, subt, desc, 'twitter://')
|
||||
* $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
|
||||
* $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' })
|
||||
*
|
||||
* @param {*} title 标题
|
||||
* @param {*} subt 副标题
|
||||
* @param {*} desc 通知详情
|
||||
* @param {*} opts 通知参数
|
||||
*
|
||||
*/
|
||||
msg(title = name, subt = '', desc = '', opts = {}) {
|
||||
const toEnvOpts = (rawopts) => {
|
||||
const { $open, $copy, $media, $mediaMime } = rawopts
|
||||
switch (typeof rawopts) {
|
||||
case undefined:
|
||||
return rawopts
|
||||
case 'string':
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Stash':
|
||||
default:
|
||||
return { url: rawopts }
|
||||
case 'Loon':
|
||||
case 'Shadowrocket':
|
||||
return rawopts
|
||||
case 'Quantumult X':
|
||||
return { 'open-url': rawopts }
|
||||
case 'Node.js':
|
||||
return undefined
|
||||
}
|
||||
case 'object':
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
default: {
|
||||
const options = {}
|
||||
|
||||
// 打开URL
|
||||
let openUrl =
|
||||
rawopts.openUrl || rawopts.url || rawopts['open-url'] || $open
|
||||
if (openUrl)
|
||||
Object.assign(options, { action: 'open-url', url: openUrl })
|
||||
|
||||
// 粘贴板
|
||||
let copy =
|
||||
rawopts['update-pasteboard'] ||
|
||||
rawopts.updatePasteboard ||
|
||||
$copy
|
||||
if (copy) {
|
||||
Object.assign(options, { action: 'clipboard', text: copy })
|
||||
}
|
||||
|
||||
if ($media) {
|
||||
let mediaUrl = undefined
|
||||
let media = undefined
|
||||
let mime = undefined
|
||||
// http 开头的网络地址
|
||||
if ($media.startsWith('http')) {
|
||||
mediaUrl = $media
|
||||
}
|
||||
// 带标识的 Base64 字符串
|
||||
// data:image/png;base64,iVBORw0KGgo...
|
||||
else if ($media.startsWith('data:')) {
|
||||
const [data] = $media.split(';')
|
||||
const [, base64str] = $media.split(',')
|
||||
media = base64str
|
||||
mime = data.replace('data:', '')
|
||||
}
|
||||
// 没有标识的 Base64 字符串
|
||||
// iVBORw0KGgo...
|
||||
else {
|
||||
// https://stackoverflow.com/questions/57976898/how-to-get-mime-type-from-base-64-string
|
||||
const getMimeFromBase64 = (encoded) => {
|
||||
const signatures = {
|
||||
'JVBERi0': 'application/pdf',
|
||||
'R0lGODdh': 'image/gif',
|
||||
'R0lGODlh': 'image/gif',
|
||||
'iVBORw0KGgo': 'image/png',
|
||||
'/9j/': 'image/jpg'
|
||||
}
|
||||
for (var s in signatures) {
|
||||
if (encoded.indexOf(s) === 0) {
|
||||
return signatures[s]
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
media = $media
|
||||
mime = getMimeFromBase64($media)
|
||||
}
|
||||
|
||||
Object.assign(options, {
|
||||
'media-url': mediaUrl,
|
||||
'media-base64': media,
|
||||
'media-base64-mime': $mediaMime ?? mime
|
||||
})
|
||||
}
|
||||
|
||||
Object.assign(options, {
|
||||
'auto-dismiss': rawopts['auto-dismiss'],
|
||||
'sound': rawopts['sound']
|
||||
})
|
||||
return options
|
||||
}
|
||||
case 'Loon': {
|
||||
const options = {}
|
||||
|
||||
let openUrl =
|
||||
rawopts.openUrl || rawopts.url || rawopts['open-url'] || $open
|
||||
if (openUrl) Object.assign(options, { openUrl })
|
||||
|
||||
let mediaUrl = rawopts.mediaUrl || rawopts['media-url']
|
||||
if ($media?.startsWith('http')) mediaUrl = $media
|
||||
if (mediaUrl) Object.assign(options, { mediaUrl })
|
||||
|
||||
console.log(JSON.stringify(options))
|
||||
return options
|
||||
}
|
||||
case 'Quantumult X': {
|
||||
const options = {}
|
||||
|
||||
let openUrl =
|
||||
rawopts['open-url'] || rawopts.url || rawopts.openUrl || $open
|
||||
if (openUrl) Object.assign(options, { 'open-url': openUrl })
|
||||
|
||||
let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl
|
||||
if ($media?.startsWith('http')) mediaUrl = $media
|
||||
if (mediaUrl) Object.assign(options, { 'media-url': mediaUrl })
|
||||
|
||||
let copy =
|
||||
rawopts['update-pasteboard'] ||
|
||||
rawopts.updatePasteboard ||
|
||||
$copy
|
||||
if (copy) Object.assign(options, { 'update-pasteboard': copy })
|
||||
|
||||
console.log(JSON.stringify(options))
|
||||
return options
|
||||
}
|
||||
case 'Node.js':
|
||||
return undefined
|
||||
}
|
||||
default:
|
||||
return undefined
|
||||
}
|
||||
}
|
||||
if (!this.isMute) {
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Loon':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
default:
|
||||
$notification.post(title, subt, desc, toEnvOpts(opts))
|
||||
break
|
||||
case 'Quantumult X':
|
||||
$notify(title, subt, desc, toEnvOpts(opts))
|
||||
break
|
||||
case 'Node.js':
|
||||
break
|
||||
}
|
||||
}
|
||||
if (!this.isMuteLog) {
|
||||
let logs = ['', '==============📣系统通知📣==============']
|
||||
logs.push(title)
|
||||
subt ? logs.push(subt) : ''
|
||||
desc ? logs.push(desc) : ''
|
||||
console.log(logs.join('\n'))
|
||||
this.logs = this.logs.concat(logs)
|
||||
}
|
||||
}
|
||||
|
||||
debug(...logs) {
|
||||
if (this.logLevels[this.logLevel] <= this.logLevels.debug) {
|
||||
if (logs.length > 0) {
|
||||
this.logs = [...this.logs, ...logs]
|
||||
}
|
||||
console.log(
|
||||
`${this.logLevelPrefixs.debug}${logs.map((l) => l ?? String(l)).join(this.logSeparator)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
info(...logs) {
|
||||
if (this.logLevels[this.logLevel] <= this.logLevels.info) {
|
||||
if (logs.length > 0) {
|
||||
this.logs = [...this.logs, ...logs]
|
||||
}
|
||||
console.log(
|
||||
`${this.logLevelPrefixs.info}${logs.map((l) => l ?? String(l)).join(this.logSeparator)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
warn(...logs) {
|
||||
if (this.logLevels[this.logLevel] <= this.logLevels.warn) {
|
||||
if (logs.length > 0) {
|
||||
this.logs = [...this.logs, ...logs]
|
||||
}
|
||||
console.log(
|
||||
`${this.logLevelPrefixs.warn}${logs.map((l) => l ?? String(l)).join(this.logSeparator)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
error(...logs) {
|
||||
if (this.logLevels[this.logLevel] <= this.logLevels.error) {
|
||||
if (logs.length > 0) {
|
||||
this.logs = [...this.logs, ...logs]
|
||||
}
|
||||
console.log(
|
||||
`${this.logLevelPrefixs.error}${logs.map((l) => l ?? String(l)).join(this.logSeparator)}`
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
log(...logs) {
|
||||
if (logs.length > 0) {
|
||||
this.logs = [...this.logs, ...logs]
|
||||
}
|
||||
console.log(logs.map((l) => l ?? String(l)).join(this.logSeparator))
|
||||
}
|
||||
|
||||
logErr(err, msg) {
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Loon':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
case 'Quantumult X':
|
||||
default:
|
||||
this.log('', `❗️${this.name}, 错误!`, msg, err)
|
||||
break
|
||||
case 'Node.js':
|
||||
this.log(
|
||||
'',
|
||||
`❗️${this.name}, 错误!`,
|
||||
msg,
|
||||
typeof err.message !== 'undefined' ? err.message : err,
|
||||
err.stack
|
||||
)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
wait(time) {
|
||||
return new Promise((resolve) => setTimeout(resolve, time))
|
||||
}
|
||||
|
||||
done(val = {}) {
|
||||
const endTime = new Date().getTime()
|
||||
const costTime = (endTime - this.startTime) / 1000
|
||||
this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`)
|
||||
this.log()
|
||||
switch (this.getEnv()) {
|
||||
case 'Surge':
|
||||
case 'Loon':
|
||||
case 'Stash':
|
||||
case 'Shadowrocket':
|
||||
case 'Quantumult X':
|
||||
default:
|
||||
$done(val)
|
||||
break
|
||||
case 'Node.js':
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
})(name, opts)
|
||||
}
|
||||
1
Scripts/env/Env.min.js
vendored
Normal file
1
Scripts/env/Env.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
26
Scripts/fenbi.js
Normal file
26
Scripts/fenbi.js
Normal file
@ -0,0 +1,26 @@
|
||||
// 2023-08-19 16:00
|
||||
|
||||
/**
|
||||
[rewrite_local]
|
||||
^https:\/\/tiku\.fenbi\.com\/activity\/app\/launcher\? url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/fenbi.js
|
||||
|
||||
[mitm]
|
||||
hostname = tiku.fenbi.com
|
||||
*/
|
||||
|
||||
//^https:\/\/tiku\.fenbi\.com\/iphone\/(shenlun|xingce|sqgj)\/banners\/v2?.* url script-response-body https://raw.githubusercontent.com/githubacct001/QuantumultX/secret/Rewrite/Fenbi/fbgk.js
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/activity/app/launcher")) {
|
||||
if (obj?.data?.length > 0) {
|
||||
obj.data.forEach((i) => {
|
||||
i.startTime = 2208960000; // Unix 时间戳 2040-01-01 00:00:00
|
||||
i.endTime = 2209046399; // Unix 时间戳 2040-01-01 23:59:59
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
13
Scripts/fly.js
Normal file
13
Scripts/fly.js
Normal file
@ -0,0 +1,13 @@
|
||||
var body = $response.body;
|
||||
var new_body = JSON.parse(body);
|
||||
|
||||
if (new_body.Variables.data.threaddetail) {
|
||||
new_body.Variables.data.threaddetail.tagadv = "";
|
||||
new_body.Variables.data.threaddetail.threadapp_ad_video = [];
|
||||
new_body.Variables.data.threaddetail.pingyouadv = "";
|
||||
new_body.Variables.data.threaddetail.middleadv = "";
|
||||
new_body.Variables.data.threaddetail.bottomadv = "";
|
||||
new_body.Variables.data.threaddetail.appdetailadv = [];
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(new_body)});
|
||||
163
Scripts/freeAppsToday.js
Normal file
163
Scripts/freeAppsToday.js
Normal file
@ -0,0 +1,163 @@
|
||||
const $ = new Xiaobai();
|
||||
|
||||
// 填key就行
|
||||
const key = $prefs.valueForKey('freeAppsTodayKey');
|
||||
|
||||
const myRequest = {
|
||||
url: "https://api.gofans.cn/v1/m/app_records?page=1&limit=10",
|
||||
headers: {
|
||||
referer: "https://m.gofans.cn/",
|
||||
origin: "https://m.gofans.cn",
|
||||
},
|
||||
};
|
||||
|
||||
const uuid_cache = async (req, uuid, readData) => {
|
||||
const stringLen = (str, num) => (str.length <= num ? str : str.substring(0, num));
|
||||
if ((readData = getRead[uuid])) {
|
||||
uuidArr.push(uuid);
|
||||
return {...readData, type: true};
|
||||
}
|
||||
let [data] = await $.get(req);
|
||||
data["description"] = stringLen(data["description"], 200);
|
||||
const regex = /price|track_url|name|primary_genre_name|icon|description|version|original_price|kind_name/;
|
||||
data = Object.keys(data).reduce((result, key) => (regex.test(key) && (result[key] = data[key]), result), {});
|
||||
newArr.push(uuid);
|
||||
getRead[uuid] = data;
|
||||
return data;
|
||||
};
|
||||
|
||||
|
||||
const currentTime = () => new Date().toLocaleString();
|
||||
|
||||
class NoteObject {
|
||||
constructor(key) {
|
||||
this.key = typeof $argument !== "undefined" ? $argument : key;
|
||||
|
||||
this.barkObject = (name, body, icon, obj) => ({
|
||||
url: "https://api.day.app/push",
|
||||
headers: {"Content-Type": "application/json; charset=utf-8"},
|
||||
timeout: 3,
|
||||
body: $.jsonS({
|
||||
title: name,
|
||||
body: body,
|
||||
icon: icon,
|
||||
device_key: this.key,
|
||||
...obj,
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
notif({price, track_url, name, primary_genre_name, icon, description, version, original_price, kind_name, type}) {
|
||||
const body = `类别:${primary_genre_name} 版本:${version}\n原价:${original_price} 现价:${price} 平台:${kind_name}\n${description}`;
|
||||
const obj = {
|
||||
group: (initialize && kind_name) || type ? kind_name : "",
|
||||
level: "passive",
|
||||
url: track_url,
|
||||
};
|
||||
return this.key
|
||||
? $.post(this.barkObject(name, body, icon, obj))
|
||||
: $.msg(name, "", body, {url: track_url, media: icon});
|
||||
}
|
||||
|
||||
end(name, body, icon) {
|
||||
return this.key
|
||||
? $.post(this.barkObject(name, body, icon))
|
||||
: $.msg(name, "", body);
|
||||
}
|
||||
}
|
||||
|
||||
const uuidArr = [];
|
||||
const newArr = [];
|
||||
const getRead = $.jsonP($.read("APP") || "{}");
|
||||
const initialize = Object.keys(getRead).length === 0;
|
||||
const note = new NoteObject(key);
|
||||
|
||||
$.get(myRequest)
|
||||
.then(([{data}]) => {
|
||||
if (!data) throw "空数据"
|
||||
const uuid_Request = data.map(({uuid}) => [uuid, {...myRequest, url: `https://api.gofans.cn/v1/m/apps/${uuid}`}]);
|
||||
// 并发请求获取应用程序详细数据
|
||||
return Promise.allSettled(uuid_Request.map(([uuid, req]) => uuid_cache(req, uuid)));
|
||||
})
|
||||
.then((json) =>
|
||||
// 筛选出成功的请求,并返回数据
|
||||
json.reduce((prev, {status, value}) => (status === "fulfilled" ? [...prev, value] : prev), [])
|
||||
)
|
||||
.then((noteData) =>
|
||||
// 并发请求发送推送通知
|
||||
Promise.allSettled(noteData.map((val) => note.notif(val)))
|
||||
)
|
||||
.then(() => {
|
||||
// 更新数据
|
||||
const sum = newArr.length;
|
||||
const sumArr = [...uuidArr, ...newArr];
|
||||
const getReakeys = Object.keys(getRead);
|
||||
let message = "APP暂无更新";
|
||||
if (sum || sumArr.length !== getReakeys.length) {
|
||||
message = `APP已更新 数量: ${newArr.length}\n${newArr.map((val) => getRead[val].name).join(" ")}`;
|
||||
getReakeys.forEach((key) => {
|
||||
sumArr.includes(key) || delete getRead[key];
|
||||
});
|
||||
$.write($.jsonS(getRead), "APP");
|
||||
}
|
||||
// 发送结束通知
|
||||
note.end(
|
||||
"限免APP",
|
||||
`刷新时间 ${currentTime()}\n${message}`,
|
||||
"https://pic.616pic.com/ys_b_img/00/58/60/IiOiwSSokt.jpg",
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
$.log(err, data);
|
||||
$.msg("", err, data);
|
||||
})
|
||||
.finally(() => $done());
|
||||
|
||||
function Xiaobai() {
|
||||
const isSurge = typeof $httpClient !== "undefined";
|
||||
|
||||
const reqPro = (method, options, parse) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const cb = (err, resp, body) => err ? reject(err) : resolve([parse ? body : JSON.parse(body), resp]);
|
||||
|
||||
if (isSurge) {
|
||||
$httpClient[method](options, cb);
|
||||
} else {
|
||||
typeof options === "string" && (options = {url: `${options}`});
|
||||
options.method = method.toUpperCase();
|
||||
$task.fetch(options)
|
||||
.then(({headers, statusCode, body}) =>
|
||||
resolve([parse ? body : JSON.parse(body), {...headers, status: statusCode}])
|
||||
)
|
||||
.catch(r =>
|
||||
reject(r.error)
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.get = (options, parse) => reqPro("get", options, parse);
|
||||
|
||||
this.post = (options, parse) => reqPro("post", options, parse);
|
||||
|
||||
this.read = key => isSurge
|
||||
? $persistentStore.read(key)
|
||||
: $prefs.valueForKey(key);
|
||||
|
||||
this.write = (key, val) => isSurge
|
||||
? $persistentStore.write(key, val)
|
||||
: $prefs.setValueForKey(key, val);
|
||||
|
||||
this.msg = (t, s, b, u) => {
|
||||
const {url, media} = u || {};
|
||||
isSurge
|
||||
? $notification.post(t, s, b, url && {url: url})
|
||||
: $notify(t, s, b, {"open-url": url, "media-url": media});
|
||||
};
|
||||
|
||||
this.log = (...x) =>
|
||||
console.log(["", ...x].map(arg => typeof arg === "object" ? JSON.stringify(arg) : arg).join("\n"));
|
||||
|
||||
this.jsonS = x => JSON.stringify(x);
|
||||
this.jsonP = x => JSON.parse(x);
|
||||
}
|
||||
66
Scripts/haluo/haluo.js
Normal file
66
Scripts/haluo/haluo.js
Normal file
@ -0,0 +1,66 @@
|
||||
// 嵌入 CryptoJS 库的源码(只包含 AES 部分)
|
||||
(function(){
|
||||
var CryptoJS=CryptoJS||function(u,l){var d={};var n=Object.create?function(){return Object.create(null)}:function(){return{}};var s={};var k=s.lib={};var f=k.Base=function(){function a(){}return{extend:function(b){a.prototype=this;var c=new a;b&&c.mixIn(b);c.hasOwnProperty("init")||(c.init=function(){c.$super.init.apply(this,arguments)});c.init.prototype=c;c.$super=this;return c},create:function(){var a=this.extend();a.init.apply(a,arguments);return a},init:function(){},mixIn:function(a){for(var b in a)a.hasOwnProperty(b)&&
|
||||
(this[b]=a[b]);a.hasOwnProperty("toString")&&(this.toString=a.toString)},clone:function(){return this.init.prototype.extend(this)}}}();var h=k.WordArray=f.extend({init:function(a,b){a=this.words=a||[];this.sigBytes=void 0!=b?b:4*a.length},toString:function(a){return(a||p).stringify(this)},concat:function(a){var b=this.words,c=a.words,m=this.sigBytes;a=a.sigBytes;this.clamp();if(m%4)for(var z=0;z<a;z++)b[m+z>>>2]|=(c[z>>>2]>>>24-8*(z%4)&255)<<24-8*((m+z)%4);else if(65535<c.length)for(z=0;z<a;z+=4)b[m+
|
||||
z>>>2]=c[z>>>2];else b.push.apply(b,c);this.sigBytes+=a;return this},clamp:function(){var a=this.words,b=this.sigBytes;a[b>>>2]&=4294967295<<32-8*(b%4);a.length=u.ceil(b/4)},clone:function(){var a=f.clone.call(this);a.words=this.words.slice(0);return a},random:function(a){for(var b=[],c=0;c<a;c+=4)b.push(4294967296*u.random()|0);return new h.init(b,a)}});var x=s.enc={};x.Hex={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],m=0;m<a;m++){var z=b[m>>>2]>>>24-8*(m%4)&255;c.push((z>>>4).toString(16));
|
||||
c.push((z&15).toString(16))}return c.join("")},parse:function(a){for(var b=a.length,c=[],m=0;m<b;m+=2)c[m>>>3]|=parseInt(a.substr(m,2),16)<<24-4*(m%8);return new h.init(c,b/2)}};var p=x.Latin1={stringify:function(a){var b=a.words;a=a.sigBytes;for(var c=[],m=0;m<a;m++)c.push(String.fromCharCode(b[m>>>2]>>>24-8*(m%4)&255));return c.join("")},parse:function(a){for(var b=a.length,c=[],m=0;m<b;m++)c[m>>>2]|=(a.charCodeAt(m)&255)<<24-8*(m%4);return new h.init(c,b)}};var t=x.Utf8={stringify:function(a){try{return decodeURIComponent(escape(p.stringify(a)))}catch(b){throw Error("Malformed UTF-8 data");}},
|
||||
parse:function(a){return p.parse(unescape(encodeURIComponent(a)))}};var w=k.BufferedBlockAlgorithm=f.extend({reset:function(){this._data=new h.init;this._nDataBytes=0},_append:function(a){"string"==typeof a&&(a=t.parse(a));this._data.concat(a);this._nDataBytes+=a.sigBytes},_process:function(a){var b=this._data,c=b.words,m=b.sigBytes,z=this.blockSize,e=m/(4*z),e=a?u.ceil(e):u.max((e|0)-this._minBufferSize,0);a=e*z;m=u.min(4*a,m);if(a){for(var g=0;g<a;g+=z)this._doProcessBlock(c,g);g=c.splice(0,a);b.sigBytes-=m}return new h.init(g,
|
||||
m)},clone:function(){var a=f.clone.call(this);a._data=this._data.clone();return a},_minBufferSize:0});k.Hasher=w.extend({cfg:f.extend(),init:function(a){this.cfg=this.cfg.extend(a);this.reset()},reset:function(){w.reset.call(this);this._doReset()},update:function(a){this._append(a);this._process();return this},finalize:function(a){a&&this._append(a);return this._doFinalize()},blockSize:16,_createHelper:function(a){return function(b,c){return(new a.init(c)).finalize(b)}},_createHmacHelper:function(a){return function(b,c){return(new v.HMAC.init(a,
|
||||
c)).finalize(b)}}});var v=s.algo={};return s}(Math);
|
||||
(function(){var u=CryptoJS,l=u.lib.WordArray;u.enc.Base64={stringify:function(d){var n=d.words;l=d.sigBytes;for(var s=[],k=0;k<l;k+=3)for(var f=(n[k>>>2]>>>24-8*(k%4)&255)<<16|(n[k+1>>>2]>>>24-8*((k+1)%4)&255)<<8|n[k+2>>>2]>>>24-8*((k+2)%4)&255,h=0;4>h&&k+0.75*h<l;h++)s.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>>6*(3-h)&63));if(n=s.length%4)for(;4-n;)s.push("="),n++;return s.join("")},parse:function(d){var n=d.length,s=l.create(),k=0,f=0,h;for(h=0;h<n;h++)if("="!=
|
||||
d.charAt(h)){if(0==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<18;else if(1==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<12;else if(2==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<6;else if(3==k&&(f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h)),s.words[s.sigBytes>>>2]|=f>>>16-8*(s.sigBytes%4)&255<<24-8*(s.sigBytes%4),
|
||||
s.sigBytes+=3),f=0,4==++k)k=0}else k++;return s}}})();
|
||||
(function(u){var l=CryptoJS,d=l.lib,n=d.Base,s=d.WordArray,l=l.algo,k=l.EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:l.MD5,iterations:1}),init:function(f){this.cfg=this.cfg.extend(f)},compute:function(f,h){for(var d=this.cfg,n=d.hasher.create(),k=s.create(),v=k.words,m=d.keySize,d=d.iterations;v.length<m;){p&&n.update(p);var p=n.update(f).finalize(h);n.reset();for(var r=1;r<d;r++)p=n.finalize(p),n.reset();k.concat(p)}k.sigBytes=4*m;return k}});l.EvpKDF=function(f,d,n){return l.create(n).compute(f,
|
||||
d)}})();
|
||||
CryptoJS.lib.Cipher||function(u){var l=CryptoJS,d=l.lib,n=d.Base,s=d.WordArray,k=d.BufferedBlockAlgorithm,h=l.enc.Base64,x=l.algo.EvpKDF,p=d.Cipher=k.extend({cfg:n.extend(),createEncryptor:function(e,a){return this.create(this._ENC_XFORM_MODE,e,a)},createDecryptor:function(e,a){return this.create(this._DEC_XFORM_MODE,e,a)},init:function(e,a,b){this.cfg=this.cfg.extend(b);this._xformMode=e;this._key=a;this.reset()},reset:function(){k.reset.call(this);this._doReset()},process:function(e){this._append(e);
|
||||
return this._process()},finalize:function(e){e&&this._append(e);return this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(b,c,a){return("string"==typeof c?y:j).encrypt(e,b,c,a)},decrypt:function(b,c,a){return("string"==typeof c?y:j).decrypt(e,b,c,a)}}}});d.StreamCipher=p.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var m=l.mode={},v=function(e,a,b){var c=this._iv;c?this._iv=u:c=this._prevBlock;for(var d=0;d<
|
||||
b;d++)e[a+d]^=c[d]},r=(d.BlockCipherMode=n.extend({createEncryptor:function(e,a){return this.Encryptor.create(e,a)},createDecryptor:function(e,a){return this.Decryptor.create(e,a)},init:function(e,a){this._cipher=e;this._iv=a}})).extend();r.Encryptor=r.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize;v.call(this,e,a,c);b.encryptBlock(e,a);this._prevBlock=e.slice(a,a+c)}});r.Decryptor=r.extend({processBlock:function(e,a){var b=this._cipher,c=b.blockSize,d=e.slice(a,a+c);b.decryptBlock(e,
|
||||
a);v.call(this,e,a,c);this._prevBlock=d}});m=m.CBC=r;r=(l.pad={}).Pkcs7={pad:function(e,a){for(var b=4*a,e=b-e.sigBytes%b,a=e<<24|e<<16|e<<8|e,b=[],c=0;c<e;c+=4)b.push(a);e=s.create(b,e);e.sigBytes=e.sigBytes},unpad:function(e){e.sigBytes-=e.words[e.sigBytes-1>>>2]&255}};d.BlockCipher=p.extend({cfg:p.cfg.extend({mode:m,padding:r}),reset:function(){p.reset.call(this);var e=this.cfg,a=e.iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var b=e.createEncryptor;else b=e.createDecryptor,this._minBufferSize=
|
||||
1;this._mode=b.call(e,this,a&&a.words)},_doProcessBlock:function(e,a){this._mode.processBlock(e,a)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var a=this._process(!0)}else a=this._process(!0),e.unpad(a);return a},blockSize:4});var q=d.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),m=(l.format={}).OpenSSL={stringify:function(e){var a=e.ciphertext;e=e.salt;
|
||||
return(e?s.create([1398893684,1701076831]).concat(e).concat(a):a).toString(h)},parse:function(e){var a=h.parse(e),b=a.words;if(1398893684==b[0]&&1701076831==b[1]){var c=s.create(b.slice(2,4));b.splice(0,4);a.sigBytes-=16}return q.create({ciphertext:a,salt:c})}},j=d.SerializableCipher=n.extend({cfg:n.extend({format:m}),encrypt:function(e,a,b,c){c=this.cfg.extend(c);var d=e.createEncryptor(b,c);a=d.finalize(a);d=d.cfg;return q.create({ciphertext:a,key:b,iv:d.iv,algorithm:e,mode:d.mode,padding:d.padding,
|
||||
blockSize:e.blockSize,formatter:c.format})},decrypt:function(e,a,b,c){c=this.cfg.extend(c);a=this._parse(a,c.format);return e.createDecryptor(b,c).finalize(a.ciphertext)},_parse:function(e,a){return"string"==typeof e?m.parse(e,a):e}}),l=(l.kdf={}).OpenSSL={execute:function(e,a,b,c){c||(c=s.random(8));e=x.create({keySize:a+b}).compute(e,c);b=s.create(e.words.slice(a),4*b);e.sigBytes=4*a;return q.create({key:e,iv:b,salt:c})}},y=d.PasswordBasedCipher=j.extend({cfg:j.cfg.extend({kdf:l}),encrypt:function(e,a,
|
||||
b,c){c=this.cfg.extend(c);b=c.kdf.execute(b,e.keySize,e.ivSize);c.iv=b.iv;e=j.encrypt.call(this,e,a,b.key,c);e.mixIn(b);return e},decrypt:function(e,a,b,c){c=this.cfg.extend(c);a=this._parse(a,c.format);b=c.kdf.execute(b,e.keySize,e.ivSize,a.salt);return j.decrypt.call(this,e,a,b.key,c)}})}();
|
||||
(function(){var u=CryptoJS,l=u.lib.WordArray;u.enc.Base64={stringify:function(d){var n=d.words;l=d.sigBytes;for(var s=[],k=0;k<l;k+=3)for(var f=(n[k>>>2]>>>24-8*(k%4)&255)<<16|(n[k+1>>>2]>>>24-8*((k+1)%4)&255)<<8|n[k+2>>>2]>>>24-8*((k+2)%4)&255,h=0;4>h&&k+0.75*h<l;h++)s.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>>6*(3-h)&63));if(n=s.length%4)for(;4-n;)s.push("="),n++;return s.join("")},parse:function(d){var n=d.length,s=l.create(),k=0,f=0,h;for(h=0;h<n;h++)if("="!=
|
||||
d.charAt(h)){if(0==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<18;else if(1==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<12;else if(2==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<6;else if(3==k&&(f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h)),s.words[s.sigBytes>>>2]|=f>>>16-8*(s.sigBytes%4)&255<<24-8*(s.sigBytes%4),
|
||||
s.sigBytes+=3),f=0,4==++k)k=0}else k++;return s}}})();
|
||||
(function(){var u=CryptoJS,l=u.lib.WordArray;u.enc.Base64={stringify:function(d){var n=d.words;l=d.sigBytes;for(var s=[],k=0;k<l;k+=3)for(var f=(n[k>>>2]>>>24-8*(k%4)&255)<<16|(n[k+1>>>2]>>>24-8*((k+1)%4)&255)<<8|n[k+2>>>2]>>>24-8*((k+2)%4)&255,h=0;4>h&&k+0.75*h<l;h++)s.push("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>>6*(3-h)&63));if(n=s.length%4)for(;4-n;)s.push("="),n++;return s.join("")},parse:function(d){var n=d.length,s=l.create(),k=0,f=0,h;for(h=0;h<n;h++)if("="!=
|
||||
d.charAt(h)){if(0==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<18;else if(1==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<12;else if(2==k)f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h))<<6;else if(3==k&&(f|="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(d.charAt(h)),s.words[s.sigBytes>>>2]|=f>>>16-8*(s.sigBytes%4)&255<<24-8*(s.sigBytes%4),
|
||||
s.sigBytes+=3),f=0,4==++k)k=0}else k++;return s}}})();
|
||||
CryptoJS.AES=function(){function u(b,a){this.reset();var g=0,d=[],e=b.length;for(b=0;b<e;b++){var k=(d[b>>>2]>>>24-8*(b%4)&255)<<24|a.charCodeAt(b)<<16|a.charCodeAt(b)<<8|a.charCodeAt(b);g^=k}this._key=g<<4|g>>>4}return{encrypt:function(b,a,g){return g=CryptoJS.lib.CipherParams.create({ciphertext:CryptoJS.enc.Base64.stringify(CryptoJS.AES.encrypt(b,a,g))})},decrypt:function(b,a,g){var d=a;c._parse(b,g.format).ciphertext=c.dec("CryptoJS.enc.Base64.parse(b)").parse(b);return d}}}();
|
||||
})();
|
||||
|
||||
// 加密密钥和 IV(Hex 格式)
|
||||
const keyHex = CryptoJS.enc.Hex.parse("7f961631c923e640");
|
||||
const ivHex = CryptoJS.enc.Hex.parse("37663936313633316339323365363430");
|
||||
|
||||
// 加密的数据(此处为示例,应该替换为你实际的加密字符串)
|
||||
const encryptedData = "your_encrypted_data_here"; // 替换为你实际的加密数据
|
||||
|
||||
// 解密
|
||||
const decrypted = CryptoJS.AES.decrypt(encryptedData, keyHex, {
|
||||
iv: ivHex,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
|
||||
// 将解密后的数据转换为字符串
|
||||
const decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
|
||||
|
||||
// 解析为 JSON 对象
|
||||
let jsonData = JSON.parse(decryptedStr);
|
||||
|
||||
// 修改 JSON 数据
|
||||
jsonData.someKey = "newValue"; // 修改某个键值对,示例
|
||||
|
||||
// 将修改后的 JSON 对象转换为字符串
|
||||
const modifiedJsonStr = JSON.stringify(jsonData);
|
||||
|
||||
// 加密
|
||||
const encryptedModified = CryptoJS.AES.encrypt(modifiedJsonStr, keyHex, {
|
||||
iv: ivHex,
|
||||
mode: CryptoJS.mode.CBC,
|
||||
padding: CryptoJS.pad.Pkcs7
|
||||
});
|
||||
|
||||
// 打印加密后的字符串
|
||||
console.log(encryptedModified.toString());
|
||||
93
Scripts/header.js
Normal file
93
Scripts/header.js
Normal file
@ -0,0 +1,93 @@
|
||||
// 2024-08-11 13:40
|
||||
|
||||
const url = $request.url;
|
||||
const header = $request.headers;
|
||||
const contype = header["Content-Type"] || header["content-type"];
|
||||
const headopt = header["Operation-Type"] || header["operation-type"];
|
||||
const ua = header["User-Agent"] || header["user-agent"];
|
||||
const isQuanX = typeof $task !== "undefined";
|
||||
|
||||
if (url.includes("/amdc/mobileDispatch")) {
|
||||
if (
|
||||
ua.includes("AMapiPhone") || // 高德地图
|
||||
ua.includes("Alibaba") || // 阿里巴巴
|
||||
ua.includes("Cainiao4iPhone") || // 菜鸟
|
||||
ua.includes("%E9%A3%9E%E7%8C%AA%E6%97%85%E8%A1%8C") // 飞猪旅行
|
||||
) {
|
||||
if (isQuanX) {
|
||||
$done({ status: "HTTP/1.1 404 Not Found" });
|
||||
} else {
|
||||
$done();
|
||||
}
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
} else if (url.includes("/mobile.12306.cn/otsmobile/app/mgs/")) {
|
||||
// 12306页面内容
|
||||
const list12306 = [
|
||||
// "com.cars.otsmobile.bangbangSafe.deciveInfo", // 设备序列号
|
||||
// "com.cars.otsmobile.checkLoginStatus", // 登录信息
|
||||
// "com.cars.otsmobile.city",
|
||||
// "com.cars.otsmobile.initCountry",
|
||||
// "com.cars.otsmobile.initNewSysCache",
|
||||
// "com.cars.otsmobile.initProvince",
|
||||
"com.cars.otsmobile.integration.activityBanner", // 活动横幅
|
||||
"com.cars.otsmobile.memberInfo.getMemberQa", // 铁路会员 常见问题
|
||||
// "com.cars.otsmobile.memberInfo.integrationHomeInit", // 铁路会员 会员信息
|
||||
// "com.cars.otsmobile.newHomePage.getWeatherByStationCode", // 天气信息
|
||||
"com.cars.otsmobile.newHomePage.initData", // 热门资讯
|
||||
"com.cars.otsmobile.newHomePageBussData", // 商品信息流
|
||||
// "com.cars.otsmobile.newHomePageRefresh",
|
||||
"com.cars.otsmobile.paySuccBuss.bussEntryShow" // 商业推广
|
||||
// "com.cars.otsmobile.travelPage.initData", // 出行服务
|
||||
];
|
||||
if (isQuanX) {
|
||||
if (list12306?.includes(headopt)) {
|
||||
$done({ status: "HTTP/1.1 404 Not Found" });
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
} else {
|
||||
if (list12306?.includes(headopt)) {
|
||||
$done();
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/mobilepaas.abchina.com.cn:441/mgw")) {
|
||||
// 中国农业银行开屏广告
|
||||
const listbankabc = [
|
||||
"com.bankabc.recommendcenter.homepage.gethpadverinfo",
|
||||
"com.abchina.mbank.common.homepage.getStartParam"
|
||||
];
|
||||
if (isQuanX) {
|
||||
if (listbankabc?.includes(headopt)) {
|
||||
$done({ status: "HTTP/1.1 404 Not Found" });
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
} else {
|
||||
if (listbankabc?.includes(headopt)) {
|
||||
$done();
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
}
|
||||
} else if (url.includes("/sec.sginput.qq.com/q")) {
|
||||
// 搜狗输入法候选词推广
|
||||
if (isQuanX) {
|
||||
if (contype === "application/octet-stream") {
|
||||
$done({ status: "HTTP/1.1 404 Not Found" });
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
} else {
|
||||
if (contype === "application/octet-stream") {
|
||||
$done();
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
32
Scripts/hengdian.json
Normal file
32
Scripts/hengdian.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"code": "200",
|
||||
"data": {
|
||||
"bannerSettingsDetailList": [
|
||||
{
|
||||
"author": "",
|
||||
"datetime": null,
|
||||
"productCode": "",
|
||||
"title": "",
|
||||
"integralRedemptionDetails": "",
|
||||
"bannnerUrl": "null",
|
||||
"confUrl": "",
|
||||
"description": "",
|
||||
"movieNum": "",
|
||||
"promotionLinkPage": "0",
|
||||
"sequenceNum": "0"
|
||||
}
|
||||
],
|
||||
"cinemaGroupName": "",
|
||||
"cinemaName": "",
|
||||
"endDate": "2023-12-31 23:59:59",
|
||||
"groupSettingsResponse": null,
|
||||
"id": "26",
|
||||
"placingPosition": "1",
|
||||
"startDate": "2021-03-01 00:00:00",
|
||||
"cinemaCode": "",
|
||||
"name": "启动页"
|
||||
},
|
||||
"timestamp": "1688799977563",
|
||||
"msg": "OK",
|
||||
"ok": "true"
|
||||
}
|
||||
5
Scripts/heytea.js
Normal file
5
Scripts/heytea.js
Normal file
@ -0,0 +1,5 @@
|
||||
let obj=JSON.parse($response.body);
|
||||
delete obj.data.ad ;
|
||||
delete obj.data.brands ;
|
||||
delete obj.data.info.infos ;
|
||||
$done({body: JSON.stringify(obj)});
|
||||
17
Scripts/huifutianxia_ads.js
Normal file
17
Scripts/huifutianxia_ads.js
Normal file
@ -0,0 +1,17 @@
|
||||
/**
|
||||
* 汇付天下
|
||||
* 2024-08-12 19:00:37
|
||||
*/
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("api/miniapp/popular/T_MINIAPP")) {
|
||||
delete obj.data;
|
||||
}
|
||||
|
||||
if (url.includes("/api/tactics/ad")) {
|
||||
obj.data.splice(0, 3);
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
37
Scripts/ithome/ithome.js
Normal file
37
Scripts/ithome/ithome.js
Normal file
@ -0,0 +1,37 @@
|
||||
// 2023-08-21 10:25
|
||||
|
||||
/**
|
||||
[rewrite_local]
|
||||
^https:\/\/napi\.ithome\.com\/api\/(news\/index|topmenu\/getfeeds) url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/ithome/ithome.js
|
||||
|
||||
[mitm]
|
||||
hostname = napi.ithome.com
|
||||
*/
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (
|
||||
url.includes("/api/news/index") ||
|
||||
url.includes("/api/topmenu/getfeeds")
|
||||
) {
|
||||
if (obj?.data?.list?.length > 0) {
|
||||
let list = obj.data.list;
|
||||
const newList = [];
|
||||
for (let item of list) {
|
||||
if (item?.feedContent?.smallTags?.some((i) =>
|
||||
i?.text?.includes("广告"))
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if ([10002, 10003].includes(item?.feedType)) {
|
||||
continue;
|
||||
}
|
||||
newList.push(item);
|
||||
}
|
||||
obj.data.list = newList;
|
||||
}
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
11
Scripts/jabi.js
Normal file
11
Scripts/jabi.js
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
var date= $response.body.match(/"date":"[^"]*"/g);
|
||||
|
||||
var body= $response.body.match(/"download":"[^"]*"/g);
|
||||
|
||||
console.log(body);
|
||||
|
||||
$notify("扎比科技","", '\n'+date[0]+'\n'+body[0]+'\n\n'+date[1]+'\n'+body[1]+'\n\n'+date[2]+'\n'+body[2]);
|
||||
|
||||
$done({ body });
|
||||
|
||||
32
Scripts/javDB/javDB.js
Normal file
32
Scripts/javDB/javDB.js
Normal file
@ -0,0 +1,32 @@
|
||||
// ^https:\/\/api\.hechuangxinxi\.xyz\/api\/v4\/plans url reject-dict
|
||||
// javDB.js
|
||||
// hostname = api.hechuangxinxi.xyz
|
||||
|
||||
let requestUrl = $request.url;
|
||||
let responseBody = $response.body;
|
||||
|
||||
let responseData = JSON.parse(responseBody);
|
||||
|
||||
if (requestUrl.includes("/api/v4/plans")) {
|
||||
if (responseData.data.plans) {
|
||||
responseData.data.plans.forEach(plan => {
|
||||
plan.price = 0.01;
|
||||
});
|
||||
}
|
||||
console.log('修改价格成功💕');
|
||||
|
||||
// responseData.data.platforms[0].channels
|
||||
if (responseData.data.platforms.length > 0 && responseData.data.platforms[0].channels) {
|
||||
responseData.data.platforms[0].channels.forEach(channel => {
|
||||
if (channel.methods && channel.methods.length > 0) {
|
||||
channel.methods.forEach(subMethods => {
|
||||
subMethods.limited_prices = "1";
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
console.log('修改支付成功💕');
|
||||
}
|
||||
|
||||
console.log('返回JSON💕' + JSON.stringify(responseData));
|
||||
$done({body: JSON.stringify(responseData)});
|
||||
429
Scripts/jhsh_bf.js
Normal file
429
Scripts/jhsh_bf.js
Normal file
File diff suppressed because one or more lines are too long
182
Scripts/jingdong/jd_cookie.js
Normal file
182
Scripts/jingdong/jd_cookie.js
Normal file
File diff suppressed because one or more lines are too long
222
Scripts/jingdong/jddj_bean.js
Normal file
222
Scripts/jingdong/jddj_bean.js
Normal file
File diff suppressed because one or more lines are too long
33
Scripts/jingdong/jddj_fruit.js
Normal file
33
Scripts/jingdong/jddj_fruit.js
Normal file
File diff suppressed because one or more lines are too long
250
Scripts/jingdong/jddj_fruit_collectWater.js
Normal file
250
Scripts/jingdong/jddj_fruit_collectWater.js
Normal file
File diff suppressed because one or more lines are too long
245
Scripts/jingdong/jddj_getPoints.js
Normal file
245
Scripts/jingdong/jddj_getPoints.js
Normal file
File diff suppressed because one or more lines are too long
353
Scripts/jingdong/jddj_plantBeans.js
Normal file
353
Scripts/jingdong/jddj_plantBeans.js
Normal file
File diff suppressed because one or more lines are too long
292
Scripts/jingdong/jingdong.js
Normal file
292
Scripts/jingdong/jingdong.js
Normal file
@ -0,0 +1,292 @@
|
||||
// 2024-04-18 17:45
|
||||
|
||||
const url = $request.url;
|
||||
if (!$response.body) $done({});
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("functionId=deliverLayer") || url.includes("functionId=orderTrackBusiness")) {
|
||||
// 物流页面
|
||||
if (obj?.bannerInfo) {
|
||||
// 收货时寄快递享八折 享受条件苛刻 故移除
|
||||
delete obj.bannerInfo;
|
||||
}
|
||||
if (obj?.floors?.length > 0) {
|
||||
// 运费八折
|
||||
obj.floors = obj.floors.filter((i) => !["banner", "jdDeliveryBanner"]?.includes(i?.mId));
|
||||
}
|
||||
} else if (url.includes("functionId=getTabHomeInfo")) {
|
||||
// 新品页面
|
||||
if (obj?.result?.iconInfo) {
|
||||
// 新品页 悬浮动图
|
||||
delete obj.result.iconInfo;
|
||||
}
|
||||
if (obj?.result?.roofTop) {
|
||||
// 新品页 下拉二楼
|
||||
delete obj.result.roofTop;
|
||||
}
|
||||
} else if (url.includes("functionId=myOrderInfo")) {
|
||||
// 订单页面
|
||||
if (obj?.floors?.length > 0) {
|
||||
let newFloors = [];
|
||||
for (let floor of obj.floors) {
|
||||
if (["bannerFloor", "bpDynamicFloor", "plusFloor"]?.includes(floor?.mId)) {
|
||||
// bannerFloor满意度评分 bpDynamicFloor专属权益 plusFloor开通会员
|
||||
continue;
|
||||
} else {
|
||||
if (floor?.mId === "virtualServiceCenter") {
|
||||
// 服务中心
|
||||
if (floor?.data?.virtualServiceCenters?.length > 0) {
|
||||
let newItems = [];
|
||||
for (let item of floor.data.virtualServiceCenters) {
|
||||
if (item?.serviceList?.length > 0) {
|
||||
let newCards = [];
|
||||
for (let card of item.serviceList) {
|
||||
if (card?.serviceTitle === "精选特惠") {
|
||||
continue;
|
||||
}
|
||||
newCards.push(card);
|
||||
}
|
||||
item.serviceList = newCards;
|
||||
}
|
||||
newItems.push(item);
|
||||
}
|
||||
floor.data.virtualServiceCenters = newItems;
|
||||
}
|
||||
}
|
||||
if (floor?.mId === "customerServiceFloor") {
|
||||
// 客户服务
|
||||
if (floor?.data?.moreText) {
|
||||
// 点此获得更多服务
|
||||
delete floor.data.moreIcon;
|
||||
delete floor.data.moreIcon_dark;
|
||||
floor.data.moreText = " ";
|
||||
}
|
||||
}
|
||||
newFloors.push(floor);
|
||||
}
|
||||
}
|
||||
obj.floors = newFloors;
|
||||
}
|
||||
} else if (url.includes("functionId=personinfoBusiness")) {
|
||||
// 个人页面
|
||||
if (obj?.floors?.length > 0) {
|
||||
let newFloors = [];
|
||||
for (let floor of obj.floors) {
|
||||
const items = [
|
||||
"bigSaleFloor", // 双十一
|
||||
"buyOften", // 常买常逛
|
||||
// "iconToolFloor", // 底部工具栏
|
||||
// "keyToolsFloor", // 浏览记录
|
||||
"newAttentionCard", // 关注的频道
|
||||
"newBigSaleFloor", // 双十一
|
||||
"newStyleAttentionCard", // 新版关注的频道
|
||||
// "newWalletIdFloor", // 我的钱包
|
||||
"newsFloor", // 京东快讯
|
||||
"noticeFloor", // 顶部横幅
|
||||
// "orderIdFloor", // 我的订单
|
||||
"recommendfloor" // 我的推荐
|
||||
];
|
||||
if (items?.includes(floor?.mId)) {
|
||||
continue;
|
||||
} else {
|
||||
if (floor?.mId === "basefloorinfo") {
|
||||
// 弹窗
|
||||
if (floor?.data?.commonPopup) {
|
||||
delete floor.data.commonPopup;
|
||||
}
|
||||
// 弹窗
|
||||
if (floor?.data?.commonPopup_dynamic) {
|
||||
delete floor.data.commonPopup_dynamic;
|
||||
}
|
||||
// 底部会员续费横幅
|
||||
if (floor?.data?.commonTips?.length > 0) {
|
||||
floor.data.commonTips = [];
|
||||
}
|
||||
// 弹窗
|
||||
if (floor?.data?.commonWindows?.length > 0) {
|
||||
floor.data.commonWindows = [];
|
||||
}
|
||||
// 右下角动图
|
||||
if (floor?.data?.floatLayer) {
|
||||
delete floor.data.floatLayer;
|
||||
}
|
||||
} else if (floor?.mId === "iconToolFloor") {
|
||||
/*
|
||||
// 底部工具栏
|
||||
if (floor?.data?.nodes?.length > 0) {
|
||||
const sortLists = [
|
||||
"applezhushou", // apple助手 1-1-1
|
||||
"lingjindouxin", // 签到领豆 1-1-2
|
||||
"dongdongnongchangxin", // 京东农场 1-1-3
|
||||
"chongwangwang", // 宠汪汪 1-1-4
|
||||
"kehufuwu", // 客户服务 1-2-1
|
||||
"xianzhiguanjia", // 闲置换钱 1-2-2
|
||||
"wenyisheng", // 问医生 1-2-3
|
||||
"jijianfuwu", // 寄件服务 1-2-5
|
||||
"zhuanzuanhongbao", // 天天赚红包 2-2-1
|
||||
"huanletaojin" // 欢乐淘金 2-2-2
|
||||
];
|
||||
let node = floor.data.nodes;
|
||||
if (node?.[0]?.length > 0) {
|
||||
// 第一组十个
|
||||
node[0] = node[0]
|
||||
.filter((i) => sortLists?.includes(i?.functionId))
|
||||
.sort((a, b) => sortLists.indexOf(a?.functionId) - sortLists.indexOf(b?.functionId));
|
||||
}
|
||||
if (node?.[1]?.length > 0) {
|
||||
// 第二组四个
|
||||
node[1] = node[1]
|
||||
.filter((i) => sortLists?.includes(i?.functionId))
|
||||
.sort((a, b) => sortLists.indexOf(a?.functionId) - sortLists.indexOf(b?.functionId));
|
||||
}
|
||||
}
|
||||
*/
|
||||
} else if (floor?.mId === "orderIdFloor") {
|
||||
if (floor?.data?.commentRemindInfo?.infos?.length > 0) {
|
||||
// 发布评价的提醒
|
||||
floor.data.commentRemindInfo.infos = [];
|
||||
}
|
||||
} else if (floor?.mId === "userinfo") {
|
||||
// 个人页 顶部背景图
|
||||
// if (floor?.data?.bgImgInfo?.bgImg) {
|
||||
// delete floor.data.bgImgInfo.bgImg;
|
||||
// }
|
||||
// 开通plus会员卡片
|
||||
if (floor?.data?.newPlusBlackCard) {
|
||||
delete floor.data.newPlusBlackCard;
|
||||
}
|
||||
}
|
||||
newFloors.push(floor);
|
||||
}
|
||||
}
|
||||
obj.floors = newFloors;
|
||||
}
|
||||
if (obj?.others?.floors?.length > 0) {
|
||||
// 个人页面 2024-04-18 12.6.2新版本更改路径
|
||||
let newFloors = [];
|
||||
for (let floor of obj.others.floors) {
|
||||
const items = [
|
||||
"bigSaleFloor", // 双十一
|
||||
"buyOften", // 常买常逛
|
||||
// "iconToolFloor", // 底部工具栏
|
||||
// "keyToolsFloor", // 浏览记录
|
||||
"newAttentionCard", // 关注的频道
|
||||
"newBigSaleFloor", // 双十一
|
||||
"newStyleAttentionCard", // 新版关注的频道
|
||||
// "newWalletIdFloor", // 我的钱包
|
||||
"newsFloor", // 京东快讯
|
||||
"noticeFloor", // 顶部横幅
|
||||
// "orderIdFloor", // 我的订单
|
||||
"recommendfloor" // 我的推荐
|
||||
// "userinfo", // 用户信息
|
||||
];
|
||||
if (items?.includes(floor?.mId)) {
|
||||
continue;
|
||||
} else {
|
||||
if (floor?.mId === "basefloorinfo") {
|
||||
// 弹窗
|
||||
if (floor?.data?.commonPopup) {
|
||||
delete floor.data.commonPopup;
|
||||
}
|
||||
// 弹窗
|
||||
if (floor?.data?.commonPopup_dynamic) {
|
||||
delete floor.data.commonPopup_dynamic;
|
||||
}
|
||||
// 底部会员续费横幅
|
||||
if (floor?.data?.commonTips?.length > 0) {
|
||||
floor.data.commonTips = [];
|
||||
}
|
||||
// 弹窗
|
||||
if (floor?.data?.commonWindows?.length > 0) {
|
||||
floor.data.commonWindows = [];
|
||||
}
|
||||
// 右下角动图
|
||||
if (floor?.data?.floatLayer) {
|
||||
delete floor.data.floatLayer;
|
||||
}
|
||||
} else if (floor?.mId === "iconToolFloor") {
|
||||
/*
|
||||
// 底部工具栏
|
||||
if (floor?.data?.nodes?.length > 0) {
|
||||
const sortLists = [
|
||||
"applezhushou", // apple助手 1-1-1
|
||||
"lingjindouxin", // 签到领豆 1-1-2
|
||||
"dongdongnongchangxin", // 京东农场 1-1-3
|
||||
"chongwangwang", // 宠汪汪 1-1-4
|
||||
"kehufuwu", // 客户服务 1-2-1
|
||||
"xianzhiguanjia", // 闲置换钱 1-2-2
|
||||
"wenyisheng", // 问医生 1-2-3
|
||||
"jijianfuwu", // 寄件服务 1-2-5
|
||||
"zhuanzuanhongbao", // 天天赚红包 2-2-1
|
||||
"huanletaojin" // 欢乐淘金 2-2-2
|
||||
];
|
||||
let node = floor.data.nodes;
|
||||
if (node?.[0]?.length > 0) {
|
||||
// 第一组十个
|
||||
node[0] = node[0]
|
||||
.filter((i) => sortLists?.includes(i?.functionId))
|
||||
.sort((a, b) => sortLists.indexOf(a?.functionId) - sortLists.indexOf(b?.functionId));
|
||||
}
|
||||
if (node?.[1]?.length > 0) {
|
||||
// 第二组四个
|
||||
node[1] = node[1]
|
||||
.filter((i) => sortLists?.includes(i?.functionId))
|
||||
.sort((a, b) => sortLists.indexOf(a?.functionId) - sortLists.indexOf(b?.functionId));
|
||||
}
|
||||
}
|
||||
*/
|
||||
} else if (floor?.mId === "orderIdFloor") {
|
||||
if (floor?.data?.commentRemindInfo?.infos?.length > 0) {
|
||||
// 发布评价的提醒
|
||||
floor.data.commentRemindInfo.infos = [];
|
||||
}
|
||||
} else if (floor?.mId === "userinfo") {
|
||||
// 个人页 顶部背景图
|
||||
// if (floor?.data?.bgImgInfo?.bgImg) {
|
||||
// delete floor.data.bgImgInfo.bgImg;
|
||||
// }
|
||||
// 开通plus会员卡片
|
||||
if (floor?.data?.newPlusBlackCard) {
|
||||
delete floor.data.newPlusBlackCard;
|
||||
}
|
||||
}
|
||||
newFloors.push(floor);
|
||||
}
|
||||
}
|
||||
obj.others.floors = newFloors;
|
||||
}
|
||||
} else if (url.includes("functionId=start")) {
|
||||
// 开屏广告
|
||||
if (obj?.images?.length > 0) {
|
||||
obj.images = [];
|
||||
}
|
||||
if (obj?.showTimesDaily) {
|
||||
obj.showTimesDaily = 0;
|
||||
}
|
||||
} else if (url.includes("functionId=welcomeHome")) {
|
||||
// 首页配置
|
||||
if (obj?.floorList?.length > 0) {
|
||||
const delItems = [
|
||||
"bottomXview", // 底部悬浮通栏推广
|
||||
"float", // 悬浮推广小圆图
|
||||
"photoCeiling", // 顶部通栏动图推广
|
||||
// "recommend", // 为你推荐
|
||||
"ruleFloat", // 资质与规则
|
||||
"searchIcon", // 右上角消费券
|
||||
"topRotate", // 左上角logo
|
||||
"tabBarAtmosphere" // 底部悬浮通栏推广
|
||||
];
|
||||
// 首页 图层列表
|
||||
obj.floorList = obj.floorList.filter((i) => !delItems?.includes(i?.type));
|
||||
}
|
||||
// 首页 顶部背景图
|
||||
// if (obj?.topBgImgBig) {
|
||||
// delete obj.topBgImgBig;
|
||||
// }
|
||||
// 首页 下拉二楼
|
||||
if (obj?.webViewFloorList?.length > 0) {
|
||||
obj.webViewFloorList = [];
|
||||
}
|
||||
}
|
||||
|
||||
$done({ body: JSON.stringify(obj) });
|
||||
10
Scripts/jingxiAd.js
Normal file
10
Scripts/jingxiAd.js
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 京喜APP
|
||||
*/
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (/^https?:\/\/api\.m\.jd\.com\/api\?functionId=delivery_show/.test($request.url)) {
|
||||
obj.data.materialList.startTime = 3667476800000;
|
||||
obj.data.materialList.endTime = 3667908800000;
|
||||
}
|
||||
$done({body: JSON.stringify(obj)});
|
||||
1
Scripts/keep.js
Normal file
1
Scripts/keep.js
Normal file
File diff suppressed because one or more lines are too long
10
Scripts/kff.js
Normal file
10
Scripts/kff.js
Normal file
@ -0,0 +1,10 @@
|
||||
let obj = JSON.parse($response.body);
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("13502ede-f5fd-4d5c-90f5-f2454a30fda0")));
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("c1caaf62-e91d-4040-b533-dab39c0fec13")));
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("cc9d17ec-3ac5-494b-b82e-8d3c72c243d4")));
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("7bef8fe9-0daf-46b3-a2b0-dd9fba49423f")));
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("ff7e1263-d8d2-4f09-9947-d8c43c77bb10")));
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("874197b4-fe93-4a80-a555-8df1bc7e8211")));
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("0ba6a615-b7e9-48aa-afe7-329635385f2c")));
|
||||
obj.data.config = JSON.stringify(JSON.parse(obj.data.config).filter(item => !item.id.includes("a11b0e7d-a162-4802-ac71-21d98e8adddf")));
|
||||
$done({body: JSON.stringify(obj)});
|
||||
26
Scripts/kuaishou/ks_fruit.js
Normal file
26
Scripts/kuaishou/ks_fruit.js
Normal file
File diff suppressed because one or more lines are too long
33
Scripts/kuaishou/ks_getCookie.js
Normal file
33
Scripts/kuaishou/ks_getCookie.js
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
快手果园获取cookie
|
||||
重写地址:ug-fission.kuaishou.com/rest/n/darwin/orchard/water/watering, 触发类型:request-header
|
||||
进果园浇一次水
|
||||
MITM添加:ug-fission.kuaishou.com
|
||||
每次获取会覆盖之前的ck,请先用boxjs备份
|
||||
*/
|
||||
const $ = new API("ks_getCookie");
|
||||
!(async () => {
|
||||
if ($.env.isNode) {
|
||||
console.log('仅限iOS设备抓包用!');
|
||||
} else {
|
||||
if ($request.url.indexOf('watering') > -1) {
|
||||
const ck = `${$request.headers['Cookie'] || $request.headers['cookie']}`;
|
||||
// const userId = ck.match(/userId=.+?;/)
|
||||
$.write(ck, '#kscookies');
|
||||
$.notify('快手果园获取cookie成功', '', '');
|
||||
console.log(ck);
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
().catch((e) => {
|
||||
console.log('', `❌失败! 原因: ${e}!`, '');
|
||||
}).finally(() => {
|
||||
$.done({});
|
||||
})
|
||||
|
||||
/*********************************** API *************************************/
|
||||
function ENV(){const isQX=typeof $task!=="undefined";const isLoon=typeof $loon!=="undefined";const isSurge=typeof $httpClient!=="undefined"&&!isLoon;const isJSBox=typeof require=="function"&&typeof $jsbox!="undefined";const isNode=typeof require=="function"&&!isJSBox;const isRequest=typeof $request!=="undefined";const isScriptable=typeof importModule!=="undefined";return{isQX,isLoon,isSurge,isNode,isJSBox,isRequest,isScriptable}}
|
||||
function HTTP(baseURL,defaultOptions={}){const{isQX,isLoon,isSurge,isScriptable,isNode}=ENV();const methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"];function send(method,options){options=typeof options==="string"?{url:options}:options;options.url=baseURL?baseURL+options.url:options.url;options={...defaultOptions,...options};const timeout=options.timeout;const events={...{onRequest:()=>{},onResponse:(resp)=>resp,onTimeout:()=>{},},...options.events,};events.onRequest(method,options);let worker;if(isQX){worker=$task.fetch({method,...options})}else if(isLoon||isSurge||isNode){worker=new Promise((resolve,reject)=>{const request=isNode?require("request"):$httpClient;request[method.toLowerCase()](options,(err,response,body)=>{if(err)reject(err);else resolve({statusCode:response.status||response.statusCode,headers:response.headers,body,})})})}else if(isScriptable){const request=new Request(options.url);request.method=method;request.headers=options.headers;request.body=options.body;worker=new Promise((resolve,reject)=>{request.loadString().then((body)=>{resolve({statusCode:request.response.statusCode,headers:request.response.headers,body,})}).catch((err)=>reject(err))})}let timeoutid;const timer=timeout?new Promise((_,reject)=>{timeoutid=setTimeout(()=>{events.onTimeout();return reject(`${method}URL:${options.url}exceeds the timeout ${timeout}ms`)},timeout)}):null;return(timer?Promise.race([timer,worker]).then((res)=>{clearTimeout(timeoutid);return res}):worker).then((resp)=>events.onResponse(resp))}const http={};methods.forEach((method)=>(http[method.toLowerCase()]=(options)=>send(method,options)));return http}
|
||||
function API(name="untitled",debug=false){const{isQX,isLoon,isSurge,isNode,isJSBox,isScriptable}=ENV();return new(class{constructor(name,debug){this.name=name;this.debug=debug;this.http=HTTP();this.env=ENV();this.node=(()=>{if(isNode){const fs=require("fs");return{fs}}else{return null}})();this.initCache();const delay=(t,v)=>new Promise(function(resolve){setTimeout(resolve.bind(null,v),t)});Promise.prototype.delay=function(t){return this.then(function(v){return delay(t,v)})}}initCache(){if(isQX)this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}");if(isLoon||isSurge)this.cache=JSON.parse($persistentStore.read(this.name)||"{}");if(isNode){let fpath="root.json";if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err))}this.root={};fpath=`${this.name}.json`;if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err));this.cache={}}else{this.cache=JSON.parse(this.node.fs.readFileSync(`${this.name}.json`))}}}persistCache(){const data=JSON.stringify(this.cache);if(isQX)$prefs.setValueForKey(data,this.name);if(isLoon||isSurge)$persistentStore.write(data,this.name);if(isNode){this.node.fs.writeFileSync(`${this.name}.json`,data,{flag:"w"},(err)=>console.log(err));this.node.fs.writeFileSync("root.json",JSON.stringify(this.root),{flag:"w"},(err)=>console.log(err))}}write(data,key){this.log(`SET ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.write(data,key)}if(isQX){return $prefs.setValueForKey(data,key)}if(isNode){this.root[key]=data}}else{this.cache[key]=data}this.persistCache()}read(key){this.log(`READ ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.read(key)}if(isQX){return $prefs.valueForKey(key)}if(isNode){return this.root[key]}}else{return this.cache[key]}}delete(key){this.log(`DELETE ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){$persistentStore.write(null,key)}if(isQX){$prefs.removeValueForKey(key)}if(isNode){delete this.root[key]}}else{delete this.cache[key]}this.persistCache()}notify(title,subtitle="",content="",options={}){const openURL=options["open-url"];const mediaURL=options["media-url"];if(isQX)$notify(title,subtitle,content,options);if(isSurge){$notification.post(title,subtitle,content+`${mediaURL?"\n多媒体:"+mediaURL:""}`,{url:openURL})}if(isLoon){let opts={};if(openURL)opts["openUrl"]=openURL;if(mediaURL)opts["mediaUrl"]=mediaURL;if(JSON.stringify(opts)=="{}"){$notification.post(title,subtitle,content)}else{$notification.post(title,subtitle,content,opts)}}if(isNode||isScriptable){const content_=content+(openURL?`\n点击跳转:${openURL}`:"")+(mediaURL?`\n多媒体:${mediaURL}`:"");if(isJSBox){const push=require("push");push.schedule({title:title,body:(subtitle?subtitle+"\n":"")+content_,})}else{console.log(`${title}\n${subtitle}\n${content_}\n\n`)}}}log(msg){if(this.debug)console.log(msg)}info(msg){console.log(msg)}error(msg){console.log("ERROR: "+msg)}wait(millisec){return new Promise((resolve)=>setTimeout(resolve,millisec))}done(value={}){if(isQX||isLoon||isSurge){$done(value)}else if(isNode&&!isJSBox){if(typeof $context!=="undefined"){$context.headers=value.headers;$context.statusCode=value.statusCode;$context.body=value.body}}}})(name,debug)}
|
||||
/*****************************************************************************/
|
||||
108
Scripts/kuwo/kuwo.js
Normal file
108
Scripts/kuwo/kuwo.js
Normal file
@ -0,0 +1,108 @@
|
||||
// 2023-04-22 14:55
|
||||
|
||||
if (!$response.body) $done({});
|
||||
const method = $request.method;
|
||||
const url = $request.url;
|
||||
let body = $response.body;
|
||||
|
||||
if (url.includes("/a.p")) {
|
||||
if (method == "POST") {
|
||||
body = body
|
||||
.replace(/"playright":\d+/g, '"playright":1')
|
||||
.replace(/"downright":\d+/g, '"downright":1')
|
||||
.replace(/"policytype":\d+/g, '"policytype":3')
|
||||
.replace(/"policy":\d+/g, '"policy":5');
|
||||
} else if (url.includes("getvip")) {
|
||||
let obj = JSON.parse(body);
|
||||
obj.packs = {
|
||||
end: 32495443200,
|
||||
bought_vip: 1,
|
||||
type: 1,
|
||||
period: 31,
|
||||
bought_vip_end: 32495443200
|
||||
};
|
||||
body = JSON.stringify(obj);
|
||||
}
|
||||
} else if (url.includes("mgxhtj.kuwo.cn") || url.includes("nmobi.kuwo.cn")) {
|
||||
body = body
|
||||
.replace(/<ad\x20focusid="[^>]*>/g, "")
|
||||
.replace(/<ad\x20publish="[^>]*>/g, "")
|
||||
.replace(/(<userinfolabel\x20content=")[^"]*/g, "$1[]");
|
||||
} else if (url.includes("searchrecterm.kuwo.cn")) {
|
||||
body = '{ content: [{ query_word: "搜索歌曲", desc: "" }] }';
|
||||
} else if (url.includes("/music.pay") && method == "POST") {
|
||||
if (body.includes("audio")) {
|
||||
let obj = JSON.parse(body);
|
||||
obj.songs[0].audio.forEach((item) => (item.st = 0));
|
||||
let tmp = obj.songs[0].audio[0].policy;
|
||||
obj.user[0] = {
|
||||
pid: obj.songs[0].audio[0].pid,
|
||||
type: tmp,
|
||||
name: tmp + "_1",
|
||||
categray: tmp + "_1",
|
||||
id: obj.songs[0].id,
|
||||
order: 375787919,
|
||||
final: [],
|
||||
buy: 1657425321,
|
||||
begin: 1657425321,
|
||||
end: 4180305321,
|
||||
CurEnd: 0,
|
||||
playCnt: 0,
|
||||
playUpper: 300,
|
||||
downCnt: 0,
|
||||
downUpper: 300,
|
||||
playVideoCnt: 0,
|
||||
playVideoUpper: 3000,
|
||||
downVideoCnt: 0,
|
||||
downVideoUpper: 3000,
|
||||
price: obj.songs[0].audio[0].price,
|
||||
period: 1000,
|
||||
feetype: 0,
|
||||
info: obj.songs[0]
|
||||
};
|
||||
body = JSON.stringify(obj);
|
||||
}
|
||||
} else if (url.includes("/vip/enc/user/vip?op=ui")) {
|
||||
body =
|
||||
"Vo4m6X2hTph/vfpPmau8PTT0sFN6JCgzxSLVH/u3sbEt7VniYsVHbRFgOgN+Uvs39rAI7R3C5HVpaSj8tr8U8dLYwYdDCjMILuUorh3z0BiQToiWxudHkcASIPHNrmZHZYC/yv3DP4b89hbzfqU5UUDUqaZpEBZr76sDF2wNPmYjUEFSVCMGyTl1F6j1DBmKJ1Tik0YuG/2UBa/Ilz12a1KneXsNs5x5EE41bXDke7EygIB3I+6SoITZXOLFAFQFZujdI0GzClNglDKtclpUxpjN3uVeJxHLU40FTwNWo3ZDNv8KSdZpYZ5BDEOCyZkifmHlf1wnocX2zTr2xRAM6JhAD2WaSSNQQVJUI5lv72QNZSN43Pj/qdzatHQP4Pp/H1YxyP36rv3qBcnnJy/55YouIczRc3eJjXExRgo54qdyTYRMYoS9GzNn/edR3hSNnMn9PnElBCfZhkL0R5kZ9JBFCM3vNOy7Cnp6RVyAG0GFHv/g2q1yqkJxibyDro5nlnnvHjhZrsOvSvTXI1BBUlQjGoRqqCTDUvHLoiNwWMoKKfxtswWQiXjoQ6mL5dazxjUsbsHzC1N8YNMVtzf8gBryr3nMWS44wyUpi1/0WhGTRW1wsCllO1DB24+ibTFH/yftWN+/apM9vbQAkc/J+aFy/01plK7rsGNwWYYKG0sr6CS8dGQzy0On6aFo07hiU+wjUEFSVCOf/wKzzX5Cn/OLMKeVa1BPDxV5tm39vCrsxIG6T29VHWx8ck93S/nXCm2dHfojuLySZKJ50B1FaN5uFIY+LA1RbO/0sL+CoSJhoNOLibzt75c5dleW+lbwxLAAdBh5AFq4Z1Uj8bPjm5mHcGWQuBAyZIO+ie8wP4yvWwQFf1ENJiNQQVJUIzwCo22cpAtoAzYZWm3XFPfSlov4G15JGaaHL2X5FG5BTeUwwbBiQfwUpcb6oT8dbIKh2SsUZCeJZW43lLI0UIo9u3y1+P4GMtOKEZ7Sx0aQ3ewknthU2tpL0gnykFtiEtKBxcfHjJEen158zVXrbxxC0W35SmaYOOwgAmEMfxwHI1BBUlQjhVUHnBabnJcnmXCICcyUBglrZkXcNLwg91p4889vKFTLlzROHTt20UzjfKWsNK3U8pYgKYXPbQtSzIuRheEEQDFhLvEhIGKaB6yDoacDLJZ0jgFRIKKFBkbK0VE4nIABi1qgQOXvq1sG4QeupjfEWYqMX8EyyqPHrsDiCltAF1wjUEFSVCNybeUusnxJF2zswj8xQtfPiwfDj3TwKWxKXCmkheqHy7/0Qpyc84xWvq+YXktsU97wUZLHrgJmARudJmQNEwAweIdHMafcwreBy731z6kGLojy5TLgTN7XSm5Ar+hgOW+1ZwkWLyrVvaCdO/8/zdYl1w/PQUCs6dw0ThIeahwjpQ==";
|
||||
} else if (url.includes("/vip/v2/user/vip?op=ui")) {
|
||||
let obj = JSON.parse(body);
|
||||
obj.data = {
|
||||
vipIcon:
|
||||
"https://image.kuwo.cn/fe/f2d09ac0-b959-404f-86fa-dc65c715c0e96.png",
|
||||
iconJumpUrl:
|
||||
"http://vip1.kuwo.cn/vip/vue/anPay/pay/index.html?pageType=avip&MBOX_WEBCLOSE=1&FULLHASARROW=1",
|
||||
growthValue: "21600",
|
||||
vipTag: "VIP6",
|
||||
vipOverSeasExpire: "0",
|
||||
time: "1659582730304",
|
||||
goSvipPage: "1",
|
||||
isNewUser: "1",
|
||||
vipmIcon:
|
||||
"https://image.kuwo.cn/fe/34ad47f8-da7f-43e4-abdc-e6c995666368yyb.png",
|
||||
svipIcon:
|
||||
"https://image.kuwo.cn/fe/f2d09ac0-b959-404f-86fa-dc65c715c0e96.png",
|
||||
vipmExpire: "32495443200000",
|
||||
biedSong: "0",
|
||||
luxuryIcon:
|
||||
"https://image.kuwo.cn/fe/2fae68ff-de2d-4473-bf28-8efc29e44968vip.png",
|
||||
userType: "3",
|
||||
isYearUser: "2",
|
||||
vip3Expire: "0",
|
||||
experienceExpire: "0",
|
||||
luxAutoPayUser: "2",
|
||||
biedAlbum: "1",
|
||||
vipLuxuryExpire: "32495443200000",
|
||||
vipmAutoPayUser: "2",
|
||||
svipAutoPayUser: "2",
|
||||
vipExpire: "32495443200000",
|
||||
svipExpire: "32495443200000"
|
||||
};
|
||||
body = JSON.stringify(obj);
|
||||
} else if (url.includes("/vip/v2/theme?op=gd")) {
|
||||
let obj = JSON.parse(body);
|
||||
obj.data.needBieds = null;
|
||||
body = JSON.stringify(obj);
|
||||
}
|
||||
|
||||
$done({ body });
|
||||
60
Scripts/lawson.js
Normal file
60
Scripts/lawson.js
Normal file
@ -0,0 +1,60 @@
|
||||
let url = $request.url;
|
||||
let obj=JSON.parse($response.body);
|
||||
|
||||
try {
|
||||
// 处理弹窗和悬浮广告
|
||||
if (url.includes("/portal/app/globalLaunch/listAdvert?")) {
|
||||
console.log('去除弹窗、悬浮广告');
|
||||
if (obj?.data) {
|
||||
console.log('【已处理】去除弹窗、悬浮广告');
|
||||
obj.data = {};
|
||||
}
|
||||
}
|
||||
|
||||
// 处理预购列表
|
||||
if (url.includes("/app/v1/home/getReservation/?")) {
|
||||
console.log('去除预购列表');
|
||||
if (obj?.data) {
|
||||
console.log('【已处理】去除预购列表');
|
||||
obj.data = {};
|
||||
}
|
||||
}
|
||||
|
||||
// 处理推荐列表
|
||||
if (url.includes("/app/v1/home/getRecommendations/?")) {
|
||||
console.log('去除推荐列表');
|
||||
if (obj?.data) {
|
||||
console.log('【已处理】去除推荐列表');
|
||||
obj.data = {};
|
||||
}
|
||||
}
|
||||
|
||||
// 处理首页banner推广
|
||||
if (url.includes("/app/v1/home/getConfigInfo/?")) {
|
||||
console.log('去除首页banner推广');
|
||||
if (obj?.data?.dysmorphismPictureList) {
|
||||
console.log('【已处理】去除首页banner推广');
|
||||
obj.data.dysmorphismPictureList = [];
|
||||
}
|
||||
}
|
||||
|
||||
// 处理首页栏目
|
||||
if (url.includes("/app/v1/mina/systemSetting?")) {
|
||||
console.log('去除首页栏目');
|
||||
if (obj?.data) {
|
||||
obj.data = obj.data.map(item => {
|
||||
if (item.type === 'HOMETAB') {
|
||||
console.log('【已处理】去除首页栏目');
|
||||
item.openFlg = false;
|
||||
item.typeValue = {};
|
||||
}
|
||||
return item;
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('脚本运行出现错误,部分广告未去除⚠️');
|
||||
console.log('错误信息:' + e.message);
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
25
Scripts/lvtusuishenting/ltsst-ad.js
Normal file
25
Scripts/lvtusuishenting/ltsst-ad.js
Normal file
@ -0,0 +1,25 @@
|
||||
/*************************************
|
||||
|
||||
项目名称:旅途随身听-首页北京城市导览图片,首页上方轮播图片净化
|
||||
使用声明:⚠️仅供参考,🈲转载与售卖!
|
||||
|
||||
**************************************
|
||||
|
||||
[rewrite_local]
|
||||
^https:\/\/www\.1314zhilv\.com\/ltsstnew\/(common\/getJGQIconNew|city\/getAllBannelByCity) url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/lvtusuishenting/ltsst-ad.js
|
||||
|
||||
[mitm]
|
||||
hostname = www.1314zhilv.com
|
||||
|
||||
************************************/
|
||||
|
||||
var body = JSON.parse($response.body);
|
||||
const url = $request.url;
|
||||
|
||||
if (url.includes('/ltsstnew/common/getJGQIconNew')) {
|
||||
delete body.content.specialBanner;
|
||||
} else if (url.includes('/ltsstnew/city/getAllBannelByCity')) {
|
||||
body.content = body.content.filter(i => i.bannerType === 1);
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(body)});
|
||||
648
Scripts/macat/macat_signin.js
Normal file
648
Scripts/macat/macat_signin.js
Normal file
@ -0,0 +1,648 @@
|
||||
/*
|
||||
脚本作用:马克喵,每日签到
|
||||
更新时间:2023.10.14 20:55
|
||||
参考脚本:https://raw.githubusercontent.com/MCdasheng/QuantumultX/main/Scripts/myScripts/macat.js
|
||||
[task_local]
|
||||
22 7 * * * https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/macat/macat_signin.js, tag=马克喵签到, img-url=https://raw.githubusercontent.com/fmz200/wool_scripts/main/icons/apps/Macat.png, enabled=true
|
||||
@params:"fmz200.macat_loginBody" (boxjs自行填入,包含账号密码信息等)
|
||||
格式: `action=user_login&username=xxx%40gmail.com&password=xxx&rememberme=1`
|
||||
*/
|
||||
|
||||
const $ = new Env("macat");
|
||||
|
||||
signIn()
|
||||
.catch((e) => $.log(e))
|
||||
.finally(() => {
|
||||
$.log("ok");
|
||||
$.done();
|
||||
});
|
||||
|
||||
async function signIn() {
|
||||
const ck1 = await login();
|
||||
const nonce = await get_nonce(ck1);
|
||||
|
||||
let options = {
|
||||
url: "https://www.macat.vip/wp-admin/admin-ajax.php",
|
||||
headers: {
|
||||
"user-agent":
|
||||
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36",
|
||||
accept:
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"accept-encoding": "gzip, deflate, br",
|
||||
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-US;q=0.7,en-GB;q=0.6",
|
||||
cookie: ck1,
|
||||
},
|
||||
body: `action=user_qiandao&nonce=${nonce}`,
|
||||
};
|
||||
|
||||
return $.http.post(options).then((resp) => {
|
||||
$.log("🟢正在签到...");
|
||||
// $.log(resp.body);
|
||||
var obj = JSON.parse(resp.body);
|
||||
if (obj.status == 1) {
|
||||
var notice = "🎉" + obj.msg;
|
||||
$.log(notice);
|
||||
$.msg($.name, notice);
|
||||
$.done();
|
||||
} else {
|
||||
if (obj.msg) {
|
||||
$.log(obj.msg);
|
||||
$.msg($.name, obj.msg);
|
||||
$.done();
|
||||
} else {
|
||||
$.log("🔴签到失败!", resp.body);
|
||||
$.msg($.name, "🔴签到失败!");
|
||||
$.done();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async function get_nonce(ck1) {
|
||||
const ck2 = " wordpress_test_cookie=WP%20Cookie%20check; ";
|
||||
const ck_user = ck1 + "; " + ck2;
|
||||
|
||||
let options = {
|
||||
url: `https://www.macat.vip/user`,
|
||||
headers: {
|
||||
"User-Agent": `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15`,
|
||||
Cookie: ck_user,
|
||||
},
|
||||
};
|
||||
|
||||
return $.http.get(options).then((resp) => {
|
||||
$.log("🟢正在获取user页面...");
|
||||
// $.log(resp.body);
|
||||
var reg =
|
||||
/data-nonce=\"(.*)\" data-toggle=\"tooltip\" data-placement=\"bottom\" title=\"每日签到奖励: 0.2喵币\"\>/;
|
||||
if (resp.body.search(reg) != -1) {
|
||||
var nonce = reg.exec(resp.body)[1];
|
||||
$.log("🎉获取签到nonce成功!");
|
||||
$.log(nonce);
|
||||
return nonce;
|
||||
} else {
|
||||
$.log("🔴获取签到nonce失败!");
|
||||
$.log(resp.body);
|
||||
$.msg($.name, "🔴获取签到nonce失败!");
|
||||
$.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function login() {
|
||||
const loginBody = $.getdata("fmz200.macat_loginBody");
|
||||
|
||||
let options = {
|
||||
url: "https://www.macat.vip/wp-admin/admin-ajax.php",
|
||||
headers: {
|
||||
"User-Agent": `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.6 Safari/605.1.15`,
|
||||
Cookie: `wordpress_test_cookie=WP%20Cookie%20check;`,
|
||||
},
|
||||
body: loginBody,
|
||||
};
|
||||
|
||||
return $.http.post(options).then((resp) => {
|
||||
$.log("🟢正在登录...");
|
||||
// $.log(resp.body);
|
||||
var obj = JSON.parse(resp.body);
|
||||
if (obj.status == 1) {
|
||||
$.log("🎉" + obj.msg);
|
||||
var set_cookie = resp.headers["Set-Cookie"];
|
||||
// $.log(set_cookie);
|
||||
|
||||
// 数据处理:去除cookie中的附带信息,保留变量值
|
||||
var c = [];
|
||||
var a = set_cookie.split(","); // 逗号分隔每条cookie得到的数组
|
||||
for (var i = 0; i < a.length; i++) {
|
||||
var b = a[i].split(";"); // 分号分隔每条cookie详细信息
|
||||
c.push(b[0]); // b[0]即为cookie变量值
|
||||
}
|
||||
// console.log(c);
|
||||
|
||||
var cookie = "";
|
||||
var reg = /wordpress_logged_in_283f6a4de97ca3c279fbc4071e17aa86=(.*)/;
|
||||
for (var j = 0; j < c.length; j++) {
|
||||
if (c[j].search(reg) != -1) {
|
||||
var cookie = c[j];
|
||||
// $.log(c[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
cookie = cookie.trim();
|
||||
if (cookie) {
|
||||
$.log("🎉解析cookie成功!");
|
||||
$.log(cookie);
|
||||
return cookie; // 返回cookie
|
||||
} else {
|
||||
$.log("🔴解析cookie失败!");
|
||||
$.log(set_cookie);
|
||||
$.msg($.name, "🔴解析cookie失败!");
|
||||
$.done();
|
||||
}
|
||||
}
|
||||
// 登录失败
|
||||
else {
|
||||
$.log("🔴" + obj.msg);
|
||||
$.log(resp.body);
|
||||
$.msg($.name, "🔴登录失败!");
|
||||
$.done();
|
||||
}
|
||||
},
|
||||
(reason) => {
|
||||
$.msg($.name, "❌登录错误!");
|
||||
$.log(reason.error);
|
||||
$.done();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
function Env(t, s) {
|
||||
class e {
|
||||
constructor(t) {
|
||||
this.env = t;
|
||||
}
|
||||
send(t, s = "GET") {
|
||||
t = "string" == typeof t ? { url: t } : t;
|
||||
let e = this.get;
|
||||
return (
|
||||
"POST" === s && (e = this.post),
|
||||
new Promise((s, i) => {
|
||||
e.call(this, t, (t, e, r) => {
|
||||
t ? i(t) : s(e);
|
||||
});
|
||||
})
|
||||
);
|
||||
}
|
||||
get(t) {
|
||||
return this.send.call(this.env, t);
|
||||
}
|
||||
post(t) {
|
||||
return this.send.call(this.env, t, "POST");
|
||||
}
|
||||
}
|
||||
return new (class {
|
||||
constructor(t, s) {
|
||||
(this.name = t),
|
||||
(this.http = new e(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, 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 $environment && $environment["surge-version"]
|
||||
);
|
||||
}
|
||||
isLoon() {
|
||||
return "undefined" != typeof $loon;
|
||||
}
|
||||
isShadowrocket() {
|
||||
return "undefined" != typeof $rocket;
|
||||
}
|
||||
isStash() {
|
||||
return (
|
||||
"undefined" != typeof $environment && $environment["stash-version"]
|
||||
);
|
||||
}
|
||||
toObj(t, s = null) {
|
||||
try {
|
||||
return JSON.parse(t);
|
||||
} catch {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
toStr(t, s = null) {
|
||||
try {
|
||||
return JSON.stringify(t);
|
||||
} catch {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
getjson(t, s) {
|
||||
let e = s;
|
||||
const i = this.getdata(t);
|
||||
if (i)
|
||||
try {
|
||||
e = JSON.parse(this.getdata(t));
|
||||
} catch {}
|
||||
return e;
|
||||
}
|
||||
setjson(t, s) {
|
||||
try {
|
||||
return this.setdata(JSON.stringify(t), s);
|
||||
} catch {
|
||||
return !1;
|
||||
}
|
||||
}
|
||||
getScript(t) {
|
||||
return new Promise((s) => {
|
||||
this.get({ url: t }, (t, e, i) => s(i));
|
||||
});
|
||||
}
|
||||
runScript(t, s) {
|
||||
return new Promise((e) => {
|
||||
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 = s && s.timeout ? s.timeout : r);
|
||||
const [o, h] = i.split("@"),
|
||||
a = {
|
||||
url: `http://${h}/v1/scripting/evaluate`,
|
||||
body: { script_text: t, mock_type: "cron", timeout: r },
|
||||
headers: { "X-Key": o, Accept: "*/*" },
|
||||
timeout: r,
|
||||
};
|
||||
this.post(a, (t, s, i) => e(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),
|
||||
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),
|
||||
r = JSON.stringify(this.data);
|
||||
e
|
||||
? this.fs.writeFileSync(t, r)
|
||||
: i
|
||||
? this.fs.writeFileSync(s, r)
|
||||
: this.fs.writeFileSync(t, r);
|
||||
}
|
||||
}
|
||||
lodash_get(t, s, e) {
|
||||
const i = s.replace(/\[(\d+)\]/g, ".$1").split(".");
|
||||
let r = t;
|
||||
for (const t of i) if (((r = Object(r)[t]), void 0 === r)) return e;
|
||||
return r;
|
||||
}
|
||||
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),
|
||||
r = e ? this.getval(e) : "";
|
||||
if (r)
|
||||
try {
|
||||
const t = JSON.parse(r);
|
||||
s = t ? this.lodash_get(t, i, "") : s;
|
||||
} catch (t) {
|
||||
s = "";
|
||||
}
|
||||
}
|
||||
return s;
|
||||
}
|
||||
setdata(t, s) {
|
||||
let e = !1;
|
||||
if (/^@/.test(s)) {
|
||||
const [, i, r] = /^@(.*?)\.(.*?)$/.exec(s),
|
||||
o = this.getval(i),
|
||||
h = i ? ("null" === o ? null : o || "{}") : "{}";
|
||||
try {
|
||||
const s = JSON.parse(h);
|
||||
this.lodash_set(s, r, t), (e = this.setval(JSON.stringify(s), i));
|
||||
} catch (s) {
|
||||
const o = {};
|
||||
this.lodash_set(o, r, t), (e = this.setval(JSON.stringify(o), i));
|
||||
}
|
||||
} else e = this.setval(t, s);
|
||||
return e;
|
||||
}
|
||||
getval(t) {
|
||||
return this.isSurge() ||
|
||||
this.isShadowrocket() ||
|
||||
this.isLoon() ||
|
||||
this.isStash()
|
||||
? $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, s) {
|
||||
return this.isSurge() ||
|
||||
this.isShadowrocket() ||
|
||||
this.isLoon() ||
|
||||
this.isStash()
|
||||
? $persistentStore.write(t, s)
|
||||
: this.isQuanX()
|
||||
? $prefs.setValueForKey(t, s)
|
||||
: this.isNode()
|
||||
? ((this.data = this.loaddata()),
|
||||
(this.data[s] = t),
|
||||
this.writedata(),
|
||||
!0)
|
||||
: (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()),
|
||||
t &&
|
||||
((t.headers = t.headers ? t.headers : {}),
|
||||
void 0 === t.headers.Cookie &&
|
||||
void 0 === t.cookieJar &&
|
||||
(t.cookieJar = this.ckjar));
|
||||
}
|
||||
get(t, s = () => {}) {
|
||||
if (
|
||||
(t.headers &&
|
||||
(delete t.headers["Content-Type"],
|
||||
delete t.headers["Content-Length"]),
|
||||
this.isSurge() ||
|
||||
this.isShadowrocket() ||
|
||||
this.isLoon() ||
|
||||
this.isStash())
|
||||
)
|
||||
this.isSurge() &&
|
||||
this.isNeedRewrite &&
|
||||
((t.headers = t.headers || {}),
|
||||
Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })),
|
||||
$httpClient.get(t, (t, e, i) => {
|
||||
!t &&
|
||||
e &&
|
||||
((e.body = i),
|
||||
(e.statusCode = e.status ? e.status : e.statusCode),
|
||||
(e.status = e.statusCode)),
|
||||
s(t, e, i);
|
||||
});
|
||||
else if (this.isQuanX())
|
||||
this.isNeedRewrite &&
|
||||
((t.opts = t.opts || {}), Object.assign(t.opts, { hints: !1 })),
|
||||
$task.fetch(t).then(
|
||||
(t) => {
|
||||
const { statusCode: e, statusCode: i, headers: r, body: o } = t;
|
||||
s(null, { status: e, statusCode: i, headers: r, body: o }, o);
|
||||
},
|
||||
(t) => s((t && t.error) || "UndefinedError")
|
||||
);
|
||||
else if (this.isNode()) {
|
||||
let e = require("iconv-lite");
|
||||
this.initGotEnv(t),
|
||||
this.got(t)
|
||||
.on("redirect", (t, s) => {
|
||||
try {
|
||||
if (t.headers["set-cookie"]) {
|
||||
const e = t.headers["set-cookie"]
|
||||
.map(this.cktough.Cookie.parse)
|
||||
.toString();
|
||||
e && this.ckjar.setCookieSync(e, null),
|
||||
(s.cookieJar = this.ckjar);
|
||||
}
|
||||
} catch (t) {
|
||||
this.logErr(t);
|
||||
}
|
||||
})
|
||||
.then(
|
||||
(t) => {
|
||||
const {
|
||||
statusCode: i,
|
||||
statusCode: r,
|
||||
headers: o,
|
||||
rawBody: h,
|
||||
} = t,
|
||||
a = e.decode(h, this.encoding);
|
||||
s(
|
||||
null,
|
||||
{ status: i, statusCode: r, headers: o, rawBody: h, body: a },
|
||||
a
|
||||
);
|
||||
},
|
||||
(t) => {
|
||||
const { message: i, response: r } = t;
|
||||
s(i, r, r && e.decode(r.rawBody, this.encoding));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
post(t, s = () => {}) {
|
||||
const e = t.method ? t.method.toLocaleLowerCase() : "post";
|
||||
if (
|
||||
(t.body &&
|
||||
t.headers &&
|
||||
!t.headers["Content-Type"] &&
|
||||
(t.headers["Content-Type"] = "application/x-www-form-urlencoded"),
|
||||
t.headers && delete t.headers["Content-Length"],
|
||||
this.isSurge() ||
|
||||
this.isShadowrocket() ||
|
||||
this.isLoon() ||
|
||||
this.isStash())
|
||||
)
|
||||
this.isSurge() &&
|
||||
this.isNeedRewrite &&
|
||||
((t.headers = t.headers || {}),
|
||||
Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })),
|
||||
$httpClient[e](t, (t, e, i) => {
|
||||
!t &&
|
||||
e &&
|
||||
((e.body = i),
|
||||
(e.statusCode = e.status ? e.status : e.statusCode),
|
||||
(e.status = e.statusCode)),
|
||||
s(t, e, i);
|
||||
});
|
||||
else if (this.isQuanX())
|
||||
(t.method = e),
|
||||
this.isNeedRewrite &&
|
||||
((t.opts = t.opts || {}), Object.assign(t.opts, { hints: !1 })),
|
||||
$task.fetch(t).then(
|
||||
(t) => {
|
||||
const { statusCode: e, statusCode: i, headers: r, body: o } = t;
|
||||
s(null, { status: e, statusCode: i, headers: r, body: o }, o);
|
||||
},
|
||||
(t) => s((t && t.error) || "UndefinedError")
|
||||
);
|
||||
else if (this.isNode()) {
|
||||
let i = require("iconv-lite");
|
||||
this.initGotEnv(t);
|
||||
const { url: r, ...o } = t;
|
||||
this.got[e](r, o).then(
|
||||
(t) => {
|
||||
const { statusCode: e, statusCode: r, headers: o, rawBody: h } = t,
|
||||
a = i.decode(h, this.encoding);
|
||||
s(
|
||||
null,
|
||||
{ status: e, statusCode: r, headers: o, rawBody: h, body: a },
|
||||
a
|
||||
);
|
||||
},
|
||||
(t) => {
|
||||
const { message: e, response: r } = t;
|
||||
s(e, r, r && i.decode(r.rawBody, this.encoding));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
time(t, s = null) {
|
||||
const e = s ? new Date(s) : new Date();
|
||||
let i = {
|
||||
"M+": e.getMonth() + 1,
|
||||
"d+": e.getDate(),
|
||||
"H+": e.getHours(),
|
||||
"m+": e.getMinutes(),
|
||||
"s+": e.getSeconds(),
|
||||
"q+": Math.floor((e.getMonth() + 3) / 3),
|
||||
S: e.getMilliseconds(),
|
||||
};
|
||||
/(y+)/.test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
(e.getFullYear() + "").substr(4 - RegExp.$1.length)
|
||||
));
|
||||
for (let s in i)
|
||||
new RegExp("(" + s + ")").test(t) &&
|
||||
(t = t.replace(
|
||||
RegExp.$1,
|
||||
1 == RegExp.$1.length
|
||||
? i[s]
|
||||
: ("00" + i[s]).substr(("" + i[s]).length)
|
||||
));
|
||||
return t;
|
||||
}
|
||||
queryStr(t) {
|
||||
let s = "";
|
||||
for (const e in t) {
|
||||
let i = t[e];
|
||||
null != i &&
|
||||
"" !== i &&
|
||||
("object" == typeof i && (i = JSON.stringify(i)),
|
||||
(s += `${e}=${i}&`));
|
||||
}
|
||||
return (s = s.substring(0, s.length - 1)), s;
|
||||
}
|
||||
msg(s = t, e = "", i = "", r) {
|
||||
const o = (t) => {
|
||||
if (!t) return t;
|
||||
if ("string" == typeof t)
|
||||
return this.isLoon() || this.isShadowrocket()
|
||||
? t
|
||||
: this.isQuanX()
|
||||
? { "open-url": t }
|
||||
: this.isSurge() || this.isStash()
|
||||
? { url: t }
|
||||
: void 0;
|
||||
if ("object" == typeof t) {
|
||||
if (this.isLoon()) {
|
||||
let s = t.openUrl || t.url || t["open-url"],
|
||||
e = t.mediaUrl || t["media-url"];
|
||||
return { openUrl: s, mediaUrl: e };
|
||||
}
|
||||
if (this.isQuanX()) {
|
||||
let s = t["open-url"] || t.url || t.openUrl,
|
||||
e = t["media-url"] || t.mediaUrl,
|
||||
i = t["update-pasteboard"] || t.updatePasteboard;
|
||||
return { "open-url": s, "media-url": e, "update-pasteboard": i };
|
||||
}
|
||||
if (this.isSurge() || this.isShadowrocket() || this.isStash()) {
|
||||
let s = t.url || t.openUrl || t["open-url"];
|
||||
return { url: s };
|
||||
}
|
||||
}
|
||||
};
|
||||
if (
|
||||
(this.isMute ||
|
||||
(this.isSurge() ||
|
||||
this.isShadowrocket() ||
|
||||
this.isLoon() ||
|
||||
this.isStash()
|
||||
? $notification.post(s, e, i, o(r))
|
||||
: this.isQuanX() && $notify(s, e, i, o(r))),
|
||||
!this.isMuteLog)
|
||||
) {
|
||||
let t = [
|
||||
"",
|
||||
"==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3==============",
|
||||
];
|
||||
t.push(s),
|
||||
e && t.push(e),
|
||||
i && t.push(i),
|
||||
console.log(t.join("\n")),
|
||||
(this.logs = this.logs.concat(t));
|
||||
}
|
||||
}
|
||||
log(...t) {
|
||||
t.length > 0 && (this.logs = [...this.logs, ...t]),
|
||||
console.log(t.join(this.logSeparator));
|
||||
}
|
||||
logErr(t, s) {
|
||||
const e = !(
|
||||
this.isSurge() ||
|
||||
this.isShadowrocket() ||
|
||||
this.isQuanX() ||
|
||||
this.isLoon() ||
|
||||
this.isStash()
|
||||
);
|
||||
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(),
|
||||
this.isSurge() ||
|
||||
this.isShadowrocket() ||
|
||||
this.isQuanX() ||
|
||||
this.isLoon() ||
|
||||
this.isStash()
|
||||
? $done(t)
|
||||
: this.isNode() && process.exit(1);
|
||||
}
|
||||
})(t, s);
|
||||
}
|
||||
|
||||
33
Scripts/maimai/maimai_ads.js
Normal file
33
Scripts/maimai/maimai_ads.js
Normal file
@ -0,0 +1,33 @@
|
||||
/**
|
||||
* 脉脉去广告
|
||||
* 移除开屏广告、信息流广告、横幅推广、相关帖子推荐。
|
||||
* 2024-08-18 00:53:34
|
||||
*/
|
||||
const url = $request.url;
|
||||
let obj = JSON.parse($response.body);
|
||||
|
||||
if (url.includes("/maimai/feed/v5/focus_feed?")) {
|
||||
if (obj.feeds && Array.isArray(obj.feeds)) {
|
||||
obj.feeds = obj.feeds.filter(feed => !feed.newAdStyle);
|
||||
}
|
||||
}
|
||||
|
||||
if (url.includes("/maimai/gossip/v3/gossip_detail_comment?")) {
|
||||
if (obj.comments?.lst && Array.isArray(obj.comments.lst)) {
|
||||
obj.comments.lst = obj.comments.lst.filter(comment => !comment.newAdStyle);
|
||||
}
|
||||
}
|
||||
|
||||
if (url.includes("/maimai/feed/v6/feed_detail_comment?")) {
|
||||
if (obj.lst && Array.isArray(obj.lst)) {
|
||||
obj.lst = obj.lst.filter(item => !item.newAdStyle);
|
||||
}
|
||||
}
|
||||
|
||||
if (url.includes("/maimai/feed/v6/detail_recommend_feeds")) {
|
||||
delete obj.feeds;
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
|
||||
|
||||
20
Scripts/manhuatailite.js
Normal file
20
Scripts/manhuatailite.js
Normal file
@ -0,0 +1,20 @@
|
||||
/***********************************
|
||||
|
||||
> 應用名稱:漫画台Lite(微信小程序)
|
||||
> 軟件版本:0.0.0
|
||||
> 下載地址:微信小程序搜索漫画台Lite
|
||||
> 更新時間:2022-03-11
|
||||
> 特別聲明:本腳本僅供學習交流使用,禁止轉載售賣
|
||||
|
||||
[rewrite_local]
|
||||
# ~ 漫画台Lite(微信小程序)解鎖會員權限(2022-03-11)
|
||||
^https?:\/\/comic\.321mh\.com\/app_api\/v\d\/getcomicinfo_body url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/manhuatailite.js
|
||||
|
||||
[mitm]
|
||||
hostname=comic.321mh.com
|
||||
|
||||
***********************************/
|
||||
|
||||
var body = $response.body.replace(/price":\d+/g,'price":0')
|
||||
$done({ body });
|
||||
|
||||
14
Scripts/meituan/meituanV3.js
Normal file
14
Scripts/meituan/meituanV3.js
Normal file
File diff suppressed because one or more lines are too long
18
Scripts/meituan/meituan_ads.js
Normal file
18
Scripts/meituan/meituan_ads.js
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 美团去广告和多余模块 测试
|
||||
* @date 2024-02-22 20:20:13
|
||||
*/
|
||||
|
||||
let requestUrl = $request.url;
|
||||
let responseBody = $response.body;
|
||||
|
||||
let obj = JSON.parse(responseBody);
|
||||
|
||||
// https://ordercenter.meituan.com/ordercenter/user/showOrderDetail url script-response-body https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/meituan/meituan_ads.js
|
||||
if (requestUrl.includes("/ordercenter/user/showOrderDetail")) {
|
||||
obj.data.partnerData.poiStatus = 0;
|
||||
console.log('设置poiStatus为0💕');
|
||||
}
|
||||
|
||||
$done({body: JSON.stringify(obj)});
|
||||
51
Scripts/meiyou/meiyou_ads.js
Normal file
51
Scripts/meiyou/meiyou_ads.js
Normal file
File diff suppressed because one or more lines are too long
42
Scripts/miguvideo/miguvideo_ads.js
Normal file
42
Scripts/miguvideo/miguvideo_ads.js
Normal file
File diff suppressed because one or more lines are too long
3
Scripts/ming.js
Normal file
3
Scripts/ming.js
Normal file
@ -0,0 +1,3 @@
|
||||
let obj = JSON.parse($response.body);
|
||||
obj.data = [];
|
||||
$done({body: JSON.stringify(obj)});
|
||||
230
Scripts/myBlockAds.js
Normal file
230
Scripts/myBlockAds.js
Normal file
@ -0,0 +1,230 @@
|
||||
// 2024-10-15 10:05
|
||||
|
||||
const url = $request.url;
|
||||
const isResp = typeof $response !== "undefined";
|
||||
let body = $response.body;
|
||||
|
||||
switch (isResp) {
|
||||
// 草榴社区-评论区广告
|
||||
case /^https:\/\/2023\.redircdn\.com\/web\/mob_post\.js\?/.test(url):
|
||||
try {
|
||||
body = body.replace(/spinit\(\)/g, "rucu6()");
|
||||
} catch (err) {
|
||||
console.log(`草榴社区-评论区广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 嘀嗒出行-开屏广告
|
||||
case /^https:\/\/capis(-?\w*)?\.didapinche\.com\/ad\/cx\/startup\?/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
if (obj.hasOwnProperty("startupPages")) {
|
||||
obj.show_time = 1;
|
||||
obj.full_screen = 0;
|
||||
let startupPages = [];
|
||||
obj.startupPages.forEach((element) => {
|
||||
element["width"] = 1;
|
||||
element["height"] = 1;
|
||||
element["page_url"] = "#";
|
||||
startupPages.push(element);
|
||||
});
|
||||
obj.startupPages = startupPages;
|
||||
}
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`嘀嗒出行-开屏广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 多点-开屏广告
|
||||
case /^https:\/\/cmsapi\.dmall\.com\/app\/home\/homepageStartUpPic/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
for (let i = 0; i < obj["data"]["welcomePage"].length; i++) {
|
||||
obj["data"]["welcomePage"][i]["onlineTime"] = 3815740800000; // Unix 时间戳 2090-12-01 00:00:00
|
||||
obj["data"]["welcomePage"][i]["offlineTime"] = 3818419199000; // Unix 时间戳 2090-12-31 23:59:59
|
||||
}
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`多点-开屏广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 联享家-开屏广告
|
||||
case /^https:\/\/mi\.gdt\.qq\.com\/gdt_mview\.fcg/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
obj.seq = "0";
|
||||
obj.reqinterval = 0;
|
||||
delete obj.last_ads;
|
||||
delete obj.data;
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`联享家-开屏广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 淘宝-开屏视频广告
|
||||
case /^https:\/\/guide-acs\.m\.taobao\.com\/gw\/mtop\.taobao\.cloudvideo\.video\.query/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
if (obj?.data?.duration) {
|
||||
obj.data.duration = "0";
|
||||
}
|
||||
if (obj?.data?.resources?.length > 0) {
|
||||
obj.data.resources = [];
|
||||
}
|
||||
if (obj?.data?.caches?.length > 0) {
|
||||
obj.data.caches = [];
|
||||
}
|
||||
if (obj?.data?.respTimeInMs) {
|
||||
obj.data.respTimeInMs = "3818332800000";
|
||||
}
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`淘宝-开屏视频广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 淘宝-开屏图片广告
|
||||
case /^https:\/\/guide-acs\.m\.taobao\.com\/gw\/mtop\.taobao\.wireless\.home\.splash\.awesome\.get/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
if (obj?.data?.containers?.splash_home_base) {
|
||||
let splash = obj.data.containers.splash_home_base;
|
||||
if (splash?.base?.sections?.length > 0) {
|
||||
for (let items of splash.base.sections) {
|
||||
if ("taobao-splash" in items.bizData) {
|
||||
if (items?.bizData?.["taobao-splash"]?.data?.length > 0) {
|
||||
for (let item of items.bizData["taobao-splash"].data) {
|
||||
item.waitTime = "0";
|
||||
item.times = "0";
|
||||
item.hotStart = "false";
|
||||
item.haveVoice = "false";
|
||||
item.hideTBLogo = "false";
|
||||
item.enable4G = "false";
|
||||
item.coldStart = "false";
|
||||
item.waitTime = "0";
|
||||
item.startTime = "3818332800000";
|
||||
item.endTime = "3818419199000";
|
||||
item.gmtStart = "2090-12-31 00:00:00";
|
||||
item.gmtEnd = "2090-12-31 23:59:59";
|
||||
item.gmtStartMs = "3818332800000";
|
||||
item.gmtEndMs = "3818419199000";
|
||||
if (item?.imgUrl) {
|
||||
item.imgUrl = "";
|
||||
}
|
||||
if (item?.videoUrl) {
|
||||
item.videoUrl = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`淘宝-开屏图片广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 淘宝-开屏活动
|
||||
case /^https:\/\/poplayer\.template\.alibaba\.com\/\w+\.json/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
if (obj?.res?.images?.length > 0) {
|
||||
obj.res.images = [];
|
||||
}
|
||||
if (obj?.res?.videos?.length > 0) {
|
||||
obj.res.videos = [];
|
||||
}
|
||||
if (obj?.enable) {
|
||||
obj.enable = false;
|
||||
}
|
||||
if (obj?.mainRes?.images?.length > 0) {
|
||||
obj.mainRes.images = [];
|
||||
}
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`淘宝-开屏活动, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 小爱音箱-开屏广告
|
||||
case /^https:\/\/hd\.mina\.mi\.com\/splashscreen\/alert/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
let data = [];
|
||||
for (let i = 0; i < obj.data.length; i++) {
|
||||
let ad = obj.data[i];
|
||||
ad.start = "3818332800000";
|
||||
ad.end = "3818419199000";
|
||||
ad.stay = 1;
|
||||
ad.maxTimes = 1;
|
||||
data.push(ad);
|
||||
}
|
||||
obj.data = data;
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`小爱音箱-开屏广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// 小米商城-开屏广告
|
||||
case /^https:\/\/api\.m\.mi\.com\/v1\/app\/start/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
delete obj.data.splash;
|
||||
if (obj?.data?.skip_splash) {
|
||||
obj.data.skip_splash = true;
|
||||
}
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`小米商城-开屏广告, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
// JavDB
|
||||
case /^https:\/\/api\.hechuangxinxi\.xyz\/api\/v\d\/\w+/.test(url):
|
||||
try {
|
||||
let obj = JSON.parse(body);
|
||||
if (url.includes("/api/v1/ads")) {
|
||||
// 首页banner
|
||||
if (obj?.data?.ads?.index_top?.length > 0) {
|
||||
// 黑名单 移除http外链
|
||||
obj.data.ads.index_top = obj.data.ads.index_top.filter((i) => !/https?:\/\//.test(i?.url));
|
||||
}
|
||||
if (obj?.data?.ads?.web_magnets_top?.length > 0) {
|
||||
// 黑名单 移除http外链
|
||||
obj.data.ads.web_magnets_top = obj.data.ads.web_magnets_top.filter((i) => !/https?:\/\//.test(i?.url));
|
||||
}
|
||||
} else if (url.includes("/api/v1/startup")) {
|
||||
// 开屏广告
|
||||
delete obj.data.settings.NOTICE; // 首次进入的提示
|
||||
if (obj?.data?.splash_ad) {
|
||||
obj.data.splash_ad.enabled = false;
|
||||
obj.data.splash_ad.overtime = 0;
|
||||
}
|
||||
if (obj?.data?.feedback) {
|
||||
obj.data.feedback = {};
|
||||
}
|
||||
if (obj?.data?.user) {
|
||||
// obj.data.user.vip_expired_at = "2090-12-31T23:59:59.000+08:00";
|
||||
// obj.data.user.is_vip = true;
|
||||
}
|
||||
} else if (url.includes("/api/v1/users")) {
|
||||
// 伪装会员
|
||||
if (obj?.data?.user) {
|
||||
// obj.data.user.vip_expired_at = "2090-12-31T23:59:59.000+08:00";
|
||||
// obj.data.user.is_vip = true;
|
||||
}
|
||||
} else if (url.includes("/api/v4/movies/")) {
|
||||
// 详情页banner
|
||||
if (obj?.data?.show_vip_banner) {
|
||||
obj.data.show_vip_banner = false;
|
||||
}
|
||||
} else {
|
||||
$done({});
|
||||
}
|
||||
body = JSON.stringify(obj);
|
||||
} catch (err) {
|
||||
console.log(`JavDB, 出现异常: ` + err);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$done({});
|
||||
}
|
||||
|
||||
$done({ body });
|
||||
23
Scripts/picc/picc_ads.js
Normal file
23
Scripts/picc/picc_ads.js
Normal file
@ -0,0 +1,23 @@
|
||||
/**
|
||||
* @author Sliverkiss
|
||||
* @function 中国人保app 去广告
|
||||
* @date 2024-02-18 18:18:00
|
||||
*/
|
||||
|
||||
const Body = JSON.parse($response.body);
|
||||
const url = $request.url;
|
||||
|
||||
const actions = {
|
||||
'homeInit': () => {
|
||||
Body.data.startupPage = {};
|
||||
Body.data.templates = Body.data.templates.filter(e => !e.name.match(/主轮播图|保险推荐|专享|腰封轮播图|浮标配置|二楼营销位|首页主题/));
|
||||
},
|
||||
'myPageConfigList': () => {
|
||||
Body.data.YFList = [];
|
||||
}
|
||||
};
|
||||
|
||||
const actionKey = Object.keys(actions).find(key => url.includes(key));
|
||||
actions[actionKey]?.();
|
||||
|
||||
$done({body: JSON.stringify(Body)});
|
||||
361
Scripts/pinduoduo/pdd_fruit.js
Normal file
361
Scripts/pinduoduo/pdd_fruit.js
Normal file
File diff suppressed because one or more lines are too long
37
Scripts/pinduoduo/pdd_getToken.js
Normal file
37
Scripts/pinduoduo/pdd_getToken.js
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* 脚本作用:拼多多果园获取token
|
||||
* 重写地址:暂时没有确定具体是那个请求URL会携带token,因为每次手动抓包获取token的url都不一样
|
||||
* 触发类型:request-header
|
||||
* 获取方式:小程序或APP进果园逛一圈+浇水,在请求头request-header中搜索PDDAccessToken
|
||||
* 注意事项:每次脚本获取会覆盖之前的ck,暂时不支持脚本获取多个token,建议手动抓取然后填到boxjs里面,多账号用@隔开:tk1@tk2
|
||||
* 更新时间:2023.01.07 12:30
|
||||
*/
|
||||
|
||||
const $ = new API("pdd_getToken");
|
||||
!(async () => {
|
||||
// 暂时不确定哪个URL会携带PDDAccessToken
|
||||
// Cookie: pdd_vds=xxx; ETag=dKJLmoeS; PDDAccessToken=12HUHDUW; install_token=118E4FCA;
|
||||
if ($request.headers) {
|
||||
var cookieValue = $request.headers["Cookie"] || $request.headers["cookie"];
|
||||
const token = cookieValue.match(/PDDAccessToken=.+?/);
|
||||
// const token = `${$request.headers['PDDAccessToken']}`
|
||||
// const userId = ck.match(/userId=.+?;/)
|
||||
if (token) {
|
||||
$.write(token, '#ddgyck');
|
||||
$.notify('拼多多果园token获取成功', '', token);
|
||||
console.log('token:' + token);
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
().catch((e) => {
|
||||
console.log('', `❌失败! 原因: ${e}!`, '');
|
||||
}).finally(() => {
|
||||
$.done({});
|
||||
})
|
||||
|
||||
/*********************************** API *************************************/
|
||||
function ENV(){const isQX=typeof $task!=="undefined";const isLoon=typeof $loon!=="undefined";const isSurge=typeof $httpClient!=="undefined"&&!isLoon;const isJSBox=typeof require=="function"&&typeof $jsbox!="undefined";const isNode=typeof require=="function"&&!isJSBox;const isRequest=typeof $request!=="undefined";const isScriptable=typeof importModule!=="undefined";return{isQX,isLoon,isSurge,isNode,isJSBox,isRequest,isScriptable}}
|
||||
function HTTP(baseURL,defaultOptions={}){const{isQX,isLoon,isSurge,isScriptable,isNode}=ENV();const methods=["GET","POST","PUT","DELETE","HEAD","OPTIONS","PATCH"];function send(method,options){options=typeof options==="string"?{url:options}:options;options.url=baseURL?baseURL+options.url:options.url;options={...defaultOptions,...options};const timeout=options.timeout;const events={...{onRequest:()=>{},onResponse:(resp)=>resp,onTimeout:()=>{},},...options.events,};events.onRequest(method,options);let worker;if(isQX){worker=$task.fetch({method,...options})}else if(isLoon||isSurge||isNode){worker=new Promise((resolve,reject)=>{const request=isNode?require("request"):$httpClient;request[method.toLowerCase()](options,(err,response,body)=>{if(err)reject(err);else resolve({statusCode:response.status||response.statusCode,headers:response.headers,body,})})})}else if(isScriptable){const request=new Request(options.url);request.method=method;request.headers=options.headers;request.body=options.body;worker=new Promise((resolve,reject)=>{request.loadString().then((body)=>{resolve({statusCode:request.response.statusCode,headers:request.response.headers,body,})}).catch((err)=>reject(err))})}let timeoutid;const timer=timeout?new Promise((_,reject)=>{timeoutid=setTimeout(()=>{events.onTimeout();return reject(`${method}URL:${options.url}exceeds the timeout ${timeout}ms`)},timeout)}):null;return(timer?Promise.race([timer,worker]).then((res)=>{clearTimeout(timeoutid);return res}):worker).then((resp)=>events.onResponse(resp))}const http={};methods.forEach((method)=>(http[method.toLowerCase()]=(options)=>send(method,options)));return http}
|
||||
function API(name="untitled",debug=false){const{isQX,isLoon,isSurge,isNode,isJSBox,isScriptable}=ENV();return new(class{constructor(name,debug){this.name=name;this.debug=debug;this.http=HTTP();this.env=ENV();this.node=(()=>{if(isNode){const fs=require("fs");return{fs}}else{return null}})();this.initCache();const delay=(t,v)=>new Promise(function(resolve){setTimeout(resolve.bind(null,v),t)});Promise.prototype.delay=function(t){return this.then(function(v){return delay(t,v)})}}initCache(){if(isQX)this.cache=JSON.parse($prefs.valueForKey(this.name)||"{}");if(isLoon||isSurge)this.cache=JSON.parse($persistentStore.read(this.name)||"{}");if(isNode){let fpath="root.json";if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err))}this.root={};fpath=`${this.name}.json`;if(!this.node.fs.existsSync(fpath)){this.node.fs.writeFileSync(fpath,JSON.stringify({}),{flag:"wx"},(err)=>console.log(err));this.cache={}}else{this.cache=JSON.parse(this.node.fs.readFileSync(`${this.name}.json`))}}}persistCache(){const data=JSON.stringify(this.cache);if(isQX)$prefs.setValueForKey(data,this.name);if(isLoon||isSurge)$persistentStore.write(data,this.name);if(isNode){this.node.fs.writeFileSync(`${this.name}.json`,data,{flag:"w"},(err)=>console.log(err));this.node.fs.writeFileSync("root.json",JSON.stringify(this.root),{flag:"w"},(err)=>console.log(err))}}write(data,key){this.log(`SET ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.write(data,key)}if(isQX){return $prefs.setValueForKey(data,key)}if(isNode){this.root[key]=data}}else{this.cache[key]=data}this.persistCache()}read(key){this.log(`READ ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){return $persistentStore.read(key)}if(isQX){return $prefs.valueForKey(key)}if(isNode){return this.root[key]}}else{return this.cache[key]}}delete(key){this.log(`DELETE ${key}`);if(key.indexOf("#")!==-1){key=key.substr(1);if(isSurge||isLoon){$persistentStore.write(null,key)}if(isQX){$prefs.removeValueForKey(key)}if(isNode){delete this.root[key]}}else{delete this.cache[key]}this.persistCache()}notify(title,subtitle="",content="",options={}){const openURL=options["open-url"];const mediaURL=options["media-url"];if(isQX)$notify(title,subtitle,content,options);if(isSurge){$notification.post(title,subtitle,content+`${mediaURL?"\n多媒体:"+mediaURL:""}`,{url:openURL})}if(isLoon){let opts={};if(openURL)opts["openUrl"]=openURL;if(mediaURL)opts["mediaUrl"]=mediaURL;if(JSON.stringify(opts)=="{}"){$notification.post(title,subtitle,content)}else{$notification.post(title,subtitle,content,opts)}}if(isNode||isScriptable){const content_=content+(openURL?`\n点击跳转:${openURL}`:"")+(mediaURL?`\n多媒体:${mediaURL}`:"");if(isJSBox){const push=require("push");push.schedule({title:title,body:(subtitle?subtitle+"\n":"")+content_,})}else{console.log(`${title}\n${subtitle}\n${content_}\n\n`)}}}log(msg){if(this.debug)console.log(msg)}info(msg){console.log(msg)}error(msg){console.log("ERROR: "+msg)}wait(millisec){return new Promise((resolve)=>setTimeout(resolve,millisec))}done(value={}){if(isQX||isLoon||isSurge){$done(value)}else if(isNode&&!isJSBox){if(typeof $context!=="undefined"){$context.headers=value.headers;$context.statusCode=value.statusCode;$context.body=value.body}}}})(name,debug)}
|
||||
/*****************************************************************************/
|
||||
17
Scripts/pinduoduo/pdd_guoyuan.js
Normal file
17
Scripts/pinduoduo/pdd_guoyuan.js
Normal file
File diff suppressed because one or more lines are too long
3
Scripts/qingju.js
Normal file
3
Scripts/qingju.js
Normal file
@ -0,0 +1,3 @@
|
||||
let obj=JSON.parse($response.body);
|
||||
delete obj.data.bannerInfoConfig ;
|
||||
$done({body: JSON.stringify(obj)});
|
||||
265
Scripts/qinglong/api.js
Normal file
265
Scripts/qinglong/api.js
Normal file
@ -0,0 +1,265 @@
|
||||
'use strict';
|
||||
|
||||
const got = require('got');
|
||||
require('dotenv').config();
|
||||
const {readFile} = require('fs/promises');
|
||||
const fs = require('fs');
|
||||
let fileExists = fs.existsSync('/ql/data/config/auth.json');
|
||||
let authFile = "";
|
||||
if (fileExists)
|
||||
authFile = "/ql/data/config/auth.json"
|
||||
else
|
||||
authFile = "/ql/config/auth.json"
|
||||
|
||||
const api = got.extend({
|
||||
prefixUrl: 'http://127.0.0.1:5600',
|
||||
retry: {limit: 0},
|
||||
});
|
||||
|
||||
async function getToken() {
|
||||
const authConfig = JSON.parse(await readFile(authFile));
|
||||
return authConfig.token;
|
||||
}
|
||||
|
||||
module.exports.getEnvsByNameBackUp = async (searchValue) => {
|
||||
const token = await getToken();
|
||||
const body = await api({
|
||||
url: 'api/envs',
|
||||
searchParams: {
|
||||
searchValue: searchValue,
|
||||
t: Date.now(),
|
||||
},
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'authorization': `Bearer ${token}`,
|
||||
'host': '127.0.0.1',
|
||||
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'
|
||||
},
|
||||
}).json();
|
||||
return body.data;
|
||||
};
|
||||
|
||||
module.exports.getEnvsByName = async (searchValue) => {
|
||||
const token = await getToken();
|
||||
const url = `http://127.0.0.1:5600/api/envs?searchValue=${searchValue}&t=` + Date.now();
|
||||
const headers = {
|
||||
"Accept": "application/json",
|
||||
"authorization": `Bearer ${token}`,
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
"host": "127.0.0.1",
|
||||
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
|
||||
}
|
||||
const request = {
|
||||
method: "get",
|
||||
headers: headers
|
||||
}
|
||||
console.log("url=" + url);
|
||||
console.log("request=" + JSON.stringify(request));
|
||||
fetch(url, request)
|
||||
.then(response => {
|
||||
console.log(response.status + "\n\n" + response.statusText);
|
||||
return response.text();
|
||||
})
|
||||
.then(body => {
|
||||
console.log(body);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.getEnvsCount = async () => {
|
||||
const data = await this.getEnvsByName();
|
||||
return data.length;
|
||||
};
|
||||
|
||||
module.exports.addEnv = async (cookie, remarks) => {
|
||||
const token = await getToken();
|
||||
return await api({
|
||||
method: 'post',
|
||||
url: 'api/envs',
|
||||
params: {t: Date.now()},
|
||||
json: [{
|
||||
name: 'JD_COOKIE',
|
||||
value: cookie,
|
||||
remarks,
|
||||
}],
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
}).json();
|
||||
};
|
||||
|
||||
module.exports.updateEnv = async (value, eid, remarks) => {
|
||||
const token = await getToken();
|
||||
const body = await api({
|
||||
method: 'put',
|
||||
url: 'api/envs',
|
||||
params: {t: Date.now()},
|
||||
json: {
|
||||
name: 'JD_COOKIE',
|
||||
value: value,
|
||||
_id: eid,
|
||||
remarks,
|
||||
},
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
}).json();
|
||||
return body;
|
||||
};
|
||||
|
||||
module.exports.updateEnvByIdBackUp = async (name, value, eid, remarks) => {
|
||||
const token = await getToken();
|
||||
return await api({
|
||||
method: 'put',
|
||||
url: 'api/envs',
|
||||
params: {t: Date.now()},
|
||||
json: {
|
||||
name: name,
|
||||
value: value,
|
||||
id: eid,
|
||||
remarks,
|
||||
},
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
}).json();
|
||||
};
|
||||
|
||||
// id是必传字段,否则青龙会报错
|
||||
module.exports.updateEnvById = async (id, name, value, remarks) => {
|
||||
const token = await getToken();
|
||||
const url = "http://127.0.0.1:5600/api/envs?t=" + Date.now();
|
||||
const headers = {
|
||||
"Accept": "application/json",
|
||||
"authorization": `Bearer ${token}`,
|
||||
"Content-Type": "application/json;charset=UTF-8",
|
||||
"host": "127.0.0.1",
|
||||
"user-agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1"
|
||||
}
|
||||
const body = {
|
||||
"id": id,
|
||||
"name": name,
|
||||
"value": value,
|
||||
"remarks": remarks
|
||||
};
|
||||
const request = {
|
||||
method: "put",
|
||||
headers: headers,
|
||||
body: JSON.stringify(body)
|
||||
}
|
||||
console.log("request=" + JSON.stringify(request));
|
||||
fetch(url, request)
|
||||
.then(response => {
|
||||
console.log(response.status + "\n\n" + response.statusText);
|
||||
return response.text();
|
||||
})
|
||||
.then(body => {
|
||||
console.log(body);
|
||||
})
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.DisableCk = async (eid) => {
|
||||
const token = await getToken();
|
||||
const body = await api({
|
||||
method: 'put',
|
||||
url: 'api/envs/disable',
|
||||
params: {t: Date.now()},
|
||||
body: JSON.stringify([eid]),
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
}).json();
|
||||
return body;
|
||||
};
|
||||
|
||||
module.exports.EnableCk = async (eid) => {
|
||||
const token = await getToken();
|
||||
const body = await api({
|
||||
method: 'put',
|
||||
url: 'api/envs/enable',
|
||||
params: {t: Date.now()},
|
||||
body: JSON.stringify([eid]),
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
}).json();
|
||||
return body;
|
||||
};
|
||||
|
||||
module.exports.getStatus = async (eid) => {
|
||||
const envs = await this.getEnvsByName();
|
||||
var tempid = 0;
|
||||
for (let i = 0; i < envs.length; i++) {
|
||||
tempid = 0;
|
||||
if (envs[i]._id) {
|
||||
tempid = envs[i]._id;
|
||||
}
|
||||
if (envs[i].id) {
|
||||
tempid = envs[i].id;
|
||||
}
|
||||
if (tempid == eid) {
|
||||
return envs[i].status;
|
||||
}
|
||||
}
|
||||
return 99;
|
||||
};
|
||||
|
||||
module.exports.getEnvById = async (eid) => {
|
||||
const envs = await this.getEnvsByName();
|
||||
var tempid = 0;
|
||||
for (let i = 0; i < envs.length; i++) {
|
||||
tempid = 0;
|
||||
if (envs[i]._id) {
|
||||
tempid = envs[i]._id;
|
||||
}
|
||||
if (envs[i].id) {
|
||||
tempid = envs[i].id;
|
||||
}
|
||||
if (tempid == eid) {
|
||||
return envs[i].value;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
module.exports.getEnvByPtPin = async (Ptpin) => {
|
||||
const envs = await this.getEnvsByName();
|
||||
for (let i = 0; i < envs.length; i++) {
|
||||
var tempptpin = decodeURIComponent(envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/) && envs[i].value.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
|
||||
if (tempptpin == Ptpin) {
|
||||
return envs[i];
|
||||
}
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
module.exports.delEnv = async (eid) => {
|
||||
const token = await getToken();
|
||||
const body = await api({
|
||||
method: 'delete',
|
||||
url: 'api/envs',
|
||||
params: {t: Date.now()},
|
||||
body: JSON.stringify([eid]),
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
authorization: `Bearer ${token}`,
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
}).json();
|
||||
return body;
|
||||
};
|
||||
141
Scripts/qinglong/ql_api.js
Normal file
141
Scripts/qinglong/ql_api.js
Normal file
@ -0,0 +1,141 @@
|
||||
$.ql = {
|
||||
type: 'api',
|
||||
headers: {
|
||||
'Content-Type': `application/json;charset=UTF-8`,
|
||||
Authorization: '',
|
||||
},
|
||||
disabled(ids) {
|
||||
if (!this.headers.Authorization) return;
|
||||
const opt = {
|
||||
url: `${$.ql_url}/${this.type}/envs/disable`,
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(ids),
|
||||
};
|
||||
return $.http.put(opt).then((response) => JSON.parse(response.body));
|
||||
},
|
||||
enabled(ids) {
|
||||
if (!this.headers.Authorization) return;
|
||||
const opt = {
|
||||
url: `${$.ql_url}/${this.type}/envs/enable`,
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(ids),
|
||||
};
|
||||
return $.http.put(opt).then((response) => JSON.parse(response.body));
|
||||
},
|
||||
delete(ids) {
|
||||
if (!this.headers.Authorization) return;
|
||||
const opt = {
|
||||
url: `${$.ql_url}/${this.type}/envs`,
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(ids),
|
||||
};
|
||||
return $.http.delete(opt).then((response) => JSON.parse(response.body));
|
||||
},
|
||||
add(records) {
|
||||
if (!this.headers.Authorization) return;
|
||||
const opt = {
|
||||
url: `${$.ql_url}/${this.type}/envs`,
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(records),
|
||||
};
|
||||
return $.http.post(opt).then((response) => JSON.parse(response.body));
|
||||
},
|
||||
edit(records) {
|
||||
if (!this.headers.Authorization) return;
|
||||
const opt = {
|
||||
url: `${$.ql_url}/${this.type}/envs`,
|
||||
headers: this.headers,
|
||||
body: JSON.stringify(records),
|
||||
};
|
||||
return $.http.put(opt).then((response) => JSON.parse(response.body));
|
||||
},
|
||||
select(searchValue) {
|
||||
if (!this.headers.Authorization) return;
|
||||
const opt = {
|
||||
url: `${$.ql_url}/${this.type}/envs?searchValue=${searchValue}`,
|
||||
headers: this.headers,
|
||||
};
|
||||
return $.http.get(opt).then((response) => JSON.parse(response.body));
|
||||
},
|
||||
initial: () => {
|
||||
$.ql_url = $.ql_config.ip;
|
||||
if ($.ql_url && !$.ql_url.match(/^(http|https)/))
|
||||
$.ql_url = `http://${$.ql_url}`;
|
||||
|
||||
$.application = {
|
||||
client_id: $.ql_config.client_id,
|
||||
client_secret: $.ql_config.client_secret,
|
||||
};
|
||||
|
||||
$.ql_account = {
|
||||
username: $.ql_config.username,
|
||||
password: $.ql_config.password,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
try {
|
||||
$.ql_config = JSON.parse($.read('#ql'));
|
||||
} catch (e) {
|
||||
$.ql_config = {};
|
||||
}
|
||||
|
||||
$.ql.initial();
|
||||
|
||||
$.log(`地址:${$.ql_url}`);
|
||||
|
||||
function noReady() {
|
||||
$.ql = false;
|
||||
$.log('请配置好相关信息');
|
||||
}
|
||||
|
||||
if ($.ql_config.is_pwd === 'true') {
|
||||
if ($.ql_account.username && $.ql_account.password) {
|
||||
$.ql.login = async () => {
|
||||
const options = {
|
||||
url: `${$.ql_url}/api/user/login`,
|
||||
body: JSON.stringify($.ql_account),
|
||||
headers: {
|
||||
'Content-Type': `application/json;charset=UTF-8`,
|
||||
},
|
||||
};
|
||||
|
||||
let response = await $.http.post(options);
|
||||
response = JSON.parse(response.body);
|
||||
if (response.code === 200) {
|
||||
$.ql.type = 'api';
|
||||
$.ql.headers.Authorization = `Bearer ${response.data.token}`;
|
||||
$.log(`登陆成功:${response.data.lastaddr}`);
|
||||
$.log(`ip:${response.data.lastip}`);
|
||||
} else {
|
||||
$.log(response);
|
||||
$.log(`登陆失败:${response.message}`);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
noReady();
|
||||
}
|
||||
} else {
|
||||
if ($.application.client_id && $.application.client_secret) {
|
||||
$.ql.login = async () => {
|
||||
const options = {
|
||||
url: `${$.ql_url}/open/auth/token?client_id=${$.application.client_id}&client_secret=${$.application.client_secret}`,
|
||||
headers: {
|
||||
'Content-Type': `application/json;charset=UTF-8`,
|
||||
},
|
||||
};
|
||||
let response = await $.http.get(options);
|
||||
response = JSON.parse(response.body);
|
||||
if (response.code === 200) {
|
||||
$.ql.type = 'open';
|
||||
$.ql.headers.Authorization = `Bearer ${response.data.token}`;
|
||||
$.log(`登陆成功`);
|
||||
} else {
|
||||
$.log(response);
|
||||
$.log(`登陆失败:${response.message}`);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
noReady();
|
||||
}
|
||||
}
|
||||
413
Scripts/qinglong/ql_sync.js
Normal file
413
Scripts/qinglong/ql_sync.js
Normal file
@ -0,0 +1,413 @@
|
||||
/**
|
||||
* 作者:fmz200,修改自dompling的ql_cookie_sync.js
|
||||
* 作用:定时同步BoxJS中的数据到青龙环境变量,每日自动同步
|
||||
* 配置:40 0 * * * https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/qinglong/ql_sync.js
|
||||
* 定时:QX导入订阅 https://raw.githubusercontent.com/fmz200/wool_scripts/main/boxjs/fmz200_gallery.json
|
||||
* 使用:详见BoxJS页面 https://raw.githubusercontent.com/fmz200/wool_scripts/main/boxjs/fmz200.boxjs.json
|
||||
* 更新:2023-06-04 13:30
|
||||
*/
|
||||
|
||||
const $ = new API('ql', true);
|
||||
|
||||
const title = '🐉 同步通知';
|
||||
|
||||
const sync_keys = $.read('#ql_sync_keys').replace(/\s/g, '').split(',') || [];
|
||||
if (sync_keys.length === 0) {
|
||||
$.notify(title, '', `未填写需要同步的keys,请在BoxJS填写正确`);
|
||||
$.done();
|
||||
}
|
||||
|
||||
let remark = {};
|
||||
|
||||
!(async () => {
|
||||
// 只登陆一次
|
||||
const ql_script = (await getScriptUrl()) || '';
|
||||
eval(ql_script);
|
||||
await $.ql.login();
|
||||
// 开始同步数据
|
||||
for await (const key of sync_keys) {
|
||||
await autoSync(key);
|
||||
}
|
||||
const keyText = sync_keys.map((item) => item).join(`\n`);
|
||||
if ($.read('ql_sync_notify') !== 'true') {
|
||||
$.notify(title, '', `已同步以下keys的数据:\n${keyText}`);
|
||||
}
|
||||
$.done();
|
||||
})();
|
||||
|
||||
async function autoSync(key_remark) {
|
||||
$.log(`--------------------`);
|
||||
try {
|
||||
// key可能包含两部分:key@remark
|
||||
let key;
|
||||
let remark;
|
||||
if (key_remark.includes('@')) {
|
||||
[key, remark] = key_remark.split('@');
|
||||
} else {
|
||||
key = key_remark;
|
||||
remark = 'BoxJS同步的数据'; // 如果没有备注,可以设置为 null 或其他默认值
|
||||
}
|
||||
const values = await $.ql.select(key); // 同一个key可能有多个值,暂时只做一个的同步
|
||||
await $.ql.delete(values.data.map((item) => item.id));
|
||||
$.log(`已清空${key}的数据`);
|
||||
|
||||
const addData = [];
|
||||
const key_value = $.read(`#${key}`);
|
||||
$.log(`已读取${key}的数据`);
|
||||
addData.push({name: key, value: key_value, remarks: remark});
|
||||
if (addData.length) await $.ql.add(addData);
|
||||
$.log(`已同步${key}的数据`);
|
||||
} catch (e) {
|
||||
$.log(`同步${key_remark}的数据时发生错误:` + JSON.stringify(e));
|
||||
}
|
||||
$.log(`--------------------`);
|
||||
}
|
||||
|
||||
async function getScriptUrl() {
|
||||
const response = await $.http.get({
|
||||
url: 'https://raw.githubusercontent.com/fmz200/wool_scripts/main/Scripts/qinglong/ql_api.js',
|
||||
});
|
||||
return response.body;
|
||||
}
|
||||
|
||||
function getURL(api, key = 'api') {
|
||||
return `${baseURL}/${key}/${api}`;
|
||||
}
|
||||
|
||||
function login() {
|
||||
const opt = {
|
||||
headers,
|
||||
url: getURL('login'),
|
||||
body: JSON.stringify(account),
|
||||
};
|
||||
return $.http.post(opt).then((response) => JSON.parse(response.body));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
function ENV() {
|
||||
const isQX = typeof $task !== 'undefined';
|
||||
const isLoon = typeof $loon !== 'undefined';
|
||||
const isSurge = typeof $httpClient !== 'undefined' && !isLoon;
|
||||
const isJSBox = typeof require == 'function' && typeof $jsbox != 'undefined';
|
||||
const isNode = typeof require == 'function' && !isJSBox;
|
||||
const isRequest = typeof $request !== 'undefined';
|
||||
const isScriptable = typeof importModule !== 'undefined';
|
||||
return {isQX, isLoon, isSurge, isNode, isJSBox, isRequest, isScriptable};
|
||||
}
|
||||
|
||||
function HTTP(defaultOptions = {baseURL: ''}) {
|
||||
const {isQX, isLoon, isSurge, isScriptable, isNode} = ENV();
|
||||
const methods = ['GET', 'POST', 'PUT', 'DELETE', 'HEAD', 'OPTIONS', 'PATCH'];
|
||||
const URL_REGEX =
|
||||
/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
|
||||
|
||||
function send(method, options) {
|
||||
options = typeof options === 'string' ? {url: options} : options;
|
||||
const baseURL = defaultOptions.baseURL;
|
||||
if (baseURL && !URL_REGEX.test(options.url || '')) {
|
||||
options.url = baseURL ? baseURL + options.url : options.url;
|
||||
}
|
||||
options = {...defaultOptions, ...options};
|
||||
const timeout = options.timeout;
|
||||
const events = {
|
||||
...{
|
||||
onRequest: () => {
|
||||
},
|
||||
onResponse: (resp) => resp,
|
||||
onTimeout: () => {
|
||||
},
|
||||
},
|
||||
...options.events,
|
||||
};
|
||||
|
||||
events.onRequest(method, options);
|
||||
|
||||
let worker;
|
||||
if (isQX) {
|
||||
worker = $task.fetch({method, ...options});
|
||||
} else if (isLoon || isSurge || isNode) {
|
||||
worker = new Promise((resolve, reject) => {
|
||||
const request = isNode ? require('request') : $httpClient;
|
||||
request[method.toLowerCase()](options, (err, response, body) => {
|
||||
if (err) reject(err);
|
||||
else
|
||||
resolve({
|
||||
statusCode: response.status || response.statusCode,
|
||||
headers: response.headers,
|
||||
body,
|
||||
});
|
||||
});
|
||||
});
|
||||
} else if (isScriptable) {
|
||||
const request = new Request(options.url);
|
||||
request.method = method;
|
||||
request.headers = options.headers;
|
||||
request.body = options.body;
|
||||
worker = new Promise((resolve, reject) => {
|
||||
request
|
||||
.loadString()
|
||||
.then((body) => {
|
||||
resolve({
|
||||
statusCode: request.response.statusCode,
|
||||
headers: request.response.headers,
|
||||
body,
|
||||
});
|
||||
})
|
||||
.catch((err) => reject(err));
|
||||
});
|
||||
}
|
||||
|
||||
let timeoutid;
|
||||
const timer = timeout
|
||||
? new Promise((_, reject) => {
|
||||
timeoutid = setTimeout(() => {
|
||||
events.onTimeout();
|
||||
return reject(
|
||||
`${method} URL: ${options.url} exceeds the timeout ${timeout} ms`
|
||||
);
|
||||
}, timeout);
|
||||
})
|
||||
: null;
|
||||
|
||||
return (
|
||||
timer
|
||||
? Promise.race([timer, worker]).then((res) => {
|
||||
clearTimeout(timeoutid);
|
||||
return res;
|
||||
})
|
||||
: worker
|
||||
).then((resp) => events.onResponse(resp));
|
||||
}
|
||||
|
||||
const http = {};
|
||||
methods.forEach(
|
||||
(method) =>
|
||||
(http[method.toLowerCase()] = (options) => send(method, options))
|
||||
);
|
||||
return http;
|
||||
}
|
||||
|
||||
function API(name = 'untitled', debug = false) {
|
||||
const {isQX, isLoon, isSurge, isNode, isJSBox, isScriptable} = ENV();
|
||||
return new (class {
|
||||
constructor(name, debug) {
|
||||
this.name = name;
|
||||
this.debug = debug;
|
||||
|
||||
this.http = HTTP();
|
||||
this.env = ENV();
|
||||
|
||||
this.node = (() => {
|
||||
if (isNode) {
|
||||
const fs = require('fs');
|
||||
|
||||
return {
|
||||
fs,
|
||||
};
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
})();
|
||||
this.initCache();
|
||||
|
||||
const delay = (t, v) =>
|
||||
new Promise(function (resolve) {
|
||||
setTimeout(resolve.bind(null, v), t);
|
||||
});
|
||||
|
||||
Promise.prototype.delay = function (t) {
|
||||
return this.then(function (v) {
|
||||
return delay(t, v);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// persistance
|
||||
|
||||
// initialize cache
|
||||
initCache() {
|
||||
if (isQX) this.cache = JSON.parse($prefs.valueForKey(this.name) || '{}');
|
||||
if (isLoon || isSurge)
|
||||
this.cache = JSON.parse($persistentStore.read(this.name) || '{}');
|
||||
|
||||
if (isNode) {
|
||||
// create a json for root cache
|
||||
let fpath = 'root.json';
|
||||
if (!this.node.fs.existsSync(fpath)) {
|
||||
this.node.fs.writeFileSync(
|
||||
fpath,
|
||||
JSON.stringify({}),
|
||||
{flag: 'wx'},
|
||||
(err) => console.log(err)
|
||||
);
|
||||
}
|
||||
this.root = {};
|
||||
|
||||
// create a json file with the given name if not exists
|
||||
fpath = `${this.name}.json`;
|
||||
if (!this.node.fs.existsSync(fpath)) {
|
||||
this.node.fs.writeFileSync(
|
||||
fpath,
|
||||
JSON.stringify({}),
|
||||
{flag: 'wx'},
|
||||
(err) => console.log(err)
|
||||
);
|
||||
this.cache = {};
|
||||
} else {
|
||||
this.cache = JSON.parse(
|
||||
this.node.fs.readFileSync(`${this.name}.json`)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// store cache
|
||||
persistCache() {
|
||||
const data = JSON.stringify(this.cache);
|
||||
if (isQX) $prefs.setValueForKey(data, this.name);
|
||||
if (isLoon || isSurge) $persistentStore.write(data, this.name);
|
||||
if (isNode) {
|
||||
this.node.fs.writeFileSync(
|
||||
`${this.name}.json`,
|
||||
data,
|
||||
{flag: 'w'},
|
||||
(err) => console.log(err)
|
||||
);
|
||||
this.node.fs.writeFileSync(
|
||||
'root.json',
|
||||
JSON.stringify(this.root),
|
||||
{flag: 'w'},
|
||||
(err) => console.log(err)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
write(data, key) {
|
||||
this.log(`SET ${key}`);
|
||||
if (key.indexOf('#') !== -1) {
|
||||
key = key.substr(1);
|
||||
if (isSurge || isLoon) {
|
||||
return $persistentStore.write(data, key);
|
||||
}
|
||||
if (isQX) {
|
||||
return $prefs.setValueForKey(data, key);
|
||||
}
|
||||
if (isNode) {
|
||||
this.root[key] = data;
|
||||
}
|
||||
} else {
|
||||
this.cache[key] = data;
|
||||
}
|
||||
this.persistCache();
|
||||
}
|
||||
|
||||
read(key) {
|
||||
this.log(`READ ${key}`);
|
||||
if (key.indexOf('#') !== -1) {
|
||||
key = key.substr(1);
|
||||
if (isSurge || isLoon) {
|
||||
return $persistentStore.read(key);
|
||||
}
|
||||
if (isQX) {
|
||||
return $prefs.valueForKey(key);
|
||||
}
|
||||
if (isNode) {
|
||||
return this.root[key];
|
||||
}
|
||||
} else {
|
||||
return this.cache[key];
|
||||
}
|
||||
}
|
||||
|
||||
delete(key) {
|
||||
this.log(`DELETE ${key}`);
|
||||
if (key.indexOf('#') !== -1) {
|
||||
key = key.substr(1);
|
||||
if (isSurge || isLoon) {
|
||||
return $persistentStore.write(null, key);
|
||||
}
|
||||
if (isQX) {
|
||||
return $prefs.removeValueForKey(key);
|
||||
}
|
||||
if (isNode) {
|
||||
delete this.root[key];
|
||||
}
|
||||
} else {
|
||||
delete this.cache[key];
|
||||
}
|
||||
this.persistCache();
|
||||
}
|
||||
|
||||
// notification
|
||||
notify(title, subtitle = '', content = '', options = {}) {
|
||||
const openURL = options['open-url'];
|
||||
const mediaURL = options['media-url'];
|
||||
|
||||
if (isQX) $notify(title, subtitle, content, options);
|
||||
if (isSurge) {
|
||||
$notification.post(
|
||||
title,
|
||||
subtitle,
|
||||
content + `${mediaURL ? '\n多媒体:' + mediaURL : ''}`,
|
||||
{
|
||||
url: openURL,
|
||||
}
|
||||
);
|
||||
}
|
||||
if (isLoon) {
|
||||
let opts = {};
|
||||
if (openURL) opts['openUrl'] = openURL;
|
||||
if (mediaURL) opts['mediaUrl'] = mediaURL;
|
||||
if (JSON.stringify(opts) == '{}') {
|
||||
$notification.post(title, subtitle, content);
|
||||
} else {
|
||||
$notification.post(title, subtitle, content, opts);
|
||||
}
|
||||
}
|
||||
if (isNode || isScriptable) {
|
||||
const content_ =
|
||||
content +
|
||||
(openURL ? `\n点击跳转: ${openURL}` : '') +
|
||||
(mediaURL ? `\n多媒体: ${mediaURL}` : '');
|
||||
if (isJSBox) {
|
||||
const push = require('push');
|
||||
push.schedule({
|
||||
title: title,
|
||||
body: (subtitle ? subtitle + '\n' : '') + content_,
|
||||
});
|
||||
} else {
|
||||
console.log(`${title}\n${subtitle}\n${content_}\n\n`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// other helper functions
|
||||
log(msg) {
|
||||
if (this.debug) console.log(msg);
|
||||
}
|
||||
|
||||
info(msg) {
|
||||
console.log(msg);
|
||||
}
|
||||
|
||||
error(msg) {
|
||||
console.log('ERROR: ' + msg);
|
||||
}
|
||||
|
||||
wait(millisec) {
|
||||
return new Promise((resolve) => setTimeout(resolve, millisec));
|
||||
}
|
||||
|
||||
done(value = {}) {
|
||||
if (isQX || isLoon || isSurge) {
|
||||
$done(value);
|
||||
} else if (isNode && !isJSBox) {
|
||||
if (typeof $context !== 'undefined') {
|
||||
$context.headers = value.headers;
|
||||
$context.statusCode = value.statusCode;
|
||||
$context.body = value.body;
|
||||
}
|
||||
}
|
||||
}
|
||||
})(name, debug);
|
||||
}
|
||||
4
Scripts/qinglong/readme.md
Normal file
4
Scripts/qinglong/readme.md
Normal file
@ -0,0 +1,4 @@
|
||||
|
||||
## 青龙脚本
|
||||
|
||||
|
||||
2313
Scripts/qinglong/sendNotify.js
Normal file
2313
Scripts/qinglong/sendNotify.js
Normal file
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user