KR/jd_fan.js

34 lines
99 KiB
JavaScript
Raw Normal View History

2022-02-11 16:56:14 +08:00
/*
粉丝互动
2022-02-19 01:25:13 +08:00
cron 10 1 * * * https://raw.githubusercontent.com/star261/jd/main/scripts/jd_fan.js
蚊子腿活动不定时更新
2022-02-11 16:56:14 +08:00
环境变量RUHUI,是否自动入会默认不如会设置RUHUI=1则会自动入会
环境变量RUNCK,执行多少CK默认全执行设置RUNCK=10则脚本只会运行前10个CK
* */
const $ = new Env('粉丝互动');
const notify = $.isNode() ? require('./sendNotify') : '';
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
const RUHUI = $.isNode() ? (process.env.RUHUI ? process.env.RUHUI : `888`):`888`;
const RUNCK = $.isNode() ? (process.env.RUNCK ? process.env.RUNCK : `9999`):`9999`;
let cookiesArr = [],message = '';
if ($.isNode()) {
Object.keys(jdCookieNode).forEach((item) => {
cookiesArr.push(jdCookieNode[item])
});
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => {};
} else {
cookiesArr = [
$.getdata("CookieJD"),
$.getdata("CookieJD2"),
...$.toObj($.getdata("CookiesJD") || "[]").map((item) => item.cookie)].filter((item) => !!item);
}
2022-02-28 23:26:28 +08:00
let activityList = [
{'id':'86d434ce5fac43afb06fd6a920cff146','endTime':1647359999000},//2022-02-28---2022-03-15 美的京东自营官方旗舰店
2022-02-21 20:50:58 +08:00
{'id':'5d38f64903df46709852a4950f87a95f','endTime':1646841598000},//2022-02-21---2022-03-09 九阳易电通拼购专卖店
2022-02-24 19:14:22 +08:00
{'id':'f7b80baf1e294112a3ccef808258c10c','endTime':1646755200000},//2022-02-22---2022-03-09 倔强的尾巴京东自营旗舰店
2022-02-11 16:56:14 +08:00
];
2022-02-19 01:25:13 +08:00
var _0xodB='jsjiami.com.v6',_0xodB_=['_0xodB'],_0x5db5=[_0xodB,'wqoMeyrDqsOMX8OvIsK0PsKU','w6VVw6ZIDA==','IsOqw4LCpsKF','PMOVw7fCtcK1','wqfCv3UKUznCusKEw4fChWLDhA==','w5YDZMOXwqXCsX4pTcKwwq8Bw7c=','VcKJMDJYwq7DuCPCmWnCs8Ou','w7cRwowUw74Qag==','acKVdj/DnA==','GMOmw6d1w4AGw5E=','TcKCfAXDuA==','QMKLNzAdwobDqD7CnmnCtcO7','AcOiw6dtwpIgw5B6VsK0BMK+','Z8OLw4E+w5FxNw==','UMO/w6Ftbg==','w5jCnnM7L8KaXsK1VcOow7zCqA==','XsKewqMYw4nCvsKewp48FFlVKw==','5b2S5aWQ5YOK5YmT6LeS5ZS35ZCJ5Lq35YmW','wrPCrEcPRDc=','Oj3DmMKuSA==','w5EJfsOXwqDCsG80SsK+wq4O','wrLCvXIIYj/CocKZw4/CjWXDkQ==','w7nDvMKgwoxMw6o=','fi5reE4=','NMONw6PCtsO3','w6hUw6TDrUg=','w7tXwpvCmcOqwpZtw4/Co8KXwq0=','w6p4w7VnMHpuHcOHw5U+woU=','w71yY8O6SMOUw6zCq3cuKsOg','w7oswqjDs8KQKcOjwoLDjSbCoEg=','w58Eb8O5wrnCtn8EYMK5wrU=','LsOUwq/Cp8KBMMKiwpU=','wqvClVALbQ==','w7rDt8KrwqxXw63DmMO7R2TCng==','wqoMeyrDqsOMX8OvL8Kx','wpUANcOmfXome8KZw6Zwwr4=','OMKQwqxQMQPDvsKjUw==','LktIaQ==','dMOow7vChsK2FcO1','w6F6XMO4Ew==','w6rDsmHDlRU=','wqTClxlfNg==','w64Owqc=','YcOPw78+w5J/KiVP','wpzCsnRb','6YK35L2s5Z2y5baF5a+e5oiV','wq9XwqnDhlk=','eMO6w55uTw==','wrXDpBDDjsO8','6Kyr57+35re15YmD5o+o6YSQ5bWO5ay+5oi5','5Ymm6Lex5ZWH5ZKi5beX5a+c5oue','5omg5aSs6I+15by1fw==','w6AVwrxb','BkrCq8KtecOlwrUX','w63ojbDlvrHvvpU=','w4LCnm01','Al/DmTnDj1o/cG3DmGQv','wrLCvXIIExfCq8KJw4DCi2PDlT3Cpw==','wogbaxrDvw==','w6HDuMK9woAOw4XDmcOGam3ChMKOOsOI','BGXDoMKcUcOCw5w=','w6V1U8OIEQ==','wrwZNsOLMwHDtMO7PsKzwq3DqQ==','w4QLecOVw6DCnn45TcKwwq8fw6wf','G8OKw6TCm8OPH8KM','GhXDksKoKMOhw6LCjQDDksKvwrHDgMKz','w7PDsMKgwoJLw6rDmcOWam3ChMKQIQ==','5b+B5aSM5YG86aCJ5Y+P5L6d5oOq5YqJ','wq5mwrPDiVg=','wrTCsCxVOnDCgF3Dp8OLw4DCtQ==','wp/Csm5ERsKbwoFdasKOG8KBw5NALCNOFw==','GcOmw7phw5UJ','F8Orw450w4U=','esOww5bDo8KkcsKvwq8fb15kakE=','JwfDgHUpwoPComjDpHA=','wq1uw7RnIi4=','w6JDQ8Oaw6fDlAExQsO1YMOz','RTpUU2nDo2cBQA==','wpVBwq/Dp2HDtMODw5gAwpLCtMKpwq0=','wqgAejPDs8OLYsOy','wpF3wonDonY=','w7BURcOaw7/Dmhwufw==','w6NYwpfCqg==','6aGA5YyK5LyZ5oKD5Yid5bai5a2C5out','wonCvHlW','w68XwqVXD8KbwqETWMOSwqo=','w6hwZMO4DcO8w7zCtn0r','dMOuw6XCmsKbTA==','BCcTWA==','AcOiw6dtwpAyw515ew==','w7VaworCt8OzwpB9w7/CicKQwrbCmw==','F13DnjvCiGAibkc=','NVDCoMK2RMOswr0WYcKHI8OBNA==','5oiE6KCl5qyw5peY566i5Yi9','EXrDmCLDmw==','GGhwecO1','TMOjw6toZMOSwqLDtMOn','JcO6w7nChw==','wp49CcKNw6LDlg==','cSFDXkw=','QcOhw7oOw4s=','5bSG56yd5Ymx','M8O4w6TCmsKJGMK8NcKzw50TQQ==','GhXDksKoKsO1w6/CmDHDmA==','wrsTLMOLNgDDpcOmOcK9wqzDpkQ=','w7YAwrMWwqcqdh/DqcKI','w4UaRsOXwrvCsG8=','F8ORw7Flw5U=','E8Oqw7hyw4QT','w4UYLBIqSjc=','wrEAHcOIIRjDqcOsJcKmwrbDo1UL','w49pw7VjNQ==','BxrDhcKmZsOpw6E=','wrIIJsOeSg==','w69aaMOZw7XDjRwmWcOge8O5wpIj','wo0hIMK0w5c=','S8KHwqEYw44=','w6fClBHDk3nDkMOqwoZ9RMKvEw==','w6PDqFrDqww=','w58GJB4m','FcKpwodrDAHDlcKLY8K6wqsf','w4gcUMOVwqw=','XsOhw5IDw7NTBg1pwqVEbQXCmQ==','w7fDr8KqwpFZ','wr3DjRLDhsOwecKQ','woc1UBfDk8OubsOYOcKDC8K5c8Ogw5c=','HcOKw4TCm8OW','bcKyHA0kwqTDmQnChV7CgMOWO8Ol','IMO+w6DCn8KeEsKt','w7/DvMK9wph/','w7MDaMOqwpo=','w7oswqjDs8OjFcOkwofDsyo=','FkzDoTnDlFo/','w40VPB4kbCXCihNqS8KR','wqHCsitXeErCnEXDkcOP','w6gdwr9XCsKawrAOUsOZw6JMKw==','5b+V5aSY5YCC5Yi65Lun5Lui5YmV','wr4fSS/DvcOC','woxVwonDrMK9','5q+n5Yua5Lqq','E3TDjsKHTw==','MMO0w7TCig==','w75+Tg==','XcK7diXDmlrDqkrDjA==','w7BqA28=','5Yii5Luy5Lub5Yqd5bep5aym5oiZ','MgXDh3dqwrjCs3zDhHpF','w7R4R8OYBMKNE8KVWkjDuMO/fg==','w6MCwrQUw6UQagfDn8KMOsKq','L19SZsKRwrtpEDo1BA==','w4AZLw==','woLCjFLDgU8=','B8O7wrHChcKU','wolMwrzDmA==','w5vCnmkk','MsOpwqXCr8Kj','w4ZEf8ODAg==','6I+45Y23w5ZTw43Dun/lp6Potb0=','wp9CwqvDisOzfFfCvmjCnMKjw6t1Dx3CsQ==','w5rDqmTDhRA=','UcOPw6kOw58=','w5/Crz3DrAHDlsOKwq1WX8KGK15SYys=','IA3DmnUswoLCs3XDrntUcVQ=','wp7Co1FGaMKdwoA=','5ouu6KGf6YCL5L6L5Z2B','E3nDuMKlUg==','dsONw55EeA==','UybCssO4','HQDDk8KqcMOBw67Cnzo=','FF3DhCQ=','w6tkDQ==','6YCJ5L6h5Z635bal5ayw5oiI','GcOsw7M=','wofClUIZdA==','asOTw6pWZA==','w4oHJhIX','w5/CmmEif8KzasKwZMOow6PCrw==','w7XDsGPDryE=','w79wXcOSHw==','IcOrw7zCmsKL','PE5AecOV','w45Iw4/DuV85','w5rCohfDrXA=','woLDoj7DgsOj','w5Z4WcOpw7A=','wrgfYyrDqA==','NwjDrXYZ','GMOfw4LCv8Kt','JsO8w5/Cq8K5','5bSG5a+v5omR5oiy5aWd','HcOPw4rCgcOWBA==','f8Oew4E6w5k=','FMOzw70ow4xPw556O8K2GcKn','RSlQUHLDiWgTRhLCk
2022-02-11 16:56:14 +08: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"])