|
|
|
@ -19,10 +19,102 @@ const cheerio = { |
|
|
|
|
})[0]; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// import cheerio from "https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/libs/cheerio.min.js";
|
|
|
|
|
// import "https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/libs/crypto-js.js";
|
|
|
|
|
// import 模板 from"https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/js/模板.js";
|
|
|
|
|
// import {gbkTool} from 'https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/libs/gbk.js'
|
|
|
|
|
|
|
|
|
|
const isCloseLog = !getItem("useLog", ""); |
|
|
|
|
const localKey = "drpy"; |
|
|
|
|
const CryptoUtil = $.require("hiker://assets/crypto-java.js"); |
|
|
|
|
const local = { |
|
|
|
|
"set": function (rulekey, k, v) { |
|
|
|
|
storage0.setItem(localKey + "@" + rulekey + "@" + k, v); |
|
|
|
|
}, |
|
|
|
|
"get": function (rulekey, k, v) { |
|
|
|
|
return storage0.getItem(localKey + "@" + rulekey + "@" + k, "") || v; |
|
|
|
|
}, |
|
|
|
|
"delete": function (rulekey, k) { |
|
|
|
|
storage0.clearItem(localKey + "@" + rulekey + "@" + k); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
eval(getCryptoJS()); |
|
|
|
|
const CryptoJS = CryptoJS; |
|
|
|
|
|
|
|
|
|
let $request = request; |
|
|
|
|
let $post = post; |
|
|
|
|
const req = function (url, cobj) { |
|
|
|
|
try { |
|
|
|
|
let res = {}; |
|
|
|
|
let obj = Object.assign({}, cobj); |
|
|
|
|
if (obj.data) { |
|
|
|
|
obj.body = obj.data; |
|
|
|
|
delete obj.data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (obj.hasOwnProperty("redirect")) obj.redirect = !!obj.redirect; |
|
|
|
|
if (obj.buffer === 2) { |
|
|
|
|
obj.toHex = true; |
|
|
|
|
} |
|
|
|
|
obj.headers = Object.assign({ |
|
|
|
|
Cookie: "#noCookie#" |
|
|
|
|
}, obj.headers); |
|
|
|
|
if (url === "https://api.nn.ci/ocr/b64/text" && obj.headers) { |
|
|
|
|
obj.headers["Content-Type"] = "text/plain"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (url.startsWith("file://") && (url.includes("?type=") || url.includes("?params="))) { |
|
|
|
|
url = url.slice(0, url.lastIndexOf("?")); |
|
|
|
|
} |
|
|
|
|
for (let key in obj.headers) { |
|
|
|
|
if (typeof obj.headers[key] !== "string") { |
|
|
|
|
obj.headers[key] = String(obj.headers[key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let r = ""; |
|
|
|
|
/* if (String(obj.method).toLowerCase() === "post") { |
|
|
|
|
r = $post(url, obj); |
|
|
|
|
} else { |
|
|
|
|
r = $request(url, obj); |
|
|
|
|
}*/ |
|
|
|
|
r = $request(url, obj); |
|
|
|
|
if (obj.withHeaders) { |
|
|
|
|
r = JSON.parse(r); |
|
|
|
|
res.content = r.body; |
|
|
|
|
res.headers = {}; |
|
|
|
|
for (let [k, v] of Object.entries(r.headers || {})) { |
|
|
|
|
res.headers[k] = v[0]; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
res.content = r; |
|
|
|
|
} |
|
|
|
|
if (obj.buffer === 2) { |
|
|
|
|
res.content = CryptoUtil.Data.parseHex(res.content).toBase64(_base64.NO_WRAP); |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|
} catch (e) { |
|
|
|
|
log("Error" + e.toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String.prototype.replaceAll = function (search, replacement) { |
|
|
|
|
return this.split(search).join(replacement); |
|
|
|
|
}; |
|
|
|
|
let $toString = Function.prototype.toString; |
|
|
|
|
Function.prototype.toString = function () { |
|
|
|
|
return $toString.apply(this).trim(); |
|
|
|
|
}; |
|
|
|
|
/* |
|
|
|
|
if (isCloseLog) { |
|
|
|
|
// 重写console.log函数
|
|
|
|
|
console.log = function () { |
|
|
|
|
// 检查传入参数的数量
|
|
|
|
|
if (arguments.length > 1) { |
|
|
|
|
// 如果参数数量大于1,调用原始的console.log函数
|
|
|
|
|
//originalLog.apply(console, arguments);
|
|
|
|
|
} else { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 如果参数只有一个,则不做任何操作
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
function init_test() { |
|
|
|
|
// console.log(typeof(CryptoJS));
|
|
|
|
@ -3500,101 +3592,6 @@ function isVideo(url) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isCloseLog = !getItem("useLog", ""); |
|
|
|
|
const localKey = "drpy"; |
|
|
|
|
const CryptoUtil = $.require("hiker://assets/crypto-java.js"); |
|
|
|
|
const local = { |
|
|
|
|
"set": function (rulekey, k, v) { |
|
|
|
|
storage0.setItem(localKey + "@" + rulekey + "@" + k, v); |
|
|
|
|
}, |
|
|
|
|
"get": function (rulekey, k, v) { |
|
|
|
|
return storage0.getItem(localKey + "@" + rulekey + "@" + k, "") || v; |
|
|
|
|
}, |
|
|
|
|
"delete": function (rulekey, k) { |
|
|
|
|
storage0.clearItem(localKey + "@" + rulekey + "@" + k); |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
eval(getCryptoJS()); |
|
|
|
|
const CryptoJS = CryptoJS; |
|
|
|
|
|
|
|
|
|
let $request = request; |
|
|
|
|
let $post = post; |
|
|
|
|
const req = function (url, cobj) { |
|
|
|
|
try { |
|
|
|
|
let res = {}; |
|
|
|
|
let obj = Object.assign({}, cobj); |
|
|
|
|
if (obj.data) { |
|
|
|
|
obj.body = obj.data; |
|
|
|
|
delete obj.data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (obj.hasOwnProperty("redirect")) obj.redirect = !!obj.redirect; |
|
|
|
|
if (obj.buffer === 2) { |
|
|
|
|
obj.toHex = true; |
|
|
|
|
} |
|
|
|
|
obj.headers = Object.assign({ |
|
|
|
|
Cookie: "#noCookie#" |
|
|
|
|
}, obj.headers); |
|
|
|
|
if (url === "https://api.nn.ci/ocr/b64/text" && obj.headers) { |
|
|
|
|
obj.headers["Content-Type"] = "text/plain"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (url.startsWith("file://") && (url.includes("?type=") || url.includes("?params="))) { |
|
|
|
|
url = url.slice(0, url.lastIndexOf("?")); |
|
|
|
|
} |
|
|
|
|
for (let key in obj.headers) { |
|
|
|
|
if (typeof obj.headers[key] !== "string") { |
|
|
|
|
obj.headers[key] = String(obj.headers[key]); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let r = ""; |
|
|
|
|
/* if (String(obj.method).toLowerCase() === "post") { |
|
|
|
|
r = $post(url, obj); |
|
|
|
|
} else { |
|
|
|
|
r = $request(url, obj); |
|
|
|
|
}*/ |
|
|
|
|
r = $request(url, obj); |
|
|
|
|
if (obj.withHeaders) { |
|
|
|
|
r = JSON.parse(r); |
|
|
|
|
res.content = r.body; |
|
|
|
|
res.headers = {}; |
|
|
|
|
for (let [k, v] of Object.entries(r.headers || {})) { |
|
|
|
|
res.headers[k] = v[0]; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
res.content = r; |
|
|
|
|
} |
|
|
|
|
if (obj.buffer === 2) { |
|
|
|
|
res.content = CryptoUtil.Data.parseHex(res.content).toBase64(_base64.NO_WRAP); |
|
|
|
|
} |
|
|
|
|
return res; |
|
|
|
|
} catch (e) { |
|
|
|
|
log("Error" + e.toString()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String.prototype.replaceAll = function (search, replacement) { |
|
|
|
|
return this.split(search).join(replacement); |
|
|
|
|
}; |
|
|
|
|
let $toString = Function.prototype.toString; |
|
|
|
|
Function.prototype.toString = function () { |
|
|
|
|
return $toString.apply(this).trim(); |
|
|
|
|
}; |
|
|
|
|
/* |
|
|
|
|
if (isCloseLog) { |
|
|
|
|
// 重写console.log函数
|
|
|
|
|
console.log = function () { |
|
|
|
|
// 检查传入参数的数量
|
|
|
|
|
if (arguments.length > 1) { |
|
|
|
|
// 如果参数数量大于1,调用原始的console.log函数
|
|
|
|
|
//originalLog.apply(console, arguments);
|
|
|
|
|
} else { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// 如果参数只有一个,则不做任何操作
|
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取规则 |
|
|
|
|