jdpro/jd_unsubscribe.js

382 lines
94 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
2024-07-14 06:36:59 +00:00
2 2 29 2 * jd_unsubscribe.js
2024-06-28 07:47:44 +00:00
*/
const $ = new Env('批量取关店铺和商品');
2024-07-15 01:21:43 +00:00
var _0xod5='jsjiami.com.v7';const _0x93bb63=_0x48d3;(function(_0x4c245c,_0x157165,_0x3eabb6,_0x1f2c1d,_0x42c791,_0x4a8757,_0x2f0920){return _0x4c245c=_0x4c245c>>0x7,_0x4a8757='hs',_0x2f0920='hs',function(_0x236ebd,_0x5540bb,_0x2d8ace,_0x11be04,_0x56f2b8){const _0x5de788=_0x48d3;_0x11be04='tfi',_0x4a8757=_0x11be04+_0x4a8757,_0x56f2b8='up',_0x2f0920+=_0x56f2b8,_0x4a8757=_0x2d8ace(_0x4a8757),_0x2f0920=_0x2d8ace(_0x2f0920),_0x2d8ace=0x0;const _0x91d41b=_0x236ebd();while(!![]&&--_0x1f2c1d+_0x5540bb){try{_0x11be04=-parseInt(_0x5de788(0x3d8,')SSN'))/0x1+parseInt(_0x5de788(0x29f,'^u!C'))/0x2+-parseInt(_0x5de788(0x4de,'fL))'))/0x3*(-parseInt(_0x5de788(0x42d,'%uw7'))/0x4)+parseInt(_0x5de788(0x44f,'2Lde'))/0x5*(parseInt(_0x5de788(0x1e6,'oboK'))/0x6)+-parseInt(_0x5de788(0x579,'0sJt'))/0x7*(parseInt(_0x5de788(0x343,'VVvX'))/0x8)+-parseInt(_0x5de788(0x36b,'hHBZ'))/0x9*(parseInt(_0x5de788(0x488,'ElGY'))/0xa)+-parseInt(_0x5de788(0x4fa,'@U8z'))/0xb*(-parseInt(_0x5de788(0x26a,'hHBZ'))/0xc);}catch(_0x406d56){_0x11be04=_0x2d8ace;}finally{_0x56f2b8=_0x91d41b[_0x4a8757]();if(_0x4c245c<=_0x1f2c1d)_0x2d8ace?_0x42c791?_0x11be04=_0x56f2b8:_0x42c791=_0x56f2b8:_0x2d8ace=_0x56f2b8;else{if(_0x2d8ace==_0x42c791['replace'](/[QOHRuhAFbPMDXKlILq=]/g,'')){if(_0x11be04===_0x5540bb){_0x91d41b['un'+_0x4a8757](_0x56f2b8);break;}_0x91d41b[_0x2f0920](_0x56f2b8);}}}}}(_0x3eabb6,_0x157165,function(_0x1e822f,_0x5a9b9b,_0xca6986,_0x3b7dd5,_0x3d2bec,_0x2a6cf6,_0x23308a){return _0x5a9b9b='\x73\x70\x6c\x69\x74',_0x1e822f=arguments[0x0],_0x1e822f=_0x1e822f[_0x5a9b9b](''),_0xca6986=`\x72\x65\x76\x65\x72\x73\x65`,_0x1e822f=_0x1e822f[_0xca6986]('\x76'),_0x3b7dd5=`\x6a\x6f\x69\x6e`,(0x178a7f,_0x1e822f[_0x3b7dd5](''));});}(0x6100,0xb8adb,_0x2cd1,0xc4),_0x2cd1)&&(_0xod5=_0x2cd1);function _0x2cd1(){const _0x4bed37=(function(){return[...[_0xod5,'qXqDjsbjhuiQaPmiFO.bcHoKhmIM.MDOvA7bORlL==','fsiqzaKxW7fIW6K','W4OoWPCPW48','5BE75OQS5yIa5y+A5RAq5yEd5Roa5BI16zoZ77Y0','zSkHW6y+bSkzySopuIRdSLzTpSk2aSof','W5BcRuG0WP0','dKRdTmkKlmkdaSk4hW','AhRcK8ofoHa','W6JcN8kYWPP6','E20IW64','ymkCW7ugoa','WRSobe0UW5pLTzBLPk/ML7pcOc/dTW','6i6a5yYM5BsF5ysi5RcQ5BI16zgf5Aso6lw+776R','DXeJWOfw','oKldJ8kvbW','WRVdGdJcMt4','5Ps/5zwi5zgy6z+L6kAy5y6g5yEhWQm','W4/cOL4IWOa','WRBdHCktW7nNqSk8rhNdQCkRDSknW5Goxd/dULTBzmk9W48Uk8ooWOj0WRr/W7hdSCo1fSkNoKG','WRuQWQukaa','5B+G5yUq5BEQ5yAK5RkH5zAP5zoq77YK','W7JcGKiEWRi','h8oZtLS+WOLUW54','WPVcQdO1WQhLVPxLP6JJGk3KUypKUllOT5VLJjm','qmo2W5LFCW','WRyHWQK9nWm','tqXTqdKBcsxdV8kbW7hcQhtcJw3cIvdcLLW','r8kcWOxdM8o6WRaNySkJe8k/W6y','F8kaWQCsWQC','44kJ5lIX5lIe6lEX5y6+','WQ/dQxqqW57dOCouBSkFqK1opCkqb8k2W7q2','5Q6c5z6u6iY55y6T5BAn5yEF5Rkd55U05BIo6zgJtYFcVW','fCowzKet','WRZdPMHIEa','cCoLW5BcJSkH','gmktWOtcTCkmmSkZW6u/W6RcPmk8W7WSWPaP','z8kjWR/cVmoJW44nW4bOW6O','WOHGW4u','fmouW5xcP8kg','tWfTxdm','mmk0hmo2','WRLNW7xcKxWI','WRTWgG','eH4J','W7/dO316','i8oBW7/cI8ky','nHq4WPVdJSkqsSkCWRK','WQ8npCoZWPDed8oUo1VdNSoF','FmkEWRpcOSk6W6moW44','bs42WQNdNW','WPNdKeDkDa','WPnCFSkIkcbI','5lM45OM36kgd5y6/5RwH5PEm6jAS5BQZ6zomW7i','WP/dRurSzSkpWQtcUCkRbSocW6GI','gJBcJuJdPLOL','xxpcSSovbW','jrtcLK7dQq','tNGkW6W8','WQ9QoJddRW','m8kBvSkOWPm','zre3WQTV','twaaW701','bKOclHC','kmopW5zTmG','hwr7gCkAW4bmc1VcGCk5WPWUrZ8TBmosWR/dRq','dMVdVmk+hW','qr5RuGG','qCojWOtcKCo/W71ynCkSrSkfWPddTSkEW7RcHSo6ofJcHcbd','gHxcKeFdVq','WRtdIGNcUW','adClyqKfW7u','jG0pWRtdOW','WQ9VW6VcLNW','q3S+W5uT','6k6c5yUV6zQa5OwM5z+bWRGmxhZcI+I8HowgLoAHHUs/G+AvOUwgHUwUTSk35BIO6k2S6yk86lYW6iwS5P6E5y6X6iYs5y6KwCoVW7XDWR0M','ASkLW709aq','W6xcVmk2WRGl','W4rMoG','W5ZcP34GWQG','44kf5lIX5lUP6lEE5y2b','amoDW5pcNCkbW6u','WPddQ8ojlri','WR8obei0W73dGwFdRmoVCmkZWQq','hSo4zfq8','nfLr','5lQj5lMK5PYu5yQr5zII6l+15zU456MW5PEI5O6w','W7SYWRGQW6Xv','sI09WQ5xW5LSbIhcK8kBW4W1hLHVWQxcPW','xmkIW5eOna','WPxdOJNcNZq','W5NdK1PtW48','ACkWW6yQfmoaCW','aSkBxSkRWQOeWOdcHLDWWQLxWPm','dmkTWOPuWOBcQComiSonW5PCW74','puCExmk6','fviaosC','WRepd0m/W7NdGG','imoZW6TTcKerWPO','W6BdTCkAWOJdHtXmW5/dTrSgq8oQ','W6ZdJ3RcPIW','WRNdLmktW6D1dmoY','WRxdRSouhsS','5Q2N5zY35OQA6koU5OI36yA35y2N5REj5yAe5Rk95BUY6zcrW5ChDq','wSkhW5RdTCkdtSkQWQquWRpcQSoRW7nxWPL9WO9NACohW5FdQG','W7JdRhnZW77dSuzo','
2024-06-28 07:47:44 +00:00
function Env(t, e){
"undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0);
class s{
constructor(t){
this.env = t
}
send(t, e = "GET"){
t = "string" == typeof t ? {
url: t
} : t;
let s = this.get;
return "POST" === e && (s = this.post), new Promise((e, i) => {
s.call(this, t, (t, s, r) => {
t ? i(t) : e(s)
})
})
}
get(t){
return this.send.call(this.env, t)
}
post(t){
return this.send.call(this.env, t, "POST")
}
}
return new class{
constructor(t, e){
this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`)
}
isNode(){
return "undefined" != typeof module && !!module.exports
}
isQuanX(){
return "undefined" != typeof $task
}
isSurge(){
return "undefined" != typeof $httpClient && "undefined" == typeof $loon
}
isLoon(){
return "undefined" != typeof $loon
}
toObj(t, e = null){
try{
return JSON.parse(t)
} catch{
return e
}
}
toStr(t, e = null){
try{
return JSON.stringify(t)
} catch{
return e
}
}
getjson(t, e){
let s = e;
const i = this.getdata(t);
if(i) try{
s = JSON.parse(this.getdata(t))
} catch{}
return s
}
setjson(t, e){
try{
return this.setdata(JSON.stringify(t), e)
} catch{
return !1
}
}
getScript(t){
return new Promise(e => {
this.get({
url: t
}, (t, s, i) => e(i))
})
}
runScript(t, e){
return new Promise(s => {
let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
i = i ? i.replace(/\n/g, "").trim() : i;
let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r;
const [o, h] = i.split("@"), n = {
url: `http://${h}/v1/scripting/evaluate`,
body: {
script_text: t,
mock_type: "cron",
timeout: r
},
headers: {
"X-Key": o,
Accept: "*/*"
}
};
this.post(n, (t, e, i) => s(i))
}).catch(t => this.logErr(t))
}
loaddata(){
if(!this.isNode()) return {};
{
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile),
e = this.path.resolve(process.cwd(), this.dataFile),
s = this.fs.existsSync(t),
i = !s && this.fs.existsSync(e);
if(!s && !i) return {};
{
const i = s ? t : e;
try{
return JSON.parse(this.fs.readFileSync(i))
} catch(t){
return {}
}
}
}
}
writedata(){
if(this.isNode()){
this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
const t = this.path.resolve(this.dataFile),
e = this.path.resolve(process.cwd(), this.dataFile),
s = this.fs.existsSync(t),
i = !s && this.fs.existsSync(e),
r = JSON.stringify(this.data);
s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)
}
}
lodash_get(t, e, s){
const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
let r = t;
for(const t of i)
if(r = Object(r)[t], void 0 === r) return s;
return r
}
lodash_set(t, e, s){
return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)
}
getdata(t){
let e = this.getval(t);
if(/^@/.test(t)){
const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : "";
if(r) try{
const t = JSON.parse(r);
e = t ? this.lodash_get(t, i, "") : e
} catch(t){
e = ""
}
}
return e
}
setdata(t, e){
let s = !1;
if(/^@/.test(e)){
const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i),
h = i ? "null" === o ? null : o || "{}" : "{}";
try{
const e = JSON.parse(h);
this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i)
} catch(e){
const o = {};
this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i)
}
} else s = this.setval(t, e);
return s
}
getval(t){
return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
}
setval(t, e){
return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null
}
initGotEnv(t){
this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
}
get(t, e = (() => {})){
t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
"X-Surge-Skip-Scripting": !1
})), $httpClient.get(t, (t, s, i) => {
!t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
})) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
hints: !1
})), $task.fetch(t).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {
try{
if(t.headers["set-cookie"]){
const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar
}
} catch(t){
this.logErr(t)
}
}).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => {
const {
message: s,
response: i
} = t;
e(s, i, i && i.body)
}))
}
post(t, e = (() => {})){
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.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
"X-Surge-Skip-Scripting": !1
})), $httpClient.post(t, (t, s, i) => {
!t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
});
else if(this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
hints: !1
})), $task.fetch(t).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => e(t));
else if(this.isNode()){
this.initGotEnv(t);
const {
url: s,
...i
} = t;
this.got.post(s, i).then(t => {
const {
statusCode: s,
statusCode: i,
headers: r,
body: o
} = t;
e(null, {
status: s,
statusCode: i,
headers: r,
body: o
}, o)
}, t => {
const {
message: s,
response: i
} = t;
e(s, i, i && i.body)
})
}
}
time(t, e = null){
const s = e ? new Date(e) : new Date;
let i = {
"M+": s.getMonth() + 1,
"d+": s.getDate(),
"H+": s.getHours(),
"m+": s.getMinutes(),
"s+": s.getSeconds(),
"q+": Math.floor((s.getMonth() + 3) / 3),
S: s.getMilliseconds()
};
/(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length)));
for(let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length)));
return t
}
msg(e = t, s = "", i = "", r){
const o = t => {
if(!t) return t;
if("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {
"open-url": t
} : this.isSurge() ? {
url: t
} : void 0;
if("object" == typeof t){
if(this.isLoon()){
let e = t.openUrl || t.url || t["open-url"],
s = t.mediaUrl || t["media-url"];
return {
openUrl: e,
mediaUrl: s
}
}
if(this.isQuanX()){
let e = t["open-url"] || t.url || t.openUrl,
s = t["media-url"] || t.mediaUrl;
return {
"open-url": e,
"media-url": s
}
}
if(this.isSurge()){
let e = t.url || t.openUrl || t["open-url"];
return {
url: e
}
}
}
};
if(this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog){
let t = ["", "==============📣系统通知📣=============="];
t.push(e), s && t.push(s), 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, e){
const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t)
}
wait(t){
return new Promise(e => setTimeout(e, t))
}
done(t = {}){
const e = (new Date).getTime(),
s = (e - this.startTime) / 1e3;
this.log("", `🔔${this.name}, 结束! 🕛 ${s}`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
}
}(t, e)
}