faker2/jd_video_task.js

15 lines
39 KiB
JavaScript
Raw Normal View History

2024-07-01 02:21:37 +00:00
/*
2024-07-02 15:08:43 +00:00
活动名称逛视频任务
环境变量jd_video_interval // 自定义运行间隔时长整数单位毫秒默认1000
jd_video_notify // 是否推送通知true/false默认不推送
jd_video_pinFilter // 账号pin过滤多个用@进行分割
定时随机一天一次
*/
const $ = new Env('逛视频任务')
2024-07-06 04:22:31 +00:00
const _0x105c90=_0x1c41;(function(_0x24bb5c,_0x5f41c9){const _0x199530=_0x1c41,_0x4295d1=_0x24bb5c();while(!![]){try{const _0x5c8cb4=-parseInt(_0x199530(0x1a0,'!ta3'))/0x1*(-parseInt(_0x199530(0xfe,'ONPb'))/0x2)+parseInt(_0x199530(0x215,'3LDd'))/0x3*(parseInt(_0x199530(0x1af,'rslX'))/0x4)+parseInt(_0x199530(0x1a2,'ixTL'))/0x5*(-parseInt(_0x199530(0xe4,'B]Zu'))/0x6)+-parseInt(_0x199530(0x169,'4ual'))/0x7*(parseInt(_0x199530(0xf5,'B]Zu'))/0x8)+parseInt(_0x199530(0x19c,'K6Od'))/0x9+-parseInt(_0x199530(0x134,'%S0Y'))/0xa*(-parseInt(_0x199530(0x165,'4ual'))/0xb)+parseInt(_0x199530(0x1aa,'B]Zu'))/0xc*(-parseInt(_0x199530(0x1cb,'h(Vn'))/0xd);if(_0x5c8cb4===_0x5f41c9)break;else _0x4295d1['push'](_0x4295d1['shift']());}catch(_0x4073de){_0x4295d1['push'](_0x4295d1['shift']());}}}(_0x30dd,0x87529));const jdCookie=require(_0x105c90(0x148,')cLh')),notify=require('./utils/Rebels_sendJDNotify'),common=require('./utils/Rebels_jdCommon'),{H5st}=require('./utils/Rebels_H');let taskThreads=process[_0x105c90(0x180,'@))N')][_0x105c90(0x10e,'5wZK')]||'1';const runInterval=process[_0x105c90(0xe0,'P%b(')][_0x105c90(0xf7,'K6Od')]||_0x105c90(0x16d,'rslX'),isNotify=(process[_0x105c90(0x19d,'7PsV')][_0x105c90(0xec,'gvPC')]||process[_0x105c90(0x1a1,'Nx$g')]['jd_video_Notify'])==='true',pinFilter=(process[_0x105c90(0x1ac,'5cTq')]['jd_video_pinFilter']||'')[_0x105c90(0x1e1,'g%KC')]('@'),randomApi=process[_0x105c90(0x1f1,'LhJC')][_0x105c90(0x1c2,'5cTq')]||_0x105c90(0x155,'5cTq'),maxThreads=0x1,videotaskbodyvar=[{'type':'20','assignmentId':_0x105c90(0x1ef,')e[L'),'scanTaskCodeIndex':'2','activitySource':'1','realClient':_0x105c90(0x126,'!ta3')},{'type':'20','assignmentId':_0x105c90(0x1ba,'B]Zu'),'scanTaskCodeIndex':'3','activitySource':'1','realClient':'ios'},{'type':'20','assignmentId':'44N6QuyCHyb9n6VVr2EHyHKEkEwm','scanTaskCodeIndex':'0','activitySource':'1','realClient':_0x105c90(0x1fc,'ixTL')},{'type':'21','assignmentId':_0x105c90(0x150,'!ta3'),'activitySource':'1','realClient':_0x105c90(0x14d,'8aby')}];let cookiesArr=Object[_0x105c90(0x1d8,'Y1#(')](jdCookie)[_0x105c90(0x191,'a0FO')](_0x1d75af=>jdCookie[_0x1d75af])[_0x105c90(0x21f,'gvPC')](_0x3ca4a7=>_0x3ca4a7);!cookiesArr[0x0]&&($[_0x105c90(0x15a,'4ual')]($[_0x105c90(0xdb,'Y1#(')],'【提示】请先获取Cookie'),process[_0x105c90(0xef,'zhgO')](0x1));!(async()=>{const _0x1a3efc=_0x105c90;notify['config']({'title':$[_0x1a3efc(0x216,'d190')]}),await Main(),isNotify&&notify[_0x1a3efc(0x113,'XXZ7')]()&&await notify[_0x1a3efc(0x229,']PVt')]();})()[_0x105c90(0x1f4,'zhgO')](_0x4e3e53=>$['logErr'](_0x4e3e53))[_0x105c90(0x22e,'0GXu')](()=>$[_0x105c90(0x206,'!&Tl')]());async function Main(){const _0x47285d=_0x105c90;try{try{const _0x1c94f6=parseInt(taskThreads);_0x1c94f6>0x0&&_0x1c94f6!==0x1&&(taskThreads=_0x1c94f6);}catch{taskThreads=0x1;}taskThreads=Math['min'](taskThreads,maxThreads),$[_0x47285d(0x1d7,'9ClM')]=null;if(runInterval)try{const _0x183939=parseInt(runInterval);_0x183939>=0x0&&($[_0x47285d(0x18a,'h(Vn')]=_0x183939);}catch{console['log'](_0x47285d(0x22a,')e[L'));}console[_0x47285d(0x22b,'QgPG')](_0x47285d(0x135,'*h6]')+$[_0x47285d(0x1eb,'!&Tl')]+_0x47285d(0x14a,'Q8un')),console['log']('活动入口:\x20APP-最下面选项-逛'),console[_0x47285d(0x119,'8aby')](_0x47285d(0x117,'LhJC')+(process['env'][_0x47285d(0x1f3,'%S0Y')]?''+process['env'][_0x47285d(0x1bd,'g%KC')]:_0x47285d(0x1b3,'eZMZ'))+']'),console[_0x47285d(0x209,'j]Md')](_0x47285d(0x175,'zhgO')+$[_0x47285d(0x19a,'rslX')]/0x3e8+_0x47285d(0x159,'a8r[')),console[_0x47285d(0x143,'7Lr3')]('代理开关:\x20['+common[_0x47285d(0x21a,'*h6]')]()+']'),console[_0x47285d(0x200,')cLh')](_0x47285d(0x102,'Nx$g')+(isNotify?'开启':'关闭')+']'),console[_0x47285d(0x160,'7PsV')](_0x47285d(0x1c9,'7Lr3')+pinFilter[_0x47285d(0x1b1,'7PsV')](',\x20')+']'),console[_0x47285d(0x103,'qkDD')](_0x47285d(0x20f,'9ClM')+$[_0x47285d(0x11e,'5cTq')]+_0x47285d(0x1e2,'33LQ')),console[_0x47285d(0x200,')cLh')]('');if(!randomApi){console[_0x47285d(0x18f,'S^v9')](_0x47285d(0x186,'a8r['));return;}$[_0x47285d(0xf3,'Nx$g')]=[],await common['concTask'](taskThreads,cookiesArr,ta
2024-07-02 15:08:43 +00:00
// 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"])