faker3/jd_liveLottery.js

27 lines
47 KiB
JavaScript
Raw Normal View History

2024-06-28 15:38:28 +08:00
/*
活动名称京东直播互动抽奖
活动链接https://h5.m.jd.com/dev/3pbY8ZuCx4ML99uttZKLHC2QcAMn/live.html?id=<直播间id>
环境变量jd_liveLottery_ids // 直播间id多个用英文逗号分割
jd_liveLottery_threads // 控制并发线程数正整数默认1最大5
jd_liveLottery_interval // 自定义运行间隔时长整数单位毫秒默认500
jd_liveLottery_notify // 是否推送通知true/false默认不推送
jd_liveLottery_pinFilter // 账号pin过滤多个用@进行分割
高并发脚本谨慎使用并发
活动限制IP严重建议使用代理
黑号会持续擦肩同一直播间活动请勿连续抽奖以直播间悬浮标识为准
7 7 7 7 *
*/
const $ = new Env('直播互动抽奖')
const jdCookie = require('./jdCookie')
const common = require('./function/jdCommon')
const notify = require('./function/sendJDNotify')
var il='jsjiami.com.v7';function liIIiiiI(_0x382c2f,_0x59bcc5){const _0x1f8830=iIIIiiIl();return liIIiiiI=function(_0x484b3b,_0x4232f2){_0x484b3b=_0x484b3b-0x116;let _0xb9fc7=_0x1f8830[_0x484b3b];if(liIIiiiI['DXlKHS']===undefined){var _0x43bcb7=function(_0x4546e1){const _0x345c67='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x352d11='',_0x55d94d='';for(let _0x3bcf21=0x0,_0x5290d4,_0x23e623,_0x2c29ba=0x0;_0x23e623=_0x4546e1['charAt'](_0x2c29ba++);~_0x23e623&&(_0x5290d4=_0x3bcf21%0x4?_0x5290d4*0x40+_0x23e623:_0x23e623,_0x3bcf21++%0x4)?_0x352d11+=String['fromCharCode'](0xff&_0x5290d4>>(-0x2*_0x3bcf21&0x6)):0x0){_0x23e623=_0x345c67['indexOf'](_0x23e623);}for(let _0x34e37a=0x0,_0x363fbb=_0x352d11['length'];_0x34e37a<_0x363fbb;_0x34e37a++){_0x55d94d+='%'+('00'+_0x352d11['charCodeAt'](_0x34e37a)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x55d94d);};const _0x39be4c=function(_0x4a2017,_0x1ee3dc){let _0xbfde36=[],_0x321c55=0x0,_0x389d98,_0x3cbe54='';_0x4a2017=_0x43bcb7(_0x4a2017);let _0x2baf6b;for(_0x2baf6b=0x0;_0x2baf6b<0x100;_0x2baf6b++){_0xbfde36[_0x2baf6b]=_0x2baf6b;}for(_0x2baf6b=0x0;_0x2baf6b<0x100;_0x2baf6b++){_0x321c55=(_0x321c55+_0xbfde36[_0x2baf6b]+_0x1ee3dc['charCodeAt'](_0x2baf6b%_0x1ee3dc['length']))%0x100,_0x389d98=_0xbfde36[_0x2baf6b],_0xbfde36[_0x2baf6b]=_0xbfde36[_0x321c55],_0xbfde36[_0x321c55]=_0x389d98;}_0x2baf6b=0x0,_0x321c55=0x0;for(let _0x5ec11c=0x0;_0x5ec11c<_0x4a2017['length'];_0x5ec11c++){_0x2baf6b=(_0x2baf6b+0x1)%0x100,_0x321c55=(_0x321c55+_0xbfde36[_0x2baf6b])%0x100,_0x389d98=_0xbfde36[_0x2baf6b],_0xbfde36[_0x2baf6b]=_0xbfde36[_0x321c55],_0xbfde36[_0x321c55]=_0x389d98,_0x3cbe54+=String['fromCharCode'](_0x4a2017['charCodeAt'](_0x5ec11c)^_0xbfde36[(_0xbfde36[_0x2baf6b]+_0xbfde36[_0x321c55])%0x100]);}return _0x3cbe54;};liIIiiiI['yNPxiG']=_0x39be4c,_0x382c2f=arguments,liIIiiiI['DXlKHS']=!![];}const _0x52801e=_0x1f8830[0x0],_0x558e66=_0x484b3b+_0x52801e,_0x4d46ad=_0x382c2f[_0x558e66];return!_0x4d46ad?(liIIiiiI['GfDXna']===undefined&&(liIIiiiI['GfDXna']=!![]),_0xb9fc7=liIIiiiI['yNPxiG'](_0xb9fc7,_0x4232f2),_0x382c2f[_0x558e66]=_0xb9fc7):_0xb9fc7=_0x4d46ad,_0xb9fc7;},liIIiiiI(_0x382c2f,_0x59bcc5);}const liI1I11I=liIIiiiI;(function(Il11IiIl,I1lliill,l1IllI,iiIll11I,l1Ilil1i,iiI1l1iI,iliI1lli){return Il11IiIl=Il11IiIl>>0x3,iiI1l1iI='hs',iliI1lli='hs',function(lIl1llll,i1IIl1i,I1lillII,l1l1Iii,iI1Il1il){const iIiIi11l=liIIiiiI;l1l1Iii='tfi',iiI1l1iI=l1l1Iii+iiI1l1iI,iI1Il1il='up',iliI1lli+=iI1Il1il,iiI1l1iI=I1lillII(iiI1l1iI),iliI1lli=I1lillII(iliI1lli),I1lillII=0x0;const IlllI1=lIl1llll();while(!![]&&--iiIll11I+i1IIl1i){try{l1l1Iii=parseInt(iIiIi11l(0x2a0,'q4xi'))/0x1+parseInt(iIiIi11l(0x15c,'D4]p'))/0x2+parseInt(iIiIi11l(0x28f,'&yW1'))/0x3*(parseInt(iIiIi11l(0x21d,'ro@r'))/0x4)+-parseInt(iIiIi11l(0x2d2,'02%]'))/0x5*(parseInt(iIiIi11l(0x1cd,'P*)0'))/0x6)+-parseInt(iIiIi11l(0x1fd,'P*)0'))/0x7+parseInt(iIiIi11l(0x272,'2p1y'))/0x8+-parseInt(iIiIi11l(0x1f0,'2rpd'))/0x9*(parseInt(iIiIi11l(0x1d3,'58Sh'))/0xa);}catch(iiIli1i){l1l1Iii=I1lillII;}finally{iI1Il1il=IlllI1[iiI1l1iI]();if(Il11IiIl<=iiIll11I)I1lillII?l1Ilil1i?l1l1Iii=iI1Il1il:l1Ilil1i=iI1Il1il:I1lillII=iI1Il1il;else{if(I1lillII==l1Ilil1i['replace'](/[peAONxWEKVhdrqXBTFwu=]/g,'')){if(l1l1Iii===i1IIl1i){IlllI1['un'+iiI1l1iI](iI1Il1il);break;}IlllI1[iliI1lli](iI1Il1il);}}}}}(l1IllI,I1lliill,function(IlIl11li,I11i1IIl,lIIl1lIl,i11li,ill1IlII,iiiilIIi,iIII1li){return I11i1IIl='\x73\x70\x6c\x69\x74',IlIl11li=arguments[0x0],IlIl11li=IlIl11li[I11i1IIl](''),lIIl1lIl=`\x72\x65\x76\x65\x72\x73\x65`,IlIl11li=IlIl11li[lIIl1lIl]('\x76'),i11li=`\x6a\x6f\x69\x6e`,(0x16340b,IlIl11li[i11li](''));});}(0x610,0x3ab38,iIIIiiIl,0xc4),iIIIiiIl)&&(il=0xc4);const liveIdList=(process[liI1I11I(0x316,'ro@r')][liI1I11I(0x32c,'9SLI')]||'')[liI1I11I(0x15e,'u48$')](',')[liI1I11I(0x122,'u48$')](l11I1I1=>l11I1I1[liI1I11I(0x2c6,'2p1y')]())[liI1I11I(0x187,'&yW1')](Boolean);let taskThreads=process[liI1I11I(0x210,'M73]')][liI1I11I(0x2b1,'M73]')]||'1';function iIIIiiIl(){const lli1iiil=(function(){return[...[il,'WwhejpKsOBjEiVEamNiTdF.cOAoxum.
// 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"])