faker3/jd_tower_collect.js

16 lines
80 KiB
JavaScript
Raw Permalink Normal View History

2024-12-24 13:00:59 +08:00
/*
活动名称先人一步
环境变量jd_tower_collect_interval // 自定义运行间隔时长整数单位毫秒默认1000
jd_tower_collect_notify // 是否推送通知true/false默认不推送
jd_tower_collect_pinFilter // 账号pin过滤多个用@进行分割
cron:59 23 29 2 *
*/
const $ = new Env('先人一步')
function N99wd2(){}var n5gReT=Object['defineProperty'],WzvCPFO,XALd21,aTpdFsJ,HEqiDY7,xz60Ife,v9bAchj,NDfawu,Xpq39H,CAWuEOD,HVQ86q,fkS6wo,PHX0Zi,VYKZaCV,MPlwuO,L1eV4e;function Cy0lMU(N99wd2){return WzvCPFO[N99wd2<-0x49?N99wd2-0x63:N99wd2<0x6?N99wd2+0x48:N99wd2-0x37]}N99wd2(WzvCPFO=yXMwLMX(),XALd21=kOJquAJ((N99wd2,n5gReT)=>{return n5gReT(N99wd2())},0x2)(g_Lydx,anP1usG));var Ojd8WK6=[],VNyLMq6=[ONRejl7(0x0),'\u0059\u0034\u0048\u005f\u0042\u006f\u0058\u005d','\x2c\x52\x4f\x2f\x24\x31\x70\x22',ONRejl7(Cy0lMU(-0x39)),ONRejl7(0x2),'\u005d\u0067\u0037\u004d\u0037\u0058\u0026\u0075\u002c\u004e\u0026\u0064\u007b\u0064\u002c\u005d\u0043\u007a\u0026\u0062\u007a\u0077\u003e\u0050\u006d\u0024\u002f\u006d\u004a\u0064\u005e',ONRejl7(0x3),ONRejl7(0x4),']g7M7X&u,N&d{d,]Cz&bE2+PdxW@B',ONRejl7(0x5),']g7M7X&u,N&d{d,]Cz&bF.}!7lZorQVR','\u003f\u0033\u005b\u0054\u002e\u0021\u0041','|q$X<','\x42\x6a\x40\x7a','\x52\x4a\x79\x7a\x54\x4f\x33\x46','\u004b\u0065\u004d\u007a',ONRejl7(Cy0lMU(-0x40)),'\x61\x46\x4e\x6c\x73\x2c\x30\x5a\x31\x3c\x69\x43\x39\x73\x4f\x21\x6c\x34\x23\x5a\x31\x25\x40\x39\x3f\x62\x54\x7c\x72\x52\x2c\x76\x71\x54\x2a\x63\x3f','\x6c\x26\x50\x7a\x4c','\x74\x6c\x70\x45\x24\x21\x51\x38\x4a\x4d\x75\x6b\x54\x22\x22\x59\x34\x74\x48\x6d\x22\x39\x4b\x30\x4a\x56\x34\x4b\x72\x64\x73\x76\x64\x67\x65\x4f\x75\x58\x36\x46',ONRejl7(0x7),'~~AIY@.$/;5o;]>R8MG/k*`h*_G',ONRejl7(0x8),'J~Ne,wPF','\u004e\u0054\u0069\u007e\u0040\u002a\u003e','Fj,T?','K^]GM*OIjhSW2','\u0065\u0069\u0047\u002f\u0046\u0033\u0043\u0046',ONRejl7(0x9),'\u007b\u005b\u0026\u0062\u0074\u0055\u0041',ONRejl7(Cy0lMU(-0x32)),ONRejl7(0xb),ONRejl7(Cy0lMU(-0x3d)),'\u0066\u004a\u005f\u007a',ONRejl7(Cy0lMU(-0x35)),'\x37\x7e\x4d\x7a','\x6c\x29\x45\x6e\x70\x55\x7c\x4b\x72\x52\x79\x74\x22\x70\x76\x79\x48\x3a\x4e\x67\x62\x69\x34\x2f\x5f\x4a\x3d\x6b\x77\x30\x7d\x21\x43\x23\x6a\x7e\x4e\x35\x40\x39\x79\x58\x68\x28\x3e\x78\x49\x47\x24\x50\x3a\x7b\x7e','\x37\x7e\x4d\x7a','\u0046\u006a\u002c\u0054\u003f','\x49\x7e\x3f\x65\x22',ONRejl7(0xe),'\u004a\u007e\u0056\u0062\u0063\u004b\u0042\u003b\u0021\u0078','\u0028\u005b\u005e\u0045\u0036\u0040\u007d\u0021\u007e\u004e\u002f\u0064\u0049\u0073\u004f\u005d\u004c\u007e\u005b',ONRejl7(0xf),'\u0069\u0071\u0056\u0062\u0058\u0021\u004a\u0046',ONRejl7(Cy0lMU(-0x31)),'xqWT|Ot;^o2GB',ONRejl7(0x11),'\u003a\u0025\u0044\u005e\u0038\u007c\u0041','7~Mz','\x75\x3d\x3b\x54\x43\x62\x78\x46',ONRejl7(0x12),'xq&b|Xu_d#acJdJYEB','al7Mnw]F',ONRejl7(0x13),'\u002e\u0030\u003f\u0065\u0040\u0021\u0043\u0047\u004b\u0024\u007b\u0060\u0042',ONRejl7(0x14),ONRejl7(0x15),'\u0064\u0052\u0057\u004d\u002f\u007b\u0075\u0075\u004a\u0056','\u0052\u004a\u002f\u0045',ONRejl7(Cy0lMU(-0x3a)),ONRejl7(0x17),ONRejl7(0x18),ONRejl7(0xe),'\u003c\u003d\u005e\u0045\u004a','xqpE?X{G]_eUJd"YPB',ONRejl7(0x19),'\u0037\u007e\u004d\u007a','\x52\x4a\x2f\x45','\x77\x6b\x6e\x74\x73\x2c\x53\x74\x5f\x4a\x75\x65\x2f\x68\x24',ONRejl7(0xe),ONRejl7(0x1a),ONRejl7(0x1b),'\u0053\u005a\u0046\u0021\u0021\u0031\u004b\u007a\u006c\u0023\u0022\u0077\u005a\u0067\u0022\u002f\u0058\u0030\u003a\u0044\u0066\u0040\u0043\u007d\u0069\u0022\u002b\u0029\u0036\u0041','\x70\x41\x3e\x71\x30','\u0070\u0041\u003e\u0071\u0024\u002b\u004b\u007a\u007a\u0050','\u0067\u0028\u0061\u0052\u005a','\u0074\u004a\u0044\u0071','\u0052\u004a\u002f\u0045',ONRejl7(0x1c),'\u0078\u0071\u0026\u0062\u0064\u007b\u003d\u0075\u002c\u004e\u0024\u006b\u0049\u0053\u0071\u0076',ONRejl7(0x1d),'\x44\x41\x28\x34\x71\x3a\x50\x22\x5e\x39\x35',ONRejl7(0x1e),'\x65\x58\x71\x52\x7a\x4b\x3a',ONRejl7(0x1f),'\u0048\u0065\u0041\u0030\u0042\u004b\u0064\u0053\u0063',Cy0lMU(-0x48),ONRejl7(Cy0lMU(-0x2e)),ONRejl7(0x21),ONRejl7(Cy0lMU(-0x2f)),ONRejl7(0x22),'"~7Md&]_h','\u004d\u006a\u003d\u0062\u007a\u0057\u0024\u002f\u004f\u005f\u0043',ONRejl7(0x23),ONRejl7(0x24),'\u0075\u0047\u006d\u0046\u0071\u0024\u0039\u0075\u0038\u002e\u0038\u002f\u0078\u005e','\x2c\x6a\x50\x7a\x36\x4b\x59\x29\x6d\x6f\x6c','\u007e\u007e\u0075\u0063\u0049\u0038\u0044\u0078\u0043\u0023\u0050\u004e\u0052\u0071\u0029\u005d','\x49\x40\x43\x35\x5f\x74\x21\x4c\x7d','\u0021\u0059\u0021\u0026\u0078\u0024\u0039\u007b\u0058\u00
// prettier-ignore
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"])