jdpro/jd_health_collect.js

9 lines
44 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
东东健康社区收集能量收集能量(不做任务任务脚本请使用jd_health.js)
cron "5-45/20 1-5 * * *" script-path=jd_health_collect.js, tag=东东健康社区收集能量
*/
const $ = new Env("东东健康社区收集能量收集");
const bdy_0x419d78=bdy_0xbcfc;function bdy_0xbcfc(_0x56aebb,_0x445095){const _0x46ff1f=bdy_0x5b67();return bdy_0xbcfc=function(_0x4db5fa,_0x37dfe2){_0x4db5fa=_0x4db5fa-(-0x256a+-0x664+-0xd*-0x36d);let _0x527b4=_0x46ff1f[_0x4db5fa];if(bdy_0xbcfc['SSwBAf']===undefined){var _0x39594c=function(_0x34e5a1){const _0x1ae6a4='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x19452d='',_0x365f5b='',_0x13095b=_0x19452d+_0x39594c;for(let _0xddef27=-0x477*-0x6+-0x1*0x2531+0xa67,_0x4dccfe,_0x25cb12,_0x1dd80b=0xfd7*0x2+-0x2225+0x277;_0x25cb12=_0x34e5a1['charAt'](_0x1dd80b++);~_0x25cb12&&(_0x4dccfe=_0xddef27%(-0x2*-0x1139+-0x17e3+0xa8b*-0x1)?_0x4dccfe*(-0x15c2+0xa8f+0xb73)+_0x25cb12:_0x25cb12,_0xddef27++%(0x3e*0xd+0x65e+-0x980*0x1))?_0x19452d+=_0x13095b['charCodeAt'](_0x1dd80b+(-0x987+-0x17c9+0xb1e*0x3))-(-0x33d*-0x2+0x1*0x1d1e+0x4a*-0x7b)!==-0x25db+-0x49d+0xa9e*0x4?String['fromCharCode'](-0x1b84+-0x1*0x59+0x1cdc&_0x4dccfe>>(-(0x790+0x1*-0x13+-0x5*0x17f)*_0xddef27&0x1*0x22bd+0x1*-0x2359+0xa2)):_0xddef27:-0x127*0x7+0x1*0x1df+-0xd*-0x7a){_0x25cb12=_0x1ae6a4['indexOf'](_0x25cb12);}for(let _0x378414=-0x209*-0x11+0x10a6*-0x1+-0x5*0x397,_0x7aa3bb=_0x19452d['length'];_0x378414<_0x7aa3bb;_0x378414++){_0x365f5b+='%'+('00'+_0x19452d['charCodeAt'](_0x378414)['toString'](0xa54*0x3+-0x1abd+-0x42f))['slice'](-(0x10bf+-0x1fa7+0xeea));}return decodeURIComponent(_0x365f5b);};const _0x1320ed=function(_0x4ca27d,_0x3932a3){let _0x184566=[],_0x1a85f0=-0x79a*0x2+0x55a+0x9da,_0x4a5c07,_0x487aa7='';_0x4ca27d=_0x39594c(_0x4ca27d);let _0x16927c;for(_0x16927c=0x1182+0x7f4+-0x1976;_0x16927c<-0x2*0x12d4+0x656+0x2052;_0x16927c++){_0x184566[_0x16927c]=_0x16927c;}for(_0x16927c=0x12b+-0x2*-0xef+-0x309;_0x16927c<0x4*-0x96b+0x1403+0x12a9;_0x16927c++){_0x1a85f0=(_0x1a85f0+_0x184566[_0x16927c]+_0x3932a3['charCodeAt'](_0x16927c%_0x3932a3['length']))%(-0x2445+-0x7d*0x2c+-0xa9*-0x59),_0x4a5c07=_0x184566[_0x16927c],_0x184566[_0x16927c]=_0x184566[_0x1a85f0],_0x184566[_0x1a85f0]=_0x4a5c07;}_0x16927c=0x1c9*-0x15+-0x11*0x199+0x40a6,_0x1a85f0=0x58*-0x51+0x78a+0x1*0x144e;for(let _0x2cc2e2=-0xe25+0x182*0x1+0xca3;_0x2cc2e2<_0x4ca27d['length'];_0x2cc2e2++){_0x16927c=(_0x16927c+(-0x19c0*0x1+-0x2045+0x84a*0x7))%(0x179c+0x7*0x163+-0x2051),_0x1a85f0=(_0x1a85f0+_0x184566[_0x16927c])%(-0x453*0x8+0x1a2e+0x96a),_0x4a5c07=_0x184566[_0x16927c],_0x184566[_0x16927c]=_0x184566[_0x1a85f0],_0x184566[_0x1a85f0]=_0x4a5c07,_0x487aa7+=String['fromCharCode'](_0x4ca27d['charCodeAt'](_0x2cc2e2)^_0x184566[(_0x184566[_0x16927c]+_0x184566[_0x1a85f0])%(-0x5b0*-0x4+-0x14cb*0x1+-0xf5)]);}return _0x487aa7;};bdy_0xbcfc['IXVqpv']=_0x1320ed,_0x56aebb=arguments,bdy_0xbcfc['SSwBAf']=!![];}const _0x22e037=_0x46ff1f[0x109e+0x25b3+-0x3651],_0x5afecc=_0x4db5fa+_0x22e037,_0x2e3dec=_0x56aebb[_0x5afecc];if(!_0x2e3dec){if(bdy_0xbcfc['FmCbHU']===undefined){const _0x11b8cf=function(_0x433778){this['LRbiBE']=_0x433778,this['utxbPS']=[0x1544+0x822+0x1*-0x1d65,0x2*0xddf+0x1*0x13bd+-0x2f7b,-0x338+0x82f+-0x4f7],this['Vqkwrd']=function(){return'newState';},this['qRmaPn']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['JlBrHK']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x11b8cf['prototype']['RhhWOK']=function(){const _0x460c4e=new RegExp(this['qRmaPn']+this['JlBrHK']),_0xd29a94=_0x460c4e['test'](this['Vqkwrd']['toString']())?--this['utxbPS'][0xf6e*0x2+0x1867+0x1*-0x3742]:--this['utxbPS'][0xfd1+0x2011+-0x2fe2];return this['UVxBlL'](_0xd29a94);},_0x11b8cf['prototype']['UVxBlL']=function(_0x1134e5){if(!Boolean(~_0x1134e5))return _0x1134e5;return this['AyoVKx'](this['LRbiBE']);},_0x11b8cf['prototype']['AyoVKx']=function(_0x33f4f6){for(let _0x182d05=0x7*0x4d5+0x1*0x1d5+0x11d4*-0x2,_0x3446b9=this['utxbPS']['length'];_0x182d05<_0x3446b9;_0x182d05++){this['utxbPS']['push'](Math['round'](Math['random']())),_0x3446b9=this['utxbPS']['length'];}return _0x33f4f6(this['utxbPS'][-0xfb4+-0x1*0x15ce+0x2582*0x1]);},new _0x11b8cf(bdy_0xbcfc)['RhhWOK'](),bdy_0xbcfc['FmCbHU']=!![];}_0x527b4=bdy_0xbcfc['IXVqpv'](_0x527b4,_0x37dfe2),_0x56aebb[_0x5afecc]=_0x527b4;}else _0x527b4=_0x2e3dec;return _0x527b4;},bdy_0xbcfc(_0x56aebb,_0x445095);}(
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"])