jdpro/jd_liveLottery.js

23 lines
40 KiB
JavaScript
Raw Normal View History

2024-06-28 07:47:44 +00:00
/*
活动名称京东直播互动抽奖
活动链接https://h5.m.jd.com/dev/3pbY8ZuCx4ML99uttZKLHC2QcAMn/live.html?id=<直播间id>
环境变量jd_liveLottery_ids // 直播间id多个用英文逗号@,换行分割
jd_liveLottery_threads // 控制并发线程数正整数默认1最大10
jd_liveLottery_interval // 自定义运行间隔时长整数单位毫秒默认500
jd_liveLottery_notify // 是否推送通知true/false默认不推送
jd_liveLottery_pinFilter // 账号pin过滤多个用@进行分割
jd_liveLottery_rewardnum // 京豆低于值不跑默认1
高并发脚本谨慎使用并发
活动限制IP严重建议使用代理
黑号会持续擦肩同一直播间活动请勿连续抽奖以直播间悬浮标识为准
cron:1 1 1 1 *
*/
const $ = new Env('京东直播互动抽奖')
var il='jsjiami.com.v7';const I1llIl=iii1II;(function(i1ilIl,llI11I,Il1i11,iii1li,Iil1i1,IIii11,iliIl1){return i1ilIl=i1ilIl>>0x9,IIii11='hs',iliIl1='hs',function(Ii1il1,iii1ll,IIliI1,il1lI,IliIIl){const llI11l=iii1II;il1lI='tfi',IIii11=il1lI+IIii11,IliIIl='up',iliIl1+=IliIIl,IIii11=IIliI1(IIii11),iliIl1=IIliI1(iliIl1),IIliI1=0x0;const I1il1l=Ii1il1();while(!![]&&--iii1li+iii1ll){try{il1lI=parseInt(llI11l(0x2db,'pNiu'))/0x1+-parseInt(llI11l(0x1d3,'gBkk'))/0x2+-parseInt(llI11l(0x299,'ndL&'))/0x3*(parseInt(llI11l(0x2b4,'AWc*'))/0x4)+parseInt(llI11l(0x1c4,'tJ8k'))/0x5*(parseInt(llI11l(0x1e1,'Gt2@'))/0x6)+-parseInt(llI11l(0x297,'9h%U'))/0x7+parseInt(llI11l(0x208,'GeCP'))/0x8*(parseInt(llI11l(0x2aa,'AB[Z'))/0x9)+-parseInt(llI11l(0x28d,'tR]F'))/0xa*(-parseInt(llI11l(0x209,'ObUp'))/0xb);}catch(lI1l1l){il1lI=IIliI1;}finally{IliIIl=I1il1l[IIii11]();if(i1ilIl<=iii1li)IIliI1?Iil1i1?il1lI=IliIIl:Iil1i1=IliIIl:IIliI1=IliIIl;else{if(IIliI1==Iil1i1['replace'](/[IyrLHKpPSDNtTuORqVUh=]/g,'')){if(il1lI===iii1ll){I1il1l['un'+IIii11](IliIIl);break;}I1il1l[iliIl1](IliIIl);}}}}}(Il1i11,llI11I,function(IIliII,iiliI,Ill11I,I1il1i,IliIIi,lI1l1i,i1iil){return iiliI='\x73\x70\x6c\x69\x74',IIliII=arguments[0x0],IIliII=IIliII[iiliI](''),Ill11I=`\x72\x65\x76\x65\x72\x73\x65`,IIliII=IIliII[Ill11I]('\x76'),I1il1i=`\x6a\x6f\x69\x6e`,(0x171df1,IIliII[I1il1i](''));});}(0x19400,0x2c98b,Iii11l,0xcc),Iii11l)&&(il=0x261b);const jdCookie=require(I1llIl(0x28a,'#9o@')),common=require('./utils/Rebels_jdCommon'),notify=require('./utils/Rebels_sendJDNotify');console[I1llIl(0x321,'ndL&')](''),console['log']('=========='+$[I1llIl(0x1f9,'8NB#')]+I1llIl(0x27e,'ndL&')),console[I1llIl(0x2ae,'Rt34')]('jd_liveLottery_ids\x20//\x20活动ID'),console['log'](I1llIl(0x1b9,'qXRN')),console[I1llIl(0x2ae,'Rt34')](I1llIl(0x236,'y00*')),console[I1llIl(0x309,'UpmU')](I1llIl(0x318,'YZ9I')),console[I1llIl(0x1e5,'Gt2@')](I1llIl(0x1fc,'&zDZ')),console['log'](I1llIl(0x1e2,'Ab7u')),console[I1llIl(0x2a0,'AWc*')](I1llIl(0x2f6,'LDu9')+$[I1llIl(0x26e,'PIJ5')]+'提示结束=========='),console['log']('');const liveIdList=(process[I1llIl(0x2e9,'9h%U')][I1llIl(0x2dc,'YZ9I')]||'')[I1llIl(0x2ac,'ObUp')](/[,@\n]+/g)[I1llIl(0x308,'gBkk')](iil1ll=>iil1ll[I1llIl(0x266,'0(LI')]())[I1llIl(0x228,'3p[Q')](Boolean);let taskThreads=process[I1llIl(0x2bf,'ReRH')][I1llIl(0x1c7,'l659')]||'1';const runInterval=process[I1llIl(0x1e7,'C9qI')][I1llIl(0x1dd,'y00*')]||I1llIl(0x21e,'l659'),isNotify=(process[I1llIl(0x2b9,'l659')][I1llIl(0x2fe,'Ab7u')]||process[I1llIl(0x306,'&5!E')]['jd_liveLottery_Notify'])===I1llIl(0x1c8,'F)pI'),pinFilter=(process[I1llIl(0x2f0,'YZ9I')][I1llIl(0x32a,'eoFR')]||'')['split']('@'),rewardnum=parseInt(process['env'][I1llIl(0x1c2,'pNiu')])||0x1;let cookiesArr=Object[I1llIl(0x2f4,'ipL6')](jdCookie)[I1llIl(0x295,'l659')](iiilil=>jdCookie[iiilil])[I1llIl(0x235,'UpmU')](iil1li=>iil1li);!cookiesArr[0x0]&&($[I1llIl(0x21a,'l659')]($[I1llIl(0x2d2,'3p[Q')],'【提示】请先获取Cookie'),process[I1llIl(0x314,'g^*J')](0x1));function iii1II(_0x1af857,_0x50ccea){const _0x342308=Iii11l();return iii1II=function(_0x1d15b9,_0x28b40f){_0x1d15b9=_0x1d15b9-0x1b5;let _0x13a3fd=_0x342308[_0x1d15b9];if(iii1II['NeawnT']===undefined){var _0x410043=function(_0x1eaca1){const _0x5a5989='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x103f9e='',_0x257c3d='';for(let _0x59dc32=0x0,_0x1f757b,_0x2292c4,_0x5c5ad8=0x0;_0x2292c4=_0x1eaca1['charAt'](_0x5c5ad8++);~_0x2292c4&&(_0x1f757b=_0x59dc32%0x4?_0x1f757b*0x40+_0x2292c4:_0x2292c4,_0x59dc32++%0x4)?_0x103f9e+=String['fromCharCode'](0xff&_0x1f757b>>(-0x2*_0x59dc32&0x6)):0x0){_0x2292c4=_0x5a5989['indexOf'](_0x2292c4);}for(let _0x3faca1=0x0,_0x47225f=_0x103f9e['length'];_0x3faca1<_0x47225f;_0x3faca1++){_0x257c3d+='%'+('00'+_0x103f9e['charCodeAt'](_0x3faca1)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x257c3d);};const _0x27729a=function(_0x3af516,_0x22c3bb){let _0x3364db=[],_0x28ca5c=0x0,_0x5ec01f,_0x1742fd='';_0x3af516=_0x410043(_0x3af516);let _0x58a6f3;for(_0x58a6f3=0x0;_0x58a6f3<0x100;_0x58a6f3++){_0x3364db[_0x58a6f3]=_0x58a6
// 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"])