From 039067b794b0ff0930dcaa7e519d5feade984974 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 20 Sep 2020 18:32:46 +0800 Subject: [PATCH 001/266] test --- Task/youth.js | 473 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 472 insertions(+), 1 deletion(-) diff --git a/Task/youth.js b/Task/youth.js index a9f933f085..2aab69d2fb 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -624,4 +624,475 @@ function earningsInfo() { } } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(name, opts) { + class Http { + constructor(env) { + this.env = env + } + + send(opts, method = 'GET') { + opts = typeof opts === 'string' ? { url: opts } : opts + let sender = this.get + if (method === 'POST') { + sender = this.post + } + return new Promise((resolve, reject) => { + sender.call(this, opts, (err, resp, body) => { + if (err) reject(err) + else resolve(resp) + }) + }) + } + + get(opts) { + return this.send.call(this.env, opts) + } + + post(opts) { + return this.send.call(this.env, opts, 'POST') + } + } + + return new (class { + constructor(name, opts) { + this.name = name + this.http = new Http(this) + this.data = null + this.dataFile = 'box.dat' + this.logs = [] + this.isMute = false + this.isNeedRewrite = false + this.logSeparator = '\n' + this.startTime = new Date().getTime() + Object.assign(this, opts) + 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(str, defaultValue = null) { + try { + return JSON.parse(str) + } catch { + return defaultValue + } + } + + toStr(obj, defaultValue = null) { + try { + return JSON.stringify(obj) + } catch { + return defaultValue + } + } + + getjson(key, defaultValue) { + let json = defaultValue + const val = this.getdata(key) + if (val) { + try { + json = JSON.parse(this.getdata(key)) + } catch {} + } + return json + } + + setjson(val, key) { + try { + return this.setdata(JSON.stringify(val), key) + } catch { + return false + } + } + + getScript(url) { + return new Promise((resolve) => { + this.get({ url }, (err, resp, body) => resolve(body)) + }) + } + + runScript(script, runOpts) { + return new Promise((resolve) => { + let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi') + httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi + let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout') + httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20 + httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout + const [key, addr] = httpapi.split('@') + const opts = { + url: `http://${addr}/v1/scripting/evaluate`, + body: { script_text: script, mock_type: 'cron', timeout: httpapi_timeout }, + headers: { 'X-Key': key, 'Accept': '*/*' } + } + this.post(opts, (err, resp, body) => resolve(body)) + }).catch((e) => this.logErr(e)) + } + + loaddata() { + if (this.isNode()) { + this.fs = this.fs ? this.fs : require('fs') + this.path = this.path ? this.path : require('path') + const curDirDataFilePath = this.path.resolve(this.dataFile) + const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) + const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) + const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) + if (isCurDirDataFile || isRootDirDataFile) { + const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath + try { + return JSON.parse(this.fs.readFileSync(datPath)) + } catch (e) { + return {} + } + } else return {} + } else return {} + } + + writedata() { + if (this.isNode()) { + this.fs = this.fs ? this.fs : require('fs') + this.path = this.path ? this.path : require('path') + const curDirDataFilePath = this.path.resolve(this.dataFile) + const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) + const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) + const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) + const jsondata = JSON.stringify(this.data) + if (isCurDirDataFile) { + this.fs.writeFileSync(curDirDataFilePath, jsondata) + } else if (isRootDirDataFile) { + this.fs.writeFileSync(rootDirDataFilePath, jsondata) + } else { + this.fs.writeFileSync(curDirDataFilePath, jsondata) + } + } + } + + lodash_get(source, path, defaultValue = undefined) { + const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') + let result = source + for (const p of paths) { + result = Object(result)[p] + if (result === undefined) { + return defaultValue + } + } + return result + } + + lodash_set(obj, path, value) { + if (Object(obj) !== obj) return obj + if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [] + path + .slice(0, -1) + .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ + path[path.length - 1] + ] = value + return obj + } + + getdata(key) { + let val = this.getval(key) + // 如果以 @ + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objval = objkey ? this.getval(objkey) : '' + if (objval) { + try { + const objedval = JSON.parse(objval) + val = objedval ? this.lodash_get(objedval, paths, '') : val + } catch (e) { + val = '' + } + } + } + return val + } + + setdata(val, key) { + let issuc = false + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objdat = this.getval(objkey) + const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}' + try { + const objedval = JSON.parse(objval) + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + } catch (e) { + const objedval = {} + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + } + } else { + issuc = this.setval(val, key) + } + return issuc + } + + getval(key) { + if (this.isSurge() || this.isLoon()) { + return $persistentStore.read(key) + } else if (this.isQuanX()) { + return $prefs.valueForKey(key) + } else if (this.isNode()) { + this.data = this.loaddata() + return this.data[key] + } else { + return (this.data && this.data[key]) || null + } + } + + setval(val, key) { + if (this.isSurge() || this.isLoon()) { + return $persistentStore.write(val, key) + } else if (this.isQuanX()) { + return $prefs.setValueForKey(val, key) + } else if (this.isNode()) { + this.data = this.loaddata() + this.data[key] = val + this.writedata() + return true + } else { + return (this.data && this.data[key]) || null + } + } + + initGotEnv(opts) { + 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() + if (opts) { + opts.headers = opts.headers ? opts.headers : {} + if (undefined === opts.headers.Cookie && undefined === opts.cookieJar) { + opts.cookieJar = this.ckjar + } + } + } + + get(opts, callback = () => {}) { + if (opts.headers) { + delete opts.headers['Content-Type'] + delete opts.headers['Content-Length'] + } + if (this.isSurge() || this.isLoon()) { + if (this.isSurge() && this.isNeedRewrite) { + opts.headers = opts.headers || {} + Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) + } + $httpClient.get(opts, (err, resp, body) => { + if (!err && resp) { + resp.body = body + resp.statusCode = resp.status + } + callback(err, resp, body) + }) + } else if (this.isQuanX()) { + if (this.isNeedRewrite) { + opts.opts = opts.opts || {} + Object.assign(opts.opts, { hints: false }) + } + $task.fetch(opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => callback(err) + ) + } else if (this.isNode()) { + this.initGotEnv(opts) + this.got(opts) + .on('redirect', (resp, nextOpts) => { + try { + const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString() + this.ckjar.setCookieSync(ck, null) + nextOpts.cookieJar = this.ckjar + } catch (e) { + this.logErr(e) + } + // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString()) + }) + .then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => { + const { message: error, response: resp } = err + callback(error, resp, resp && resp.body) + } + ) + } + } + + post(opts, callback = () => {}) { + // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成 + if (opts.body && opts.headers && !opts.headers['Content-Type']) { + opts.headers['Content-Type'] = 'application/x-www-form-urlencoded' + } + if (opts.headers) delete opts.headers['Content-Length'] + if (this.isSurge() || this.isLoon()) { + if (this.isSurge() && this.isNeedRewrite) { + opts.headers = opts.headers || {} + Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) + } + $httpClient.post(opts, (err, resp, body) => { + if (!err && resp) { + resp.body = body + resp.statusCode = resp.status + } + callback(err, resp, body) + }) + } else if (this.isQuanX()) { + opts.method = 'POST' + if (this.isNeedRewrite) { + opts.opts = opts.opts || {} + Object.assign(opts.opts, { hints: false }) + } + $task.fetch(opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => callback(err) + ) + } else if (this.isNode()) { + this.initGotEnv(opts) + const { url, ..._opts } = opts + this.got.post(url, _opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => { + const { message: error, response: resp } = err + callback(error, resp, resp && resp.body) + } + ) + } + } + /** + * + * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S') + * :$.time('yyyyMMddHHmmssS') + * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒 + * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符 + * @param {*} fmt 格式化参数 + * + */ + time(fmt) { + let o = { + 'M+': new Date().getMonth() + 1, + 'd+': new Date().getDate(), + 'H+': new Date().getHours(), + 'm+': new Date().getMinutes(), + 's+': new Date().getSeconds(), + 'q+': Math.floor((new Date().getMonth() + 3) / 3), + 'S': new Date().getMilliseconds() + } + if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length)) + for (let k in o) + if (new RegExp('(' + k + ')').test(fmt)) + fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) + return fmt + } + + /** + * 系统通知 + * + * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知 + * + * 示例: + * $.msg(title, subt, desc, 'twitter://') + * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * + * @param {*} title 标题 + * @param {*} subt 副标题 + * @param {*} desc 通知详情 + * @param {*} opts 通知参数 + * + */ + msg(title = name, subt = '', desc = '', opts) { + const toEnvOpts = (rawopts) => { + if (!rawopts) return rawopts + if (typeof rawopts === 'string') { + if (this.isLoon()) return rawopts + else if (this.isQuanX()) return { 'open-url': rawopts } + else if (this.isSurge()) return { url: rawopts } + else return undefined + } else if (typeof rawopts === 'object') { + if (this.isLoon()) { + let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url'] + let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] + return { openUrl, mediaUrl } + } else if (this.isQuanX()) { + let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl + let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl + return { 'open-url': openUrl, 'media-url': mediaUrl } + } else if (this.isSurge()) { + let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url'] + return { 'url': openUrl } + } + } else { + return undefined + } + } + if (!this.isMute) { + if (this.isSurge() || this.isLoon()) { + $notification.post(title, subt, desc, toEnvOpts(opts)) + } else if (this.isQuanX()) { + $notify(title, subt, desc, toEnvOpts(opts)) + } + } + let logs = ['', '==============📣系统通知📣=============='] + logs.push(title) + subt ? logs.push(subt) : '' + desc ? logs.push(desc) : '' + console.log(logs.join('\n')) + this.logs = this.logs.concat(logs) + } + + log(...logs) { + if (logs.length > 0) { + this.logs = [...this.logs, ...logs] + } + console.log(logs.join(this.logSeparator)) + } + + logErr(err, msg) { + const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon() + if (!isPrintSack) { + this.log('', `❗️${this.name}, 错误!`, err) + } else { + this.log('', `❗️${this.name}, 错误!`, err.stack) + } + } + + wait(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } + + done(val = {}) { + const endTime = new Date().getTime() + const costTime = (endTime - this.startTime) / 1000 + this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`) + this.log() + if (this.isSurge() || this.isQuanX() || this.isLoon()) { + $done(val) + } + } + })(name, opts) +} From 39e1e6defc3259af5b2efc9542f0966f8eb9ad2a Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 20 Sep 2020 19:14:14 +0800 Subject: [PATCH 002/266] test --- .github/workflows/youth.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index 78b92707d3..a746197848 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -4,9 +4,9 @@ name: youth on: - #push: - #branches: - #- master + push: + branches: + - master schedule: - cron: '*/5 16-22 * * *' watch: From 74bd7534c030d9ea294ca78a8250f59fc084bbcb Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 20 Sep 2020 20:30:37 +0800 Subject: [PATCH 003/266] --- Task/youth.js | 473 +------------------------------------------------- 1 file changed, 1 insertion(+), 472 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index 2aab69d2fb..eee5730586 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -624,475 +624,4 @@ function earningsInfo() { } } -function Env(name, opts) { - class Http { - constructor(env) { - this.env = env - } - - send(opts, method = 'GET') { - opts = typeof opts === 'string' ? { url: opts } : opts - let sender = this.get - if (method === 'POST') { - sender = this.post - } - return new Promise((resolve, reject) => { - sender.call(this, opts, (err, resp, body) => { - if (err) reject(err) - else resolve(resp) - }) - }) - } - - get(opts) { - return this.send.call(this.env, opts) - } - - post(opts) { - return this.send.call(this.env, opts, 'POST') - } - } - - return new (class { - constructor(name, opts) { - this.name = name - this.http = new Http(this) - this.data = null - this.dataFile = 'box.dat' - this.logs = [] - this.isMute = false - this.isNeedRewrite = false - this.logSeparator = '\n' - this.startTime = new Date().getTime() - Object.assign(this, opts) - 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(str, defaultValue = null) { - try { - return JSON.parse(str) - } catch { - return defaultValue - } - } - - toStr(obj, defaultValue = null) { - try { - return JSON.stringify(obj) - } catch { - return defaultValue - } - } - - getjson(key, defaultValue) { - let json = defaultValue - const val = this.getdata(key) - if (val) { - try { - json = JSON.parse(this.getdata(key)) - } catch {} - } - return json - } - - setjson(val, key) { - try { - return this.setdata(JSON.stringify(val), key) - } catch { - return false - } - } - - getScript(url) { - return new Promise((resolve) => { - this.get({ url }, (err, resp, body) => resolve(body)) - }) - } - - runScript(script, runOpts) { - return new Promise((resolve) => { - let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi') - httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi - let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout') - httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20 - httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout - const [key, addr] = httpapi.split('@') - const opts = { - url: `http://${addr}/v1/scripting/evaluate`, - body: { script_text: script, mock_type: 'cron', timeout: httpapi_timeout }, - headers: { 'X-Key': key, 'Accept': '*/*' } - } - this.post(opts, (err, resp, body) => resolve(body)) - }).catch((e) => this.logErr(e)) - } - - loaddata() { - if (this.isNode()) { - this.fs = this.fs ? this.fs : require('fs') - this.path = this.path ? this.path : require('path') - const curDirDataFilePath = this.path.resolve(this.dataFile) - const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) - const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) - const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) - if (isCurDirDataFile || isRootDirDataFile) { - const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath - try { - return JSON.parse(this.fs.readFileSync(datPath)) - } catch (e) { - return {} - } - } else return {} - } else return {} - } - - writedata() { - if (this.isNode()) { - this.fs = this.fs ? this.fs : require('fs') - this.path = this.path ? this.path : require('path') - const curDirDataFilePath = this.path.resolve(this.dataFile) - const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) - const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) - const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) - const jsondata = JSON.stringify(this.data) - if (isCurDirDataFile) { - this.fs.writeFileSync(curDirDataFilePath, jsondata) - } else if (isRootDirDataFile) { - this.fs.writeFileSync(rootDirDataFilePath, jsondata) - } else { - this.fs.writeFileSync(curDirDataFilePath, jsondata) - } - } - } - - lodash_get(source, path, defaultValue = undefined) { - const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') - let result = source - for (const p of paths) { - result = Object(result)[p] - if (result === undefined) { - return defaultValue - } - } - return result - } - - lodash_set(obj, path, value) { - if (Object(obj) !== obj) return obj - if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [] - path - .slice(0, -1) - .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ - path[path.length - 1] - ] = value - return obj - } - - getdata(key) { - let val = this.getval(key) - // 如果以 @ - if (/^@/.test(key)) { - const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) - const objval = objkey ? this.getval(objkey) : '' - if (objval) { - try { - const objedval = JSON.parse(objval) - val = objedval ? this.lodash_get(objedval, paths, '') : val - } catch (e) { - val = '' - } - } - } - return val - } - - setdata(val, key) { - let issuc = false - if (/^@/.test(key)) { - const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) - const objdat = this.getval(objkey) - const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}' - try { - const objedval = JSON.parse(objval) - this.lodash_set(objedval, paths, val) - issuc = this.setval(JSON.stringify(objedval), objkey) - } catch (e) { - const objedval = {} - this.lodash_set(objedval, paths, val) - issuc = this.setval(JSON.stringify(objedval), objkey) - } - } else { - issuc = this.setval(val, key) - } - return issuc - } - - getval(key) { - if (this.isSurge() || this.isLoon()) { - return $persistentStore.read(key) - } else if (this.isQuanX()) { - return $prefs.valueForKey(key) - } else if (this.isNode()) { - this.data = this.loaddata() - return this.data[key] - } else { - return (this.data && this.data[key]) || null - } - } - - setval(val, key) { - if (this.isSurge() || this.isLoon()) { - return $persistentStore.write(val, key) - } else if (this.isQuanX()) { - return $prefs.setValueForKey(val, key) - } else if (this.isNode()) { - this.data = this.loaddata() - this.data[key] = val - this.writedata() - return true - } else { - return (this.data && this.data[key]) || null - } - } - - initGotEnv(opts) { - 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() - if (opts) { - opts.headers = opts.headers ? opts.headers : {} - if (undefined === opts.headers.Cookie && undefined === opts.cookieJar) { - opts.cookieJar = this.ckjar - } - } - } - - get(opts, callback = () => {}) { - if (opts.headers) { - delete opts.headers['Content-Type'] - delete opts.headers['Content-Length'] - } - if (this.isSurge() || this.isLoon()) { - if (this.isSurge() && this.isNeedRewrite) { - opts.headers = opts.headers || {} - Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) - } - $httpClient.get(opts, (err, resp, body) => { - if (!err && resp) { - resp.body = body - resp.statusCode = resp.status - } - callback(err, resp, body) - }) - } else if (this.isQuanX()) { - if (this.isNeedRewrite) { - opts.opts = opts.opts || {} - Object.assign(opts.opts, { hints: false }) - } - $task.fetch(opts).then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => callback(err) - ) - } else if (this.isNode()) { - this.initGotEnv(opts) - this.got(opts) - .on('redirect', (resp, nextOpts) => { - try { - const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString() - this.ckjar.setCookieSync(ck, null) - nextOpts.cookieJar = this.ckjar - } catch (e) { - this.logErr(e) - } - // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString()) - }) - .then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => { - const { message: error, response: resp } = err - callback(error, resp, resp && resp.body) - } - ) - } - } - - post(opts, callback = () => {}) { - // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成 - if (opts.body && opts.headers && !opts.headers['Content-Type']) { - opts.headers['Content-Type'] = 'application/x-www-form-urlencoded' - } - if (opts.headers) delete opts.headers['Content-Length'] - if (this.isSurge() || this.isLoon()) { - if (this.isSurge() && this.isNeedRewrite) { - opts.headers = opts.headers || {} - Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) - } - $httpClient.post(opts, (err, resp, body) => { - if (!err && resp) { - resp.body = body - resp.statusCode = resp.status - } - callback(err, resp, body) - }) - } else if (this.isQuanX()) { - opts.method = 'POST' - if (this.isNeedRewrite) { - opts.opts = opts.opts || {} - Object.assign(opts.opts, { hints: false }) - } - $task.fetch(opts).then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => callback(err) - ) - } else if (this.isNode()) { - this.initGotEnv(opts) - const { url, ..._opts } = opts - this.got.post(url, _opts).then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => { - const { message: error, response: resp } = err - callback(error, resp, resp && resp.body) - } - ) - } - } - /** - * - * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S') - * :$.time('yyyyMMddHHmmssS') - * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒 - * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符 - * @param {*} fmt 格式化参数 - * - */ - time(fmt) { - let o = { - 'M+': new Date().getMonth() + 1, - 'd+': new Date().getDate(), - 'H+': new Date().getHours(), - 'm+': new Date().getMinutes(), - 's+': new Date().getSeconds(), - 'q+': Math.floor((new Date().getMonth() + 3) / 3), - 'S': new Date().getMilliseconds() - } - if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length)) - for (let k in o) - if (new RegExp('(' + k + ')').test(fmt)) - fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) - return fmt - } - - /** - * 系统通知 - * - * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知 - * - * 示例: - * $.msg(title, subt, desc, 'twitter://') - * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) - * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) - * - * @param {*} title 标题 - * @param {*} subt 副标题 - * @param {*} desc 通知详情 - * @param {*} opts 通知参数 - * - */ - msg(title = name, subt = '', desc = '', opts) { - const toEnvOpts = (rawopts) => { - if (!rawopts) return rawopts - if (typeof rawopts === 'string') { - if (this.isLoon()) return rawopts - else if (this.isQuanX()) return { 'open-url': rawopts } - else if (this.isSurge()) return { url: rawopts } - else return undefined - } else if (typeof rawopts === 'object') { - if (this.isLoon()) { - let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url'] - let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] - return { openUrl, mediaUrl } - } else if (this.isQuanX()) { - let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl - let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl - return { 'open-url': openUrl, 'media-url': mediaUrl } - } else if (this.isSurge()) { - let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url'] - return { 'url': openUrl } - } - } else { - return undefined - } - } - if (!this.isMute) { - if (this.isSurge() || this.isLoon()) { - $notification.post(title, subt, desc, toEnvOpts(opts)) - } else if (this.isQuanX()) { - $notify(title, subt, desc, toEnvOpts(opts)) - } - } - let logs = ['', '==============📣系统通知📣=============='] - logs.push(title) - subt ? logs.push(subt) : '' - desc ? logs.push(desc) : '' - console.log(logs.join('\n')) - this.logs = this.logs.concat(logs) - } - - log(...logs) { - if (logs.length > 0) { - this.logs = [...this.logs, ...logs] - } - console.log(logs.join(this.logSeparator)) - } - - logErr(err, msg) { - const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon() - if (!isPrintSack) { - this.log('', `❗️${this.name}, 错误!`, err) - } else { - this.log('', `❗️${this.name}, 错误!`, err.stack) - } - } - - wait(time) { - return new Promise((resolve) => setTimeout(resolve, time)) - } - - done(val = {}) { - const endTime = new Date().getTime() - const costTime = (endTime - this.startTime) / 1000 - this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`) - this.log() - if (this.isSurge() || this.isQuanX() || this.isLoon()) { - $done(val) - } - } - })(name, opts) -} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From f3969e57309de21630441b96b2164e491c87cdae Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 21 Sep 2020 01:41:02 +0800 Subject: [PATCH 004/266] =?UTF-8?q?=E4=B8=AD=E9=9D=92=E7=9C=8B=E7=82=B9?= =?UTF-8?q?=E6=94=AF=E6=8C=81Github=20Actions=E5=A4=9A=E8=B4=A6=E5=8F=B7?= =?UTF-8?q?=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/Env.min.js | 1 + Task/youth.js | 126 +++++++++++++++++++++++++++++++----------------- 2 files changed, 84 insertions(+), 43 deletions(-) create mode 100644 Task/Env.min.js diff --git a/Task/Env.min.js b/Task/Env.min.js new file mode 100644 index 0000000000..5ddd120b1f --- /dev/null +++ b/Task/Env.min.js @@ -0,0 +1 @@ +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/youth.js b/Task/youth.js index eee5730586..ec137f10dc 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -14,10 +14,8 @@ 3.可随时获取Cookie. 4.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每10次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 5.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 -6.更新日志: - 31/05 v1.01 取消激励视频Cookie,添加阅读时长 - -阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续 +6.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续 +7. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ by Macsuny @@ -72,32 +70,85 @@ let notifyInterval = $.getdata("notifytimes")||50 //通知间隔,默认抽奖 const YOUTH_HOST = "https://kd.youth.cn/WebApi/"; const notify = $.isNode() ? require('./sendNotify') : ''; let logs = $.getdata('zqlogs')||false, signresult; -let signheaderVal = $.getdata('youthheader_zq'); -let timebodyVal = $.getdata('readtime_zq'); -let articlebodyVal = $.getdata('read_zq'); -let redpbodyVal = $.getdata('red_zq'); +let cookiesArr = [], signheaderVal = '', + readArr = [], articlebodyVal ='', + timeArr = [], timebodyVal = '', + redpArr = [], redpbodyVal = ''; +let CookieYouth = [ + '',//账号一ck + '',//账号二ck,如有更多,依次类推 +] , + ARTBODYs = ['', ''], + REDBODYs = ['', ''], + READTIME = ['', '']; +if ($.isNode()) { + if (process.env.YOUTH_HEADER && process.env.YOUTH_HEADER.split('#') && process.env.YOUTH_HEADER.split('#').length > 0) { + CookieYouth = process.env.YOUTH_HEADER.split('#'); + } + if (process.env.YOUTH_ARTBODY && process.env.YOUTH_ARTBODY.split('&') && process.env.YOUTH_ARTBODY.split('&').length > 0) { + ARTBODYs = process.env. YOUTH_ARTBODY.split('&'); + } + if (process.env.YOUTH_REDBODY && process.env.YOUTH_REDBODY.split('&') && process.env.YOUTH_REDBODY.split('&').length > 0) { + REDBODYs = process.env.YOUTH_REDBODY.split('&'); + } + if (process.env.YOUTH_TIME && process.env.YOUTH_TIME.split('&') && process.env.YOUTH_TIME.split('&').length > 0) { + READTIME = process.env.YOUTH_TIME.split('&'); + } +} + +if ($.isNode()) { + Object.keys(CookieYouth).forEach((item) => { + if (CookieYouth[item]) { + cookiesArr.push(CookieYouth[item]) + } + }) + Object.keys(ARTBODYs).forEach((item) => { + if (ARTBODYs[item]) { + readArr.push(ARTBODYs[item]) + } + }) + Object.keys(REDBODYs).forEach((item) => { + if (REDBODYs[item]) { + redpArr.push(REDBODYs[item]) + } + }) + Object.keys(READTIME).forEach((item) => { + if (READTIME[item]) { + timeArr.push(READTIME[item]) + } + }) + } else { + cookiesArr.push($.getdata('youthheader_zq')); + redpArr.push($.getdata('red_zq')); + readArr.push($.getdata('read_zq')); + timeArr.push($.getdata('readtime_zq')); +} + const firstcheck = $.getdata('signt'); const runtimes = $.getdata('times'); const opboxtime = $.getdata('opbox'); -if ($.isNode()) { - signheaderVal = process.env.YOUTH_HEADER; - articlebodyVal = process.env.YOUTH_ACTBODY; - redpbodyVal = process.env.YOUTH_REDBODY; - timebodyVal = process.env.YOUTH_TIME -} if (isGetCookie = typeof $request !== 'undefined') { GetCookie() } else { !(async () => { -if (!signheaderVal) { - return $.msg($.name, `请先获取Cookie`, ``) + if (!cookiesArr[0]) { + $.msg($.name, '【提示】请先获取中青看点一cookie') + return; + } + for (let i = 0; i < readArr.length; i++) { + if (cookiesArr[i]) { + signheaderVal = cookiesArr[i]; + articlebodyVal = readArr[i]; + timebodyVal = timeArr[i]; + redpbodyVal = redpArr[i]; + $.index = i + 1; + console.log(`\n开始【中青看点${$.index}】\n`) } await sign(); await signInfo(); - console.log("\n开始每日任务 ⛳️"); await Invitant(); if($.time('HH')>12){ await punchCard() @@ -114,7 +165,7 @@ if (boxres.code == 1){ } await getAdVideo(); await gameVideo(); -if(runtimes<8){ +if(runtimes<15){ await readArticle(); } await Articlered(); @@ -122,7 +173,8 @@ if(runtimes<8){ await rotary(); await rotaryCheck(); await earningsInfo(); - await showmsg() + await showmsg(); + } })() .catch((e) => $.logErr(e)) .finally(() => $.done()) @@ -169,7 +221,8 @@ function sign() { $.msg($.name, signresult, ""); return; } else if (signres.status == 1) { - detail = `【签到结果】成功 🎉 金币: +${signres.score},明日金币: +${signres.nextScore}\n` + signresult = `【签到结果】成功 🎉 明日+${signres.nextScore} ` + //detail = `【签到结果】成功 🎉 青豆: +${signres.score},明日青豆: +${signres.nextScore}\n` $.setdata(1,'times') if(firstcheck==undefined||firstcheck!=date){ $.setdata(date,'signt'); @@ -194,15 +247,13 @@ function signInfo() { headers: JSON.parse(signheaderVal), } $.post(infourl, (error, response, data) => { - signinfo = JSON.parse(data); - //console.log(signinfo) if (signinfo.status == 1) { cash = signinfo.data.user.money subTitle = `【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元`; nick = `账号: ${signinfo.data.user.nickname}`; - detail = `${signresult}(+${signinfo.data.sign_score}青豆) 已连签: ${signinfo.data.sign_day}天`; - $.log(subTitle+'\n'+detail) + detail = `${signresult}(今天+${signinfo.data.sign_score}青豆) 已连签${signinfo.data.sign_day}天`; + // $.log(subTitle+'\n'+detail) detail +='\n<本次收益>:\n' } else { subTitle = `${signinfo.msg}`; @@ -221,7 +272,6 @@ function punchCard() { headers: JSON.parse(signheaderVal), } $.post(url, (error, response, data) => { - //$.log(`每日开启打卡`); punchcardstart = JSON.parse(data); if (punchcardstart.code == 1) { detail += `【打卡报名】打卡报名${punchcardstart.msg} ✅ \n`; @@ -281,7 +331,6 @@ function Cardshare() { shareres = JSON.parse(data) if (shareres.code == 1) { detail += `+${shareres.data.score}青豆\n` - $.log(`【打卡分享】成功,获得`+shareres.data.score+"个青豆") } else { //detail += `【打卡分享】${shareres.msg}\n` //$.log(`${shareres.msg}`) @@ -308,7 +357,6 @@ function openbox() { boxretime = boxres.data.time $.setdata(boxretime, 'opbox') detail += `【开启宝箱】+${boxres.data.score}青豆 下次奖励${boxres.data.time / 60}分钟\n` - $.log(`开启时段宝箱成功,获得`+boxres.data.score+`个青豆,${boxretime / 60}`+"后开启下一个宝箱") }else{ //detail += `【开启宝箱】${boxres.msg}\n` // $.log(`${boxres.msg}`) @@ -332,7 +380,6 @@ function boxshare() { shareres = JSON.parse(data) if (shareres.code == 1) { detail += `【宝箱分享】+${shareres.data.score}青豆\n` - $.log(`分享宝箱任务成功,获得${shareres.data.score}青豆`) }else{ //detail += `【宝箱分享】${shareres.msg}\n` //$.log(`${shareres.msg}`) @@ -385,7 +432,6 @@ function getAdVideo() { adVideores = JSON.parse(data) if (adVideores.status == 1) { detail += `【观看视频】+${adVideores.score}个青豆\n` - $.log("获得"+adVideores.score+"个青豆") } resolve() }) @@ -402,7 +448,6 @@ function gameVideo() { gameres = JSON.parse(data) if (gameres.success == true) { detail += `【激励视频】${gameres.items.score}\n` - $.log("获得"+gameres.items.score) }else{ if(gameres.error_code == "10003"){ //detail += `【激励视频】${gameres.message}\n` @@ -423,13 +468,14 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); + $.log(data) if (readres.items.read_score !== undefined) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; - $.log("本次阅读获得"+readres.items.read_score+"个青豆") } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { //detail += `【阅读奖励】看太久了,换1篇试试\n`; - // $.log(readres.items.max_notice)} + // $.log(readres.items.max_notice)} + resolve() }) }) @@ -445,7 +491,6 @@ function Articlered() { redres = JSON.parse(data) if (redres.success == true) { detail += `【惊喜红包】+${redres.items.score}个青豆\n` - $.log("惊喜红包获得"+redres.items.score+"个青豆") }else{ if(redres.error_code == "100001"){ //detail += `【惊喜红包】${redres.message}\n` @@ -473,14 +518,12 @@ function rotary() { if (rotaryres.status == 1) { rotarytimes = rotaryres.data.remainTurn detail += `【转盘抽奖】+${rotaryres.data.score}个青豆 剩余${rotaryres.data.remainTurn}次\n` - $.log("转盘抽奖获得"+rotaryres.data.score+"个青豆,转盘次数还有"+rotarytimes+"次") if (rotaryres.data.doubleNum != 0) { await TurnDouble(); } } if (rotaryres.code == 10010) { rotarynum = ` 转盘${rotaryres.msg}🎉` - $.log("转盘任务已全部完成") } resolve(); }) @@ -519,7 +562,6 @@ function runRotary(index) { const rotaryresp = JSON.parse(data); if (rotaryresp.status == 1) { detail += `【转盘宝箱${index}】+${rotaryresp.data.score}个青豆\n`; - $.log("开启宝箱"+index+",获得"+rotaryresp.data.score+"个青豆") }else{ if(rotaryresp.code == "10010"){ detail += `【转盘宝箱${index}】+今日抽奖完成\n`; @@ -547,7 +589,6 @@ function TurnDouble() { Doubleres = JSON.parse(data) if (Doubleres.status == 1) { detail += `【转盘双倍】+${Doubleres.data.score1}青豆 剩余${rotaryres.data.doubleNum}次\n` - $.log(`转盘双倍奖励成功,获得${Doubleres.data.score1}青豆`) }else{ //detail += `【转盘双倍】失败 ${Doubleres.msg}\n` @@ -572,7 +613,6 @@ function readTime() { if (timeres.error_code == 0) { readtimes = timeres.time / 60 detail += `【阅读时长】共计` + Math.floor(readtimes) + `分钟\n` - $.log(`共计阅读时长为`+Math.floor(readtimes)+"分钟") } else { if (timeres.error_code == 200001) { detail += `【阅读时长】❎ 未获取阅读时长Cookie\n` @@ -608,11 +648,6 @@ function earningsInfo() { }) } async function showmsg() { - if ($.isNode()){ - if (cash >= 10&&rotaryres.code==10010) { - await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) - } - } console.log('-----------'+'\n'+$.name+`\n【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) if (rotaryres.status == 1 && rotarytimes >= 97) { $.msg($.name + " " + nick, subTitle, detail) //默认前三次为通知 @@ -622,6 +657,11 @@ function earningsInfo() { rotarynum = ` 转盘${rotaryres.msg}🎉` $.msg($.name+" "+nick+" "+rotarynum,subTitle,detail)//任务全部完成且通知间隔不为0时通知; } + if ($.isNode()){ + if (cash >= 10&&rotaryres.code==10010) { + await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) + } + } } function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From 4aaf9b3ea5e25618c5522e249999899ebda158d8 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 21 Sep 2020 09:26:59 +0800 Subject: [PATCH 005/266] test --- .github/workflows/youth.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index a746197848..296b8552c1 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -4,11 +4,11 @@ name: youth on: - push: - branches: - - master + #push: + #branches: + #- master schedule: - - cron: '*/5 16-22 * * *' + - cron: '*/5 3-9 * * *' watch: types: started From 5f947cb89c14b5e48ed0d47506ab9c3e42648e27 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 21 Sep 2020 19:20:55 +0800 Subject: [PATCH 006/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Actions=20=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=BC=80=E5=85=B3=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=BC=80?= =?UTF-8?q?=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/jingxi.yml | 5 +---- .github/workflows/txnews.yml | 5 ++--- .github/workflows/youth.yml | 5 ++--- Task/sendNotify.js | 27 ++++++++++++++++----------- Task/youth.js | 3 +++ 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/.github/workflows/jingxi.yml b/.github/workflows/jingxi.yml index c84eaf63eb..d86821db32 100644 --- a/.github/workflows/jingxi.yml +++ b/.github/workflows/jingxi.yml @@ -2,15 +2,12 @@ name: jingxi on: - #push: - #branches: - #- master + workflow_dispatch: schedule: - cron: '5 23 * * *' watch: types: started jobs: - build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index 9c611dd79e..7b89d5c316 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -7,9 +7,7 @@ name: txnews on: - #push: - #branches: - #- master + workflow_dispatch: schedule: - cron: '*/7 1-14 * * *' watch: @@ -37,6 +35,7 @@ jobs: videoVal: ${{ secrets.TXNEWS_VIDEO }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} + TXNEWS_NOTIFY_CONTROL: ${{ secrets.TXNEWS_NOTIFY_CONTROL }} TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} TG_USER_ID: ${{ secrets.TG_USER_ID }} BARK_SOUND: ${{ secrets.BARK_SOUND }} diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index 296b8552c1..d3df230145 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -4,9 +4,7 @@ name: youth on: - #push: - #branches: - #- master + workflow_dispatch: schedule: - cron: '*/5 3-9 * * *' watch: @@ -33,6 +31,7 @@ jobs: YOUTH_ARTBODY: ${{ secrets.YOUTH_ARTBODY }} YOUTH_REDBODY: ${{ secrets.YOUTH_REDBODY }} YOUTH_TIME: ${{ secrets.YOUTH_TIME }} + YOUTH_NOTIFY_CONTROL: ${{ secrets.YOUTH_NOTIFY_CONTROL }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 71883a75ed..4d363a717d 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -1,3 +1,5 @@ +// 感谢lxk0301大佬,本代码根据@lxk0301大佬编写的代码及教程修改 + const $ = new Env(); //此处填你申请的SCKEY. //注:此处设置github action用户填写到Settings-Secrets里面(Name输入PUSH_KEY) @@ -18,12 +20,10 @@ let TG_BOT_TOKEN = ''; let TG_USER_ID = ''; //运行农场脚本是否静默运行(即:不推送通知),false打开通知推送,true关闭通知推送 -//注:此处设置github action用户填写到Settings-Secrets里面(Name输入 FRUIT_NOTIFY_CONTROL , Value填写true或者false) -let fruitNotifyControl = false;//(默认农场脚本推送通知) -//运行萌宠脚本是否静默运行(即:不推送通知),false打开通知推送,true关闭通知推送 -//注:此处设置github action用户填写到Settings-Secrets里面(Name输入 PET_NOTIFY_CONTROL , Value填写true或者false) -let petNotifyControl = false;//(默认萌宠脚本推送通知) +let txnewsNotifyControl = false;//(默认腾讯新闻脚本推送通知) + +let youthNotifyControl = false;//(默认中青脚本推送通知) if (process.env.PUSH_KEY) { SCKEY = process.env.PUSH_KEY; @@ -38,6 +38,11 @@ if (process.env.BARK_PUSH) { if (process.env.BARK_SOUND) { BARK_SOUND = process.env.BARK_SOUND } +} else { + if(BARK_PUSH.indexOf('https') === -1 && BARK_PUSH.indexOf('http') === -1) { + //兼容BARK自建用户 + BARK_PUSH = `https://api.day.app/${BARK_PUSH}` + } } if (process.env.TG_BOT_TOKEN) { TG_BOT_TOKEN = process.env.TG_BOT_TOKEN; @@ -46,11 +51,11 @@ if (process.env.TG_USER_ID) { TG_USER_ID = process.env.TG_USER_ID; } -if (process.env.FRUIT_NOTIFY_CONTROL) { - fruitNotifyControl = process.env.FRUIT_NOTIFY_CONTROL; +if (process.env.YOUTH_NOTIFY_CONTROL) { + youthNotifyControl = process.env.YOUTH_NOTIFY_CONTROL; } -if (process.env.PET_NOTIFY_CONTROL) { - petNotifyControl = process.env.PET_NOTIFY_CONTROL; +if (process.env.TXNEWS_NOTIFY_CONTROL) { + txnewsNotifyControl = process.env.TXNEWS_NOTIFY_CONTROL; } async function sendNotify(text, desp) { //提供三种通知 @@ -170,8 +175,8 @@ module.exports = { BARK_PUSH, TG_BOT_TOKEN, TG_USER_ID, - fruitNotifyControl, - petNotifyControl + txnewsNotifyControl, + youthNotifyControl } // prettier-ignore function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file diff --git a/Task/youth.js b/Task/youth.js index ec137f10dc..0228755960 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -117,6 +117,9 @@ if ($.isNode()) { timeArr.push(READTIME[item]) } }) + console.log(`\n============脚本执行来自 github action==============\n`) + console.log(`============脚本执行-国际标准时间(UTC):${new Date().toLocaleString()}=============\n`) + console.log(`===========脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}===============\n`) } else { cookiesArr.push($.getdata('youthheader_zq')); redpArr.push($.getdata('red_zq')); From 984e775f7cefba36515c2bd5ce58a2df1f56fbc8 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 21 Sep 2020 19:30:48 +0800 Subject: [PATCH 007/266] updates --- Task/txnews.js | 7 +++++-- Task/youth.js | 7 +++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index 0643c6d904..3ad683d70e 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -50,7 +50,6 @@ let s = Number($.getdata('delay'))||200 // 间隔延迟时间 let notifyInterval =$.getdata('notifynum')||50; //阅读篇数间隔通知开为1,常关为0; const TX_HOST = 'https://api.inews.qq.com/activity/v1/' - let signurlVal = $.getdata('sy_signurl_txnews') let cookieVal = $.getdata( 'sy_cookie_txnews') let videoVal = $.getdata( 'video_txnews') @@ -66,12 +65,16 @@ if (isGetCookie) { GetCookie() } else { !(async () => { - if(!signurlVal && !cookieVal){ $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}) await notify.sendNotify($.name, '【提示】请先获取腾讯新闻一Cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); return; } + if ($.isNode()){ + console.log(`\n============ 脚本执行来自 Github Action ==============\n`) + console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) + } token = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0] console.log("\n开始获取您的活动ID"); await getsign(); diff --git a/Task/youth.js b/Task/youth.js index 0228755960..cf7acf96ce 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -117,9 +117,9 @@ if ($.isNode()) { timeArr.push(READTIME[item]) } }) - console.log(`\n============脚本执行来自 github action==============\n`) - console.log(`============脚本执行-国际标准时间(UTC):${new Date().toLocaleString()}=============\n`) - console.log(`===========脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}===============\n`) + console.log(`\n============ 脚本执行来自 Github Action ==============\n`) + console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) } else { cookiesArr.push($.getdata('youthheader_zq')); redpArr.push($.getdata('red_zq')); @@ -127,7 +127,6 @@ if ($.isNode()) { timeArr.push($.getdata('readtime_zq')); } - const firstcheck = $.getdata('signt'); const runtimes = $.getdata('times'); const opboxtime = $.getdata('opbox'); From c8e55441fcfc553654c469cfc3fd8670b8921c15 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 21 Sep 2020 19:56:50 +0800 Subject: [PATCH 008/266] --- Task/txnews.js | 4 ++-- Task/youth.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index 3ad683d70e..688f440fa1 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -76,7 +76,7 @@ if (isGetCookie) { console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) } token = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0] - console.log("\n开始获取您的活动ID"); + console.log("----------------\n开始获取您的活动ID"); await getsign(); await activity(); await toRead(); @@ -285,7 +285,7 @@ function showmsg() { if(readnum||videonum){ detail = signinfo + `【文章阅读】已读/再读: `+ readnum +`/`+readtitle+` 篇\n`+`【阅读红包】已开/总计: `+openreadred+`/`+readredtotal+` 个🧧\n`+ `【观看视频】已看/再看: `+ videonum +`/`+videotitle+` 分钟\n`+`【视频红包】已开/总计: `+openvideored+`/`+videoredtotal+` 个🧧\n【每日一句】`+Dictum } - console.log('-----------'+'\n'+$.name+'\n'+subTile+'\n'+ detail) + console.log('\n'+$.name+'\n'+subTile+'\n'+ detail) if (readnum%notifyInterval==0){ $.msg($.name,subTile,detail,{ 'open-url': "https://news.qq.com/FERD/cjRedDown.htm", 'media-url': imgurl } ) } diff --git a/Task/youth.js b/Task/youth.js index cf7acf96ce..8f6454961e 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -147,7 +147,7 @@ if (isGetCookie = typeof $request !== 'undefined') { timebodyVal = timeArr[i]; redpbodyVal = redpArr[i]; $.index = i + 1; - console.log(`\n开始【中青看点${$.index}】\n`) + console.log(`---------------------\n开始【中青看点${$.index}】\n`) } await sign(); await signInfo(); @@ -650,7 +650,7 @@ function earningsInfo() { }) } async function showmsg() { - console.log('-----------'+'\n'+$.name+`\n【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) + console.log('\n'+$.name+`\n【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) if (rotaryres.status == 1 && rotarytimes >= 97) { $.msg($.name + " " + nick, subTitle, detail) //默认前三次为通知 }else if (rotaryres.status == 1 && rotarytimes % notifyInterval == 0) { From 537cc4b82757ff775b42ed1c9a94c602af0d0cee Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 21 Sep 2020 20:03:50 +0800 Subject: [PATCH 009/266] --- Task/txnews.js | 4 ++-- Task/youth.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index 688f440fa1..d581488125 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -76,7 +76,7 @@ if (isGetCookie) { console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) } token = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0] - console.log("----------------\n开始获取您的活动ID"); + console.log("-----------------------------\n\n开始获取您的活动ID"); await getsign(); await activity(); await toRead(); @@ -285,7 +285,7 @@ function showmsg() { if(readnum||videonum){ detail = signinfo + `【文章阅读】已读/再读: `+ readnum +`/`+readtitle+` 篇\n`+`【阅读红包】已开/总计: `+openreadred+`/`+readredtotal+` 个🧧\n`+ `【观看视频】已看/再看: `+ videonum +`/`+videotitle+` 分钟\n`+`【视频红包】已开/总计: `+openvideored+`/`+videoredtotal+` 个🧧\n【每日一句】`+Dictum } - console.log('\n'+$.name+'\n'+subTile+'\n'+ detail) + console.log($.name+'\n'+subTile+'\n'+ detail) if (readnum%notifyInterval==0){ $.msg($.name,subTile,detail,{ 'open-url': "https://news.qq.com/FERD/cjRedDown.htm", 'media-url': imgurl } ) } diff --git a/Task/youth.js b/Task/youth.js index 8f6454961e..5345879ef0 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -147,7 +147,7 @@ if (isGetCookie = typeof $request !== 'undefined') { timebodyVal = timeArr[i]; redpbodyVal = redpArr[i]; $.index = i + 1; - console.log(`---------------------\n开始【中青看点${$.index}】\n`) + console.log(`-------------------------\n\n开始【中青看点${$.index}】`) } await sign(); await signInfo(); @@ -650,7 +650,7 @@ function earningsInfo() { }) } async function showmsg() { - console.log('\n'+$.name+`\n【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) + console.log(`\n【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) if (rotaryres.status == 1 && rotarytimes >= 97) { $.msg($.name + " " + nick, subTitle, detail) //默认前三次为通知 }else if (rotaryres.status == 1 && rotarytimes % notifyInterval == 0) { From 78e826dab011bbcd64a9d38f600d94db08f35771 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 12:53:26 +0800 Subject: [PATCH 010/266] test --- Task/dianshijia.js | 208 ++++++++++----------------------------------- 1 file changed, 46 insertions(+), 162 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 3c904529cd..7e55942b30 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -2,18 +2,13 @@ /* 更新时间: 2020-09-08 11:21 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 - 本脚本仅适用于电视家签到, 获取Cookie方法: 1.将下方[rewrite_local]和[Task]地址复制的相应的区域,无需添加 hostname,每日7点、12点、20点各运行一次,其他随意 2.APP登陆账号后,点击菜单栏'领现金',即可获取Cookie,进入提现页面,点击随机金额,可获取提现地址!! - 3.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 - By Facsuny 感谢 chavyleung 等 - -赞赏:电视家邀请码`893988` ~~~~~~~~~~~~~~~~~~~~ loon 2.10+ : [Script] @@ -31,7 +26,6 @@ Surge 4.0 电视家 = type=http-request,pattern=http:\/\/api\.gaoqingdianshi\.com\/api\/v\d\/sign\/signin,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/dianshijia.js 电视家 = type=http-request,pattern=http:\/\/api\.gaoqingdianshi\.com\/api\/v2\/cash\/withdrawal,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/dianshijia.js - ~~~~~~~~~~~~~~~~~~ QX 1.0.6+ : @@ -42,7 +36,6 @@ QX 1.0.6+ : http:\/\/api\.gaoqingdianshi\.com\/api\/v\d\/sign\/signin url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/dianshijia.js http:\/\/api\.gaoqingdianshi\.com\/api\/v2\/cash\/withdrawal url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/dianshijia.js - ~~~~~~~~~~~~~~~~~ */ @@ -52,6 +45,7 @@ const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') const signheaderVal = $.getdata('sy_signheader_dsj') const drawalVal = $.getdata('drawal_dsj') +const dianshijia_API = 'http://api.gaoqingdianshi.com/api' if (isGetCookie = typeof $request !== 'undefined') { GetCookie() @@ -62,7 +56,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await signinfo(); // 签到信息 await Withdrawal(); // 金额提现 //await Withdrawal2();// 固定金额 - await taskStatus(); // 任务状态 + await tasks(); // 任务状态 await getGametime();// 游戏时长 await total(); // 总计 await cash(); // 现金 @@ -78,7 +72,7 @@ function GetCookie() { const signheaderVal = JSON.stringify($request.headers) $.log(`signurlVal:${signurlVal}`) $.log(`signheaderVal:${signheaderVal}`) - if (signurlVal) $.setdata(signurlVal, 'sy_signurl_dsj') + if(signurlVal) $.setdata(signurlVal, 'sy_signurl_dsj') if (signheaderVal) $.setdata(signheaderVal, 'sy_signheader_dsj') $.msg($.name, `获取Cookie: 成功`, ``) } @@ -94,7 +88,7 @@ function GetCookie() { var date = new Date(); var hour = date.getHours(); var sleeping = ""; - if (hour>19){ + if (hour>17){ sleep(); CarveUp(); } @@ -110,8 +104,7 @@ function GetCookie() { function signin() { return new Promise((resolve, reject) => { - const url = { url: $.getdata('sy_signurl_dsj'), headers: JSON.parse(signheaderVal)} - $.get(url, (error, response, data) => + $.get({url: $.getdata('sy_signurl_dsj'), headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`${$.name}, 签到结果: ${data}\n`) const result = JSON.parse(data) @@ -140,10 +133,9 @@ function signin() { function signinfo() { return new Promise((resolve, reject) => { - let awardurl = { url: `http://act.gaoqingdianshi.com/api/v4/sign/get`, headers: JSON.parse(signheaderVal)} - $.get(awardurl, (error, response, data) => + $.get({ url: `${dianshijia_API}/v4/sign/get`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - if(logs)$.log(`${$.name}, 签到信息: ${data}\n`) + if(logs)$.log(`${$.name}, 签到信息: ${data}\n`) const result = JSON.parse(data) if (result.errCode == 0) { @@ -151,7 +143,7 @@ function signinfo() { for (i=0; i < result.data.recentDays.length;i++) { if (d == result.data.recentDays[i].day) - { detail += ` 连续签到${d}天\n` + {detail += ` 连续签到${d}天\n` var j = result.data.recentDays[i].rewards.length if (j > 1){ detail += `【奖励信息】今日:${result.data.recentDays[i].rewards[1].name} ` @@ -179,10 +171,7 @@ function signinfo() { function total() { return new Promise((resolve, reject) => { - const coinurl = { url: `http://api.gaoqingdianshi.com/api/coin/info`, - headers: JSON.parse(signheaderVal) - } - $.get(coinurl, (error, response, data) => { + $.get({url: `${dianshijia_API}/coin/info`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`${$.name}, 总计: ${data}\n`) const result = JSON.parse(data) subTitle = `待兑换金币: ${result.data.coin} ` @@ -190,10 +179,7 @@ function total() { if(result.data.tempCoin){ for (i=0;i { - let url = { url: `http://api.gaoqingdianshi.com/api/cash/info`, headers: JSON.parse(signheaderVal)} - $.get(url, (error, response, data) => + $.get({ url: `${dianshijia_API}/cash/info`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`现金: ${data}\n`) const cashresult = JSON.parse(data) subTitle += '现金:'+ cashresult.data.amount/100+'元 额度:'+cashresult.data.withdrawalQuota/100+'元' - cashtotal = cashresult.data.totalWithdrawn/100 + cashtotal = cashresult.data.totalWithdrawn/100 resolve() }) }) } function cashlist() { return new Promise((resolve, reject) => { - let url = { - url: `http://api.gaoqingdianshi.com/api/cash/detail`, - headers: JSON.parse(signheaderVal), - } - $.get(url, (error, response, data) => { + $.get({ url: `${dianshijia_API}/cash/detail`, + headers: JSON.parse(signheaderVal)}, (error, response, data) => { //if(logs)$.log(`提现列表: ${data}`) const result = JSON.parse(data) totalcash = Number() @@ -233,7 +215,6 @@ function cashlist() { (result.data[i].type==2&&result.data[i].ctime>=time){ cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } - } if(cashres&&cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` @@ -246,74 +227,43 @@ function cashlist() { }) }) } -function taskStatus() { - return new Promise((resolve, reject) => { - shareurl = { url: `http://act.gaoqingdianshi.com/api/v2/task/get`, headers: JSON.parse(signheaderVal)} - $.get(shareurl, (error, response, data) => { - if(logs)$.log(`${$.name},任务状态: ${data}\n`) - let result = JSON.parse(data) - if (result.errCode == 0){ - for -(i=0;i { + let taskcode = ['1M005','1M002','playTask','SpWatchVideo','Mobilewatchvideo','MutilPlatformActive'] + for(code of taskcode){ + await dotask(code) } - resolve() - }) + resolve() }) } - -function share() { - return new Promise((resolve, reject) => { - shareurl = { url: `http://api.gaoqingdianshi.com/api/v4/task/complete?code=1M005`, headers: JSON.parse(signheaderVal)} - $.get(shareurl, (error, response, data) => { - if(logs)$.log(`${$.name}, 分享: ${data}\n`) - }) - shareurl2 = { url: `http://m3.g$xvip.com/activity/f/transfer?uid=&inviteCode=&type=mInvite&yrwe=1&code=0216Jaqu1LRHOh0AMjru1ZYgqu16Jaqy&state=code`, headers: JSON.parse(signheaderVal),} - $.get(shareurl2, (error, response, data) => { - }) -resolve() - }) -} - -function mobileOnline() { - return new Promise((resolve, reject) => { - shareurl = { url: `http://act.gaoqingdianshi.com/api/v4/task/complete?code=1M002`, headers: JSON.parse(signheaderVal)} - $.get(shareurl, (error, response, data) => { - if(logs)$.log(`${$.name}, 手机在线: ${data}\n`) +function dotask(code) { + return new Promise((resolve, reject) => { + $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { + taskres= JSON.parse(data) + if (taskres.errCode==0){ + console.log('任务代码:'+code+',获得金币:'+taskres.data.getCoin) + if (code== 'playTask'&&taskres.data.doneStatus == 3) { + detail += `【播放任务】🔕 完成/共计 `+taskres.data.dayCompCount+`/`+taskres.data.dayDoCountMax+` 次\n` + } + } + if (taskres.errCode==4000){ + //console.log('任务代码:'+code+','+taskres.msg) + } }) -resolve() + resolve() }) } - function walk() { return new Promise((resolve, reject) => { - let url = { url: `http://act.gaoqingdianshi.com/api/taskext/getWalk?step=${walkstep}`, headers: JSON.parse(signheaderVal)} + let url = { url: `${dianshijia_API}/taskext/getWalk?step=${walkstep}`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { if(logs)$.log(`走路任务: ${data}\n`) const result = JSON.parse(data) walkcoin = result.data.unGetCoin if (walkcoin>10){ -let url = { url: `http://act.gaoqingdianshi.com/api/taskext/getCoin?code=walk&coin=${walkcoin}&ext=1`, headers: JSON.parse(signheaderVal)} - $.get(url, (error, response, data) => + $.get({ url: `${dianshijia_API}/taskext/getCoin?code=walk&coin=${walkcoin}&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { }) } @@ -324,7 +274,7 @@ let url = { url: `http://act.gaoqingdianshi.com/api/taskext/getCoin?code=walk&co function sleep() { return new Promise((resolve, reject) => { - let url = { url: `http://act.gaoqingdianshi.com/api/taskext/getSleep?ext=1`, headers: JSON.parse(signheaderVal)} + let url = { url: `${dianshijia_API}/taskext/getSleep?ext=1`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { try { if(logs)$.log(`睡觉任务: ${data}\n`) @@ -341,14 +291,14 @@ else { } catch (e) { $.msg($.name, `睡觉结果: 失败`, `说明: ${e}`)} -resolve() + resolve() }) }) } function wakeup() { return new Promise((resolve, reject) => { - let url = { url: `http://act.gaoqingdianshi.com/api/taskext/getCoin?code=sleep&coin=1910&ext=1`, + let url = { url: `${dianshijia_API}/taskext/getCoin?code=sleep&coin=1910&ext=1`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { if(logs)$.log(`睡觉打卡: ${data}\n`) @@ -357,41 +307,10 @@ resolve() }) } -function SpWatchVideo() { - return new Promise((resolve, reject) => { - let url = { url: `http://act.gaoqingdianshi.com/api/v4/task/complete?code=SpWatchVideo`, - headers: JSON.parse(signheaderVal)} - $.get(url, (error, response, data) => { - if(logs)$.log(`激励视频: ${data}\n`) - }) -resolve() - }) -} - -function watchvideo() { - return new Promise((resolve, reject) => { - let url = { url: `http://act.gaoqingdianshi.com/api/v4/task/complete?code=Mobilewatchvideo`, - headers: JSON.parse(signheaderVal)} - $.get(url, (error, response, data) => { - if(logs)$.log(`激励视频: ${data}\n`) - }) -resolve() - }) -} - -function double() { - return new Promise((resolve, reject) => { - let url = { url: `http://act.gaoqingdianshi.com/api/v4/task/complete?code=MutilPlatformActive`, headers: JSON.parse(signheaderVal)} - $.get(url, (error, response, data) => { - if(logs)$.log(`双端活跃 data: ${data}\n`) - }) -resolve() - }) -} function coinlist() { return new Promise((resolve, reject) => { - let url = { url: `http://api.gaoqingdianshi.com/api/coin/detail`, + let url = { url: `${dianshijia_API}/coin/detail`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { //$.log(`金币列表: ${data}`) @@ -455,11 +374,11 @@ if(gamestime){ function CarveUp() { return new Promise((resolve, reject) => { let url = { - url: `http://api.gaoqingdianshi.com/api/v2/taskext/getCarveUp?ext=1`, + url: `${dianshijia_API}/v2/taskext/getCarveUp?ext=1`, headers: JSON.parse(signheaderVal), } $.get(url, (error, response, data) => { - if(logs)$.log(`瓜分百万金币: ${data}`) + $.log(`瓜分百万金币: ${data}`) const result = JSON.parse(data) if (result.errCode == 0) { detail += `【金币瓜分】✅ 报名成功\n` @@ -471,17 +390,15 @@ resolve() function getCUpcoin() { return new Promise((resolve, reject) => { let url = { - url: `http://act.gaoqingdianshi.com/api/taskext/getCoin?code=carveUp&coin=0&ext=1`, + url: `${dianshijia_API}/taskext/getCoin?code=carveUp&coin=0&ext=1`, headers: JSON.parse(signheaderVal), } $.get(url, (error, response, data) => { - if(logs)$.log(`瓜分百万金币: ${data}`) + if(logs) $.log(`瓜分百万金币: ${data}`) }) -resolve() + resolve() }) } - - function Withdrawal() { return new Promise((resolve, reject) => { if (drawalVal !=undefined||null){ @@ -504,43 +421,10 @@ else { resolve() }) } -//暂未使用 -function Withdrawal2() { - return new Promise((resolve, reject) => { - let url = { - url: `http://api.gaoqingdianshi.com/api/v2/cash/withdrawal?code=tx000041&`, - headers: JSON.parse(signheaderVal), - } - $.get(url, (error, response, data) => { - $.log(`金额兑换 : ${data}\n`) - const result = JSON.parse(data) - if (result.errCode == 0) { - detail += `【金额提现】✅ `+result.data.price/100+`元 🌷\n` - } - resolve() - }) - }) -} -function playTask() { - return new Promise((resolve, reject) => { - let url = { - url: `http://act.gaoqingdianshi.com/api/v4/task/complete?code=playTask`, - headers: JSON.parse(signheaderVal), - } - $.get(url, (error, response, data) => { - if(logs)$.log(`播放任务: ${data}\n`) - const result = JSON.parse(data) - if (result.errCode==0&&result.data.doneStatus == 3) { - detail += `【播放任务】🔕 完成/共计 `+result.data.dayCompCount+`/`+result.data.dayDoCountMax+` 次\n` - } - }) -resolve() - }) -} function getGametime() { return new Promise((resolve, reject) => { let url = { - url: `http://act.gaoqingdianshi.com/api/v4/task/complete?code=gameTime&time=${gametimes}`, + url: `${dianshijia_API}/v4/task/complete?code=gameTime&time=${gametimes}`, headers: JSON.parse(signheaderVal), } $.get(url, (error, response, data) => { From 62873232a3d9275d4412f910677182e082ad1d8d Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 14:19:41 +0800 Subject: [PATCH 011/266] --- Task/tvpreview.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/tvpreview.js b/Task/tvpreview.js index e26cfc0580..66b7ce7d21 100644 --- a/Task/tvpreview.js +++ b/Task/tvpreview.js @@ -1,5 +1,5 @@ /* -本脚本为电视节目预告 兼容chavyleung大佬的boxjs订阅优先生效 +本脚本为电视节目预告 兼容chavyleung大佬的boxjs订阅优先生效,图片非实时直播图片 本仓库boxjs订阅地址: https://raw.githubusercontent.com/Sunert/Scripts/master/Task/sunert.boxjs.json 1.数据从电视家数据库获取 @@ -85,7 +85,7 @@ const wurl = { $.subTitle = `即将播出: ${result[`${tvnum}`].program[i+1].t}` +duration } } - $.msg($.title, $.subTitle, $.detail) + $.msg($.title, $.subTitle, $.detail,{'media-url':`http://cdn.dianshihome.com/static/channel/poster/${tvnum}.jpg`}) resolve() } catch(err) { From 6713f9151a083e244928306d42f043333060f58b Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 15:18:53 +0800 Subject: [PATCH 012/266] --- .github/workflows/youth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index d3df230145..2a31650081 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -6,7 +6,7 @@ name: youth on: workflow_dispatch: schedule: - - cron: '*/5 3-9 * * *' + - cron: '*/5 3-22/2 * * *' watch: types: started From aedd4df34e8023093057ac206802409ff968b76a Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 23:23:46 +0800 Subject: [PATCH 013/266] updata youth.js --- Task/youth.js | 173 +++++++++++++++++++------------------------------- 1 file changed, 66 insertions(+), 107 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index 5345879ef0..8932fc3d6e 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -1,23 +1,20 @@ /* -更新时间: 2020-09-19 22:15 - +更新时间: 2020-09-22 22:15 赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 - 本脚本仅适用于中青看点极速版领取青豆 -增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共3条Cookie,请全部获取,获取请注释掉 - 获取Cookie方法: 1.将下方[rewrite_local]和[MITM]地址复制的相应的区域 -下, -2.进入app,进入任务中心或者签到一次,即可获取Cookie. 阅读一篇文章,获取阅读请求body,并获取阅读时长,在阅读文章最下面有个惊喜红包,点击获取惊喜红包请求 -3.可随时获取Cookie. -4.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每10次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 -5.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 -6.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续 -7. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ - -by Macsuny +下,运行时间自行配置 +2. 获取Cookie方法,可随时更新 + ① 进入app,进入任务中心或者签到一次,即可获取Cookie. + ② 阅读一篇文章,获取阅读请求body, + ③ 同时获取阅读时长, + ④ 在阅读文章最下面有个惊喜红包,点击获取惊喜红包请求 +3.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每50次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 +4.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 +5.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续,增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共4条Cookie,请全部获取,获取请注释 +6. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ ~~~~~~~~~~~~~~~~ Surge 4.0 : @@ -64,7 +61,7 @@ hostname = *.youth.cn, ios.baertt.com */ -let s = 0 //各数据接口延迟 +let s = 200 //各数据接口延迟 const $ = new Env("中青看点") let notifyInterval = $.getdata("notifytimes")||50 //通知间隔,默认抽奖每50次通知一次,如需关闭全部通知请设为0 const YOUTH_HOST = "https://kd.youth.cn/WebApi/"; @@ -131,7 +128,6 @@ const firstcheck = $.getdata('signt'); const runtimes = $.getdata('times'); const opboxtime = $.getdata('opbox'); - if (isGetCookie = typeof $request !== 'undefined') { GetCookie() } else { @@ -157,19 +153,11 @@ if($.time('HH')>12){ }; if($.time('HH')<9&&$.time('HH')>4){ await endCard(); - if(punchcardend.code==1){ - await Cardshare() - } }; await openbox(); -if (boxres.code == 1){ - await boxshare(); - } await getAdVideo(); await gameVideo(); -if(runtimes<15){ await readArticle(); -} await Articlered(); await readTime(); await rotary(); @@ -235,7 +223,6 @@ function sign() { if(runtimes!==undefined){ $.setdata(`${Number(runtimes)+1}`,'times') } - } resolve() }) @@ -255,8 +242,7 @@ function signInfo() { subTitle = `【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元`; nick = `账号: ${signinfo.data.user.nickname}`; detail = `${signresult}(今天+${signinfo.data.sign_score}青豆) 已连签${signinfo.data.sign_day}天`; - // $.log(subTitle+'\n'+detail) - detail +='\n<本次收益>:\n' + detail +='\n<本次收益>:\n' } else { subTitle = `${signinfo.msg}`; detail = ``; @@ -296,11 +282,12 @@ function endCard() { const url = { url: `${YOUTH_HOST}PunchCard/doCard?`,headers: JSON.parse(signheaderVal), } - $.post(url, (error, response, data) => { + $.post(url,async(error, response, data) => { punchcardend = JSON.parse(data) if (punchcardend.code == 1) { detail += `【早起打卡】${punchcardend.data.card_time}${punchcardend.msg}✅\n` $.log("早起打卡成功,打卡时间:"+`${punchcardend.data.card_time}`) + await Cardshare(); } else if (punchcardend.code == 0) { // TODO .不在打卡时间范围内 //detail += `【早起打卡】${punchcardend.msg}\n` @@ -311,8 +298,6 @@ function endCard() { },s) }) } - - //打卡分享 function Cardshare() { return new Promise((resolve, reject) => { @@ -353,12 +338,13 @@ function openbox() { url: `${YOUTH_HOST}invite/openHourRed`, headers: JSON.parse(signheaderVal), } - $.post(url, (error, response, data) => { + $.post(url, async(error, response, data) => { boxres = JSON.parse(data) if (boxres.code == 1) { boxretime = boxres.data.time $.setdata(boxretime, 'opbox') detail += `【开启宝箱】+${boxres.data.score}青豆 下次奖励${boxres.data.time / 60}分钟\n` + await boxshare(); }else{ //detail += `【开启宝箱】${boxres.msg}\n` // $.log(`${boxres.msg}`) @@ -394,34 +380,15 @@ function boxshare() { function Invitant() { return new Promise((resolve, reject) => { - const url = { - url: `${YOUTH_HOST}User/fillCode`, - headers: JSON.parse(signheaderVal), - body: `{"code": "46308484"}`, -} - $.post(url, (error, response, data) => + $.post({ url: `${YOUTH_HOST}User/fillCode`,headers: JSON.parse(signheaderVal),body: `{"code": "46308484"}` +}, (error, response, data) => { // $.log(`Invitdata:${data}`) - }) - aticleshare() + }) resolve() }) } -function aticleshare() { - return new Promise((resolve, reject) => { - //const rand = Math.random().toFixed(3).toString().substr(2).replace("0", "7"); - shareurl = { - url: `https://kandian.youth.cn/u/CMB8o`, - headers: { Cookie: JSON.parse(signheaderVal)['Cookie'] }, - } - $.get(shareurl, (error, response, data) => { - // $.log(`aticleshare:${data}`); - resolve(); - }) - }) -} - //看视频奖励 function getAdVideo() { return new Promise((resolve, reject) => { @@ -469,9 +436,8 @@ function readArticle() { body: articlebodyVal, } $.post(url, (error, response, data) => { - readres = JSON.parse(data); - $.log(data) - if (readres.items.read_score !== undefined) { + readres = JSON.parse(data); + if (readres.items.read_score !== 0 &&readres.items.read_score !== undefined ) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { @@ -502,6 +468,34 @@ function Articlered() { }) }) } + +function readTime() { + return new Promise((resolve, reject) => { + const url = { + url: `https://ios.baertt.com/v5/user/stay.json`, + headers: { + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + }, + body: timebodyVal, + } + $.post(url, (error, response, data) => { + let timeres = JSON.parse(data) + if (timeres.error_code == 0) { + readtimes = timeres.time / 60 + detail += `【阅读时长】共计` + Math.floor(readtimes) + `分钟\n` + } else { + if (timeres.error_code == 200001) { + detail += `【阅读时长】❎ 未获取阅读时长Cookie\n` + }else{ + detail += `【阅读时长】❎ ${timeres.msg}\n` + $.log(`阅读时长统计失败,原因:${timeres.msg}`) + } + } + resolve() + }) + }) +} + //转盘任务 function rotary() { const rotarbody = signheaderVal.split("&")[15] + '&' + signheaderVal.split("&")[8] @@ -514,9 +508,7 @@ function rotary() { body: rotarbody } $.post(url,async (error, response, data) => { - rotaryres = JSON.parse(data) - if (rotaryres.status == 1) { rotarytimes = rotaryres.data.remainTurn detail += `【转盘抽奖】+${rotaryres.data.score}个青豆 剩余${rotaryres.data.remainTurn}次\n` @@ -527,7 +519,7 @@ function rotary() { if (rotaryres.code == 10010) { rotarynum = ` 转盘${rotaryres.msg}🎉` } - resolve(); + resolve(); }) }, s); }) @@ -535,7 +527,7 @@ function rotary() { //转盘宝箱判断 function rotaryCheck() { - return new Promise(async resolve => { + return new Promise(async(resolve) => { if (rotaryres.code == 10010) { return resolve(); } @@ -546,7 +538,7 @@ function rotaryCheck() { } i++; } - resolve(); + resolve(); }) } @@ -561,13 +553,12 @@ function runRotary(index) { body: rotarbody } $.post(url, (error, response, data) => { - const rotaryresp = JSON.parse(data); + const rotaryresp = JSON.parse(data); if (rotaryresp.status == 1) { detail += `【转盘宝箱${index}】+${rotaryresp.data.score}个青豆\n`; }else{ if(rotaryresp.code == "10010"){ detail += `【转盘宝箱${index}】+今日抽奖完成\n`; - $.log("转盘宝箱已全部开启") } } resolve(); @@ -580,14 +571,10 @@ function TurnDouble() { const rotarbody = signheaderVal.split("&")[15] + '&' + signheaderVal.split("&")[8] return new Promise((resolve, reject) => { setTimeout(() => { - const time = (new Date()).getTime() + let time = (new Date()).getTime() const url = { - url: `${YOUTH_HOST}RotaryTable/toTurnDouble?_=${time}`, - headers: JSON.parse(signheaderVal), - body: rotarbody - } + url: `${YOUTH_HOST}RotaryTable/toTurnDouble?_=${time}`,headers: JSON.parse(signheaderVal),body: rotarbody} $.post(url, (error, response, data) => { - Doubleres = JSON.parse(data) if (Doubleres.status == 1) { detail += `【转盘双倍】+${Doubleres.data.score1}青豆 剩余${rotaryres.data.doubleNum}次\n` @@ -600,34 +587,6 @@ function TurnDouble() { },s) }) } - -function readTime() { - return new Promise((resolve, reject) => { - const url = { - url: `https://ios.baertt.com/v5/user/stay.json`, - headers: { - 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - }, - body: timebodyVal, - } - $.post(url, (error, response, data) => { - let timeres = JSON.parse(data) - if (timeres.error_code == 0) { - readtimes = timeres.time / 60 - detail += `【阅读时长】共计` + Math.floor(readtimes) + `分钟\n` - } else { - if (timeres.error_code == 200001) { - detail += `【阅读时长】❎ 未获取阅读时长Cookie\n` - }else{ - detail += `【阅读时长】❎ ${timeres.msg}\n` - $.log(`阅读时长统计失败,原因:${timeres.msg}`) - } - } - resolve() - }) - }) -} - function earningsInfo() { return new Promise((resolve, reject) => { setTimeout(() => { @@ -649,21 +608,21 @@ function earningsInfo() { },s) }) } - async function showmsg() { - console.log(`\n【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) +async function showmsg() { if (rotaryres.status == 1 && rotarytimes >= 97) { $.msg($.name + " " + nick, subTitle, detail) //默认前三次为通知 }else if (rotaryres.status == 1 && rotarytimes % notifyInterval == 0) { - $.msg($.name + " " + nick, subTitle, detail) //转盘次数/间隔整除时通知; + $.msg($.name + " " + nick, subTitle, detail) //转盘次数/间隔整除时通知; }else if (rotaryres.code == 10010 && notifyInterval != 0) { rotarynum = ` 转盘${rotaryres.msg}🎉` - $.msg($.name+" "+nick+" "+rotarynum,subTitle,detail)//任务全部完成且通知间隔不为0时通知; - } - if ($.isNode()){ - if (cash >= 10&&rotaryres.code==10010) { + $.msg($.name+" "+nick+" "+rotarynum,subTitle,detail)//任务全部完成且通知间隔不为0时通知; + if ($.isNode()&&cash >= 10){ await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) - } - } + } + } + else { + console.log(`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) + } } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 8111e233a0a00f5728cf08448554384ae37cf1d5 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 23:30:05 +0800 Subject: [PATCH 014/266] --- Task/youth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/youth.js b/Task/youth.js index 8932fc3d6e..95295d8f14 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -437,7 +437,7 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); - if (readres.items.read_score !== 0 &&readres.items.read_score !== undefined ) { + if (readres.items.read_score !== undefined && readres.items.read_score !== 0) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From 52cffc12bf2cc2a49e28a0144bd99fde62c3a9b1 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 23:34:53 +0800 Subject: [PATCH 015/266] --- Task/youth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/youth.js b/Task/youth.js index 95295d8f14..3125707a5e 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -437,7 +437,7 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); - if (readres.items.read_score !== undefined && readres.items.read_score !== 0) { + if (readres.items.read_score && readres.items.read_score !== 0) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From 0e0951bc24bf45848f8e11b814008ddde77b1aee Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 23:46:33 +0800 Subject: [PATCH 016/266] --- Task/youth.js | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index 3125707a5e..6429507952 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -1,20 +1,25 @@ /* -更新时间: 2020-09-22 22:15 +更新时间: 2020-09-22 23:46 + 赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 + 本脚本仅适用于中青看点极速版领取青豆 +增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共4条Cookie,请全部获取,获取请注释掉 + 获取Cookie方法: 1.将下方[rewrite_local]和[MITM]地址复制的相应的区域 -下,运行时间自行配置 -2. 获取Cookie方法,可随时更新 - ① 进入app,进入任务中心或者签到一次,即可获取Cookie. - ② 阅读一篇文章,获取阅读请求body, - ③ 同时获取阅读时长, - ④ 在阅读文章最下面有个惊喜红包,点击获取惊喜红包请求 -3.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每50次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 -4.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 -5.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续,增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共4条Cookie,请全部获取,获取请注释 -6. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ +下, +2. + +进入app,进入任务中心或者签到一次,即可获取Cookie. 阅读一篇文章,获取阅读请求body,并获取阅读时长,在阅读文章最下面有个惊喜红包,点击获取惊喜红包请求 +3.可随时获取Cookie. +4.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每10次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 +5.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 +6.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续 +7. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ + +by Macsuny ~~~~~~~~~~~~~~~~ Surge 4.0 : @@ -437,7 +442,8 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); - if (readres.items.read_score && readres.items.read_score !== 0) { + console.log(readres.items.complete) + if (readres.items.complete == 0 ||readres.items.score !== 0 ) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From 7570834b0700318d700b82883c94cc8b4d409064 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 23:53:07 +0800 Subject: [PATCH 017/266] --- Task/youth.js | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index 6429507952..3125707a5e 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -1,25 +1,20 @@ /* -更新时间: 2020-09-22 23:46 - +更新时间: 2020-09-22 22:15 赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 - 本脚本仅适用于中青看点极速版领取青豆 -增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共4条Cookie,请全部获取,获取请注释掉 - 获取Cookie方法: 1.将下方[rewrite_local]和[MITM]地址复制的相应的区域 -下, -2. - -进入app,进入任务中心或者签到一次,即可获取Cookie. 阅读一篇文章,获取阅读请求body,并获取阅读时长,在阅读文章最下面有个惊喜红包,点击获取惊喜红包请求 -3.可随时获取Cookie. -4.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每10次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 -5.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 -6.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续 -7. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ - -by Macsuny +下,运行时间自行配置 +2. 获取Cookie方法,可随时更新 + ① 进入app,进入任务中心或者签到一次,即可获取Cookie. + ② 阅读一篇文章,获取阅读请求body, + ③ 同时获取阅读时长, + ④ 在阅读文章最下面有个惊喜红包,点击获取惊喜红包请求 +3.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每50次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 +4.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 +5.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续,增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共4条Cookie,请全部获取,获取请注释 +6. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ ~~~~~~~~~~~~~~~~ Surge 4.0 : @@ -442,8 +437,7 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); - console.log(readres.items.complete) - if (readres.items.complete == 0 ||readres.items.score !== 0 ) { + if (readres.items.read_score && readres.items.read_score !== 0) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From db24646601b21878019b4bbaed3f2bd7a21b40df Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 22 Sep 2020 23:57:00 +0800 Subject: [PATCH 018/266] --- Task/youth.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Task/youth.js b/Task/youth.js index 3125707a5e..8fc6679ba0 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -437,6 +437,7 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); + console.log(readres) if (readres.items.read_score && readres.items.read_score !== 0) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } From cec7c7686c807bfc0696909713ba7d856afe76d0 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 23 Sep 2020 00:04:07 +0800 Subject: [PATCH 019/266] --- Task/youth.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Task/youth.js b/Task/youth.js index 8fc6679ba0..7a550d1e91 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -433,6 +433,9 @@ function readArticle() { return new Promise((resolve, reject) => { const url = { url: `https://ios.baertt.com/v5/article/complete.json`, + headers: { + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + }, body: articlebodyVal, } $.post(url, (error, response, data) => { @@ -454,6 +457,9 @@ function Articlered() { return new Promise((resolve, reject) => { const url = { url: `https://ios.baertt.com/v5/article/red_packet.json`, + headers: { + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + }, body: redpbodyVal, } $.post(url, (error, response, data) => { From 3a88ccbaef1b638751e96d12e6d7c5ecb7bad5b6 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 23 Sep 2020 01:38:21 +0800 Subject: [PATCH 020/266] update --- Task/telecomInfinity.js | 41 ++++++++++++++++++++++------------------- Task/youth.js | 1 - 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index 1b947121d4..595598872b 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -155,7 +155,7 @@ resolve(JSON.parse(body)); } function parseData(detail, balance, info, bill) { - return new Promise(resolve => { + return new Promise(async(resolve) => { if (!info || !detail || !balance|| !bill) { resolve("done") return @@ -175,14 +175,12 @@ function parseData(detail, balance, info, bill) { resolve("done") //return } - var balanceAvailable = Number(balance.totalBalanceAvailable) - notify(detail, balanceAvailable, info, bill) + await notify(detail, balance, info, bill) resolve("done") }) } function notify(data, balance, exdata, bldata) { -//console.log(bldata) var subtitle = "" if (config.info) { subtitle = "【手机】" + exdata.mobileShort + " (" + exdata.province + "-" + exdata.city + ")" @@ -211,23 +209,28 @@ function notify(data, balance, exdata, bldata) { totalCommon = formatFlow(data.totalCommon/1024) } for (i=0;i { readres = JSON.parse(data); - console.log(readres) if (readres.items.read_score && readres.items.read_score !== 0) { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } From 777f3e5aaa387ef190a0d6b30f9d3d757504c138 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 23 Sep 2020 20:21:55 +0800 Subject: [PATCH 021/266] =?UTF-8?q?=E4=B8=AD=E9=9D=92=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E5=85=A8=E5=A4=A9=E6=AF=8F14=E5=88=86=E9=92=9F?= =?UTF-8?q?=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/youth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index 2a31650081..f0ea1dbd8a 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -6,7 +6,7 @@ name: youth on: workflow_dispatch: schedule: - - cron: '*/5 3-22/2 * * *' + - cron: '*/14 * * * *' watch: types: started From d9bf00a7d550b184e58b4977912be92057f33199 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 24 Sep 2020 10:42:57 +0800 Subject: [PATCH 022/266] test --- Task/youth.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index 8b16224472..7d7aaf8510 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -151,9 +151,8 @@ if (isGetCookie = typeof $request !== 'undefined') { if($.time('HH')>12){ await punchCard() }; -if($.time('HH')<9&&$.time('HH')>4){ +console.log($.time('HH:mm') await endCard(); -}; await openbox(); await getAdVideo(); await gameVideo(); From 2d8a85518e18cc0f029b553500312b9d7b46e57a Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 24 Sep 2020 10:44:34 +0800 Subject: [PATCH 023/266] --- Task/youth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/youth.js b/Task/youth.js index 7d7aaf8510..3bc1ec423a 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -151,7 +151,7 @@ if (isGetCookie = typeof $request !== 'undefined') { if($.time('HH')>12){ await punchCard() }; -console.log($.time('HH:mm') +console.log($.time('HH:mm')) await endCard(); await openbox(); await getAdVideo(); From 2b4f76a305efbaa9c8064e1b7769a8ca6184eb48 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 24 Sep 2020 10:56:25 +0800 Subject: [PATCH 024/266] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AD=E9=9D=92?= =?UTF-8?q?=E6=89=93=E5=8D=A1=E6=97=B6=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/youth.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index 3bc1ec423a..7580cc5b71 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -1,5 +1,5 @@ /* -更新时间: 2020-09-22 22:15 +更新时间: 2020-09-24 11:15 赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 本脚本仅适用于中青看点极速版领取青豆 @@ -151,8 +151,12 @@ if (isGetCookie = typeof $request !== 'undefined') { if($.time('HH')>12){ await punchCard() }; -console.log($.time('HH:mm')) +if ($.isNode()&& $.time('HH')>20&&$.time('HH')<22){ await endCard(); + } +else if ($.time('HH')>4&&$.time('HH')<8){ + await endCard(); + } await openbox(); await getAdVideo(); await gameVideo(); From 0bf2ea07ce77647ab545ab064be9759e873de76b Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 24 Sep 2020 21:08:34 +0800 Subject: [PATCH 025/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=AD=E9=9D=92?= =?UTF-8?q?=E9=98=85=E8=AF=BBactions=20=E5=8D=95=E7=8B=AC=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=8C=E9=9C=80=E8=87=AA=E8=A1=8C=E6=8A=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/youth_read.yml | 37 +++++++++++++++++ Task/Youth_Read.js | 71 ++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/youth_read.yml create mode 100644 Task/Youth_Read.js diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml new file mode 100644 index 0000000000..929dac9daa --- /dev/null +++ b/.github/workflows/youth_read.yml @@ -0,0 +1,37 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: youth_read + +on: + workflow_dispatch: + schedule: + - cron: '*/15 19 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + steps: + - uses: actions/checkout@v1 + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: npm install + run: | + npm install + - name: '运行 【中青看点自动阅读】' + run: | + node Task/Youth_Read.js + env: + YOUTH_READ: ${{ secrets.YOUTH_READ }} + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + + + diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js new file mode 100644 index 0000000000..66e1890f39 --- /dev/null +++ b/Task/Youth_Read.js @@ -0,0 +1,71 @@ +/* +更新时间: 2020-09-24 20:15 +赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 + +请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个常量,拷贝抓包的请求体到下面Value的文本框中,值越多,获得青豆次数阅读,本脚本不包含任何推送通知 + +多次请求时用'&'号隔开" ‼️ + +*/ + +let s = 300000 //等待延迟30s +const $ = new Env("中青看点") +//const notify = $.isNode() ? require('./sendNotify') : ''; +let ReadArr = [], articlebody =''; +let YOUTH_READ = [ '','',]; + if (process.env.YOUTH_READ && process.env.YOUTH_READ.split('&') && process.env.YOUTH_READ.split('&').length > 0) { + YouthBody = process.env.YOUTH_READ.split('&'); + } + Object.keys(YouthBody).forEach((item) => { + if (YouthBody[item]) { + ReadArr.push(YouthBody[item]) + } + }) + console.log(`\n============ 脚本执行来自 Github Action ==============\n`) + console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) + !(async () => { + if (!ReadArr[0]) { + console.log($.name, '【提示】请把抓包的请求体填入Github 的 Secrets 中,请以&隔开') + return; + } + for (let i = 0; i < ReadArr.length; i++) { + if (ReadArr[i]) { + articlebody = ReadArr[i]; + $.index = i + 1; + console.log(`-------------------------\n\n开始中青看点第${$.index}次阅读`) + } + await AutoRead(); + } + console.log(`-------------------------\n\n中青看点共完成${$.index}次阅读,阅读请求全部结束`) +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + + +function AutoRead() { + return new Promise((resolve, reject) => { + setTimeout(()=> { + let url = { + url: `https://ios.baertt.com/v5/article/complete.json`, + headers: { + 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + }, + body: articlebody + }; + $.post(url, (error, response, data) => { + let readres = JSON.parse(data); + console.log(data) + if (readres.items.read_score) { + console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) + } + else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { + console.log(readres.items.max_notice) + } + resolve() + }) + },s) + }) +} + +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 754b838ade259e52af2a6ac62511a7faad9c20a4 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 24 Sep 2020 22:34:00 +0800 Subject: [PATCH 026/266] fix error --- Task/Youth_Read.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 66e1890f39..785a973201 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -1,5 +1,5 @@ /* -更新时间: 2020-09-24 20:15 +更新时间: 2020-09-24 22:15 赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个常量,拷贝抓包的请求体到下面Value的文本框中,值越多,获得青豆次数阅读,本脚本不包含任何推送通知 @@ -8,7 +8,7 @@ */ -let s = 300000 //等待延迟30s +let s = 30000 //等待延迟30s const $ = new Env("中青看点") //const notify = $.isNode() ? require('./sendNotify') : ''; let ReadArr = [], articlebody =''; From eeed90466e880d3f5d7499758f3742dd4aac8a75 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 25 Sep 2020 09:27:23 +0800 Subject: [PATCH 027/266] fix --- .github/workflows/youth_read.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index 929dac9daa..004639bb65 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -6,7 +6,7 @@ name: youth_read on: workflow_dispatch: schedule: - - cron: '*/15 19 * * *' + - cron: '*/13 19 * * *' watch: types: started jobs: From 5529bee9056e36b2658df67b317738e6db431da3 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 25 Sep 2020 09:34:07 +0800 Subject: [PATCH 028/266] --- .github/workflows/youth_read.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index 004639bb65..ad13cca75b 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -6,7 +6,7 @@ name: youth_read on: workflow_dispatch: schedule: - - cron: '*/13 19 * * *' + - cron: '*/29 19-20 * * *' watch: types: started jobs: From f519f52f2b8c0bf922cc177cd2055aaac84932a8 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 25 Sep 2020 18:27:10 +0800 Subject: [PATCH 029/266] fix error --- Task/Youth_Read.js | 5 ++--- Task/youth.js | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 785a973201..6fbda2728a 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -1,6 +1,5 @@ /* -更新时间: 2020-09-24 22:15 -赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 +更新时间: 2020-09-25 18:15 请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个常量,拷贝抓包的请求体到下面Value的文本框中,值越多,获得青豆次数阅读,本脚本不包含任何推送通知 @@ -56,7 +55,7 @@ function AutoRead() { $.post(url, (error, response, data) => { let readres = JSON.parse(data); console.log(data) - if (readres.items.read_score) { + if (typeof(readres.items.read_score)=='number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) } else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { diff --git a/Task/youth.js b/Task/youth.js index 7580cc5b71..936f759c1a 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -1,5 +1,5 @@ /* -更新时间: 2020-09-24 11:15 +更新时间: 2020-09-25 18:15 赞赏:中青邀请码`46308484`,农妇山泉 -> 有点咸,万分感谢 本脚本仅适用于中青看点极速版领取青豆 @@ -443,7 +443,7 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); - if (readres.items.read_score && readres.items.read_score !== 0) { + if (typeof(readres.items.read_score)=='number') { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From 0b391bd66d483cf8d59ac6e90f7c957ff12eeb0f Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 25 Sep 2020 22:56:06 +0800 Subject: [PATCH 030/266] fix --- .github/workflows/youth_read.yml | 2 +- Task/Youth_Read.js | 2 +- Task/youth.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index ad13cca75b..1b3d209d9e 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -6,7 +6,7 @@ name: youth_read on: workflow_dispatch: schedule: - - cron: '*/29 19-20 * * *' + - cron: '*/29 19-21 * * *' watch: types: started jobs: diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 6fbda2728a..647ebd71ce 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -55,7 +55,7 @@ function AutoRead() { $.post(url, (error, response, data) => { let readres = JSON.parse(data); console.log(data) - if (typeof(readres.items.read_score)=='number') { + if (typeof readres.items.read_score === 'number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) } else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { diff --git a/Task/youth.js b/Task/youth.js index 936f759c1a..917d9f8a07 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -443,7 +443,7 @@ function readArticle() { } $.post(url, (error, response, data) => { readres = JSON.parse(data); - if (typeof(readres.items.read_score)=='number') { + if (typeof readres.items.read_score === 'number') { detail += `【阅读奖励】+${readres.items.read_score}个青豆\n`; } //else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From 03122a62cb61eb215c528b0d7d9ff559e79a3963 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 26 Sep 2020 08:42:42 +0800 Subject: [PATCH 031/266] fix error --- Task/Youth_Read.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 647ebd71ce..ef2196f8aa 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -55,12 +55,15 @@ function AutoRead() { $.post(url, (error, response, data) => { let readres = JSON.parse(data); console.log(data) - if (typeof readres.items.read_score === 'number') { + if (readres.error_code == '0' && typeof readres.items.read_score === 'number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) } else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { console.log(readres.items.max_notice) } + else if {readres.error_code == '200001'){ + console.log(`第${$.index}次阅读请求有误,请删除此请求`) + } resolve() }) },s) From f186685fee50d0daaac549ba321681865d9fd8fd Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 26 Sep 2020 08:43:47 +0800 Subject: [PATCH 032/266] --- Task/Youth_Read.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index ef2196f8aa..a7f4109fd8 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -1,5 +1,5 @@ /* -更新时间: 2020-09-25 18:15 +更新时间: 2020-09-26 8:45 请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个常量,拷贝抓包的请求体到下面Value的文本框中,值越多,获得青豆次数阅读,本脚本不包含任何推送通知 @@ -58,12 +58,12 @@ function AutoRead() { if (readres.error_code == '0' && typeof readres.items.read_score === 'number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) } + else if {readres.error_code == '200001'){ + console.log(`第${$.index}次阅读请求有误,请删除此请求`) + } else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { console.log(readres.items.max_notice) } - else if {readres.error_code == '200001'){ - console.log(`第${$.index}次阅读请求有误,请删除此请求`) - } resolve() }) },s) From 87461e26bed9482c082dcc9870dd0281259e8cfe Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 26 Sep 2020 08:46:52 +0800 Subject: [PATCH 033/266] fix --- Task/Youth_Read.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index a7f4109fd8..cb304262ef 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -1,5 +1,5 @@ /* -更新时间: 2020-09-26 8:45 +更新时间: 2020-09-26 8:46 请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个常量,拷贝抓包的请求体到下面Value的文本框中,值越多,获得青豆次数阅读,本脚本不包含任何推送通知 @@ -58,7 +58,7 @@ function AutoRead() { if (readres.error_code == '0' && typeof readres.items.read_score === 'number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) } - else if {readres.error_code == '200001'){ + else if (readres.error_code == '200001'){ console.log(`第${$.index}次阅读请求有误,请删除此请求`) } else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From 3d9ed3cc78a98a8d876b2f8b719c4965e5f09f0c Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 26 Sep 2020 10:06:45 +0800 Subject: [PATCH 034/266] --- Task/Youth_Read.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index cb304262ef..0516de99d2 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -48,7 +48,7 @@ function AutoRead() { let url = { url: `https://ios.baertt.com/v5/article/complete.json`, headers: { - 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + 'User-Agent': 'KDApp/1.7.8 (iPhone; iOS 14.0; Scale/3.00)' }, body: articlebody }; From bcfe22bf8b86941aaad7e83b22c3bb93eaab75b6 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 26 Sep 2020 14:44:29 +0800 Subject: [PATCH 035/266] --- Task/Youth_Read.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 0516de99d2..cb3d46bb2c 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -1,9 +1,9 @@ /* 更新时间: 2020-09-26 8:46 -请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个常量,拷贝抓包的请求体到下面Value的文本框中,值越多,获得青豆次数阅读,本脚本不包含任何推送通知 +请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个值,拷贝抓包的请求体到下面Value的文本框中,添加的请求体越多,获得青豆次数越多,本脚本不包含任何推送通知 -多次请求时用'&'号隔开" ‼️ +多个请求体时用'&'号隔开" ‼️ */ From 33ff1239018eb94ff18873b1a06f0b34e3550735 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 27 Sep 2020 09:57:09 +0800 Subject: [PATCH 036/266] =?UTF-8?q?=E8=85=BE=E8=AE=AF=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E5=A4=9A=E8=B4=A6=E5=8F=B7=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/txnews.yml | 6 +-- Task/txnews.js | 76 ++++++++++++++++++++++++------------ 2 files changed, 55 insertions(+), 27 deletions(-) diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index 7b89d5c316..cedc36da20 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -30,9 +30,9 @@ jobs: run: | node Task/txnews.js env: - cookieVal: ${{ secrets.TXNEWS_COOKIE }} - signurlVal: ${{ secrets.TXNEWS_SIGN }} - videoVal: ${{ secrets.TXNEWS_VIDEO }} + TXNEWS_SIGN: ${{ secrets.TXNEWS_SIGN }} + TXNEWS_COOKIE: ${{ secrets.TXNEWS_COOKIE }} + TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} TXNEWS_NOTIFY_CONTROL: ${{ secrets.TXNEWS_NOTIFY_CONTROL }} diff --git a/Task/txnews.js b/Task/txnews.js index d581488125..bf80d91797 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -1,5 +1,6 @@ + /* -更新时间: 2020-09-19 21:30 +更新时间: 2020-09-27 09:30 腾讯新闻签到修改版,可以自动阅读文章获取红包,该活动为瓜分百万现金挑战赛,针对幸运用户参与 @@ -49,34 +50,67 @@ const notify = $.isNode() ? require('./sendNotify') : ''; let s = Number($.getdata('delay'))||200 // 间隔延迟时间 let notifyInterval =$.getdata('notifynum')||50; //阅读篇数间隔通知开为1,常关为0; const TX_HOST = 'https://api.inews.qq.com/activity/v1/' - -let signurlVal = $.getdata('sy_signurl_txnews') -let cookieVal = $.getdata( 'sy_cookie_txnews') -let videoVal = $.getdata( 'video_txnews') +let SignArr = [],signurlVal = ""; + cookiesArr = [],cookieVal = ""; + VideoArr = [],videoVal = ""; if ($.isNode()) { - cookieVal = process.env.cookieVal; - signurlVal = process.env.signurlVal; - videoVal = process.env.videoVal -} + if (process.env.TXNEWS_COOKIE && process.env.TXNEWS_COOKIE.split('&') && process.env.TXNEWS_COOKIE.split('&').length > 0) { + CookieTxnews = process.env.TXNEWS_COOKIE.split('&'); + } + if (process.env.TXNEWS_SIGN && process.env.TXNEWS_SIGN.split('#') && process.env.TXNEWS_SIGN.split('#').length > 0) { + SignUrl = process.env.signurlVal.split('#'); + } + if (process.env.TXNEWS_VIDEO && process.env.TXNEWS_VIDEO.split('#') && process.env.TXNEWS_VIDEO.split('#').length > 0) { + VideoUrl = process.env.TXNEWS_VIDEO.split('#'); + }; + Object.keys(CookieTxnews).forEach((item) => { + if (CookieTxnews[item]) { + cookiesArr.push(CookieTxnews[item]) + } + }) + Object.keys(SignUrl).forEach((item) => { + if (SignUrl[item]) { + SignArr.push(SignUrl[item]) + } + }) + Object.keys(REDBODYs).forEach((item) => { + if (VideoUrl[item]) { + VideoArr.push(REDBODYs[item]) + } + }) + } else { + cookiesArr.push($.getdata('sy_cookie_txnews')); + SignArr.push($.getdata( 'sy_signurl_txnews')); + VideoArr.push($.getdata( 'video_txnews')) + } let isGetCookie = typeof $request !== 'undefined' if (isGetCookie) { GetCookie() } else { - !(async () => { - if(!signurlVal && !cookieVal){ - $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}) - await notify.sendNotify($.name, '【提示】请先获取腾讯新闻一Cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); +!(async () => { + if(!cookiesArr){ + $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); + if ($.isNode()){ + await notify.sendNotify($.name, '【提示】请先获取腾讯新闻一Cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); + } return; } if ($.isNode()){ console.log(`\n============ 脚本执行来自 Github Action ==============\n`) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) - console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) + } + for (let i = 0; i < cookiesArr.length; i++) { + if (cookiesArr[i]) { + cookieVal = cookiesArr[i]; + signurlVal = SignArr[i]; + videoVal = VideoArr[i]; + $.index = i + 1; + console.log(`-------------------------\n\n开始【腾讯新闻账号${$.index}】`) } - token = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0] - console.log("-----------------------------\n\n开始获取您的活动ID"); + token = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0] await getsign(); await activity(); await toRead(); @@ -92,14 +126,7 @@ if (isGetCookie) { }; await getTotal(); await showmsg(); - if ($.isNode()){ - if (readnum%notifyInterval==0){ - await notify.sendNotify($.name,subTile+'\n'+detail); - } - else if (openreadred==readredtotal&&openvideored==videoredtotal){ - await notify.sendNotify($.name+` 今日任务已完成✅`,subTile+'\n'+ detail) - } - } + } })() .catch((e) => $.logErr(e)) .finally(() => $.done()) @@ -298,3 +325,4 @@ function showmsg() { // prettier-ignore function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} + From 40a9900c5471801dc83f968f6b0d05d802e200a5 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 27 Sep 2020 10:10:31 +0800 Subject: [PATCH 037/266] fix erro --- Task/txnews.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index bf80d91797..ca11f6638d 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-09-27 09:30 +更新时间: 2020-09-27 10:10 腾讯新闻签到修改版,可以自动阅读文章获取红包,该活动为瓜分百万现金挑战赛,针对幸运用户参与 @@ -59,7 +59,7 @@ if ($.isNode()) { CookieTxnews = process.env.TXNEWS_COOKIE.split('&'); } if (process.env.TXNEWS_SIGN && process.env.TXNEWS_SIGN.split('#') && process.env.TXNEWS_SIGN.split('#').length > 0) { - SignUrl = process.env.signurlVal.split('#'); + SignUrl = process.env.TXNEWS_SIGN.split('#'); } if (process.env.TXNEWS_VIDEO && process.env.TXNEWS_VIDEO.split('#') && process.env.TXNEWS_VIDEO.split('#').length > 0) { VideoUrl = process.env.TXNEWS_VIDEO.split('#'); @@ -74,9 +74,9 @@ if ($.isNode()) { SignArr.push(SignUrl[item]) } }) - Object.keys(REDBODYs).forEach((item) => { + Object.keys(VideoUrl).forEach((item) => { if (VideoUrl[item]) { - VideoArr.push(REDBODYs[item]) + VideoArr.push(VideoUrl[item]) } }) } else { From 42ada9c3ffe902d8f721fcb89e0a33861eed65dd Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 27 Sep 2020 10:26:35 +0800 Subject: [PATCH 038/266] --- Task/telecomInfinity.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index 595598872b..f3591315a5 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -181,6 +181,7 @@ function parseData(detail, balance, info, bill) { } function notify(data, balance, exdata, bldata) { + try{ var subtitle = "" if (config.info) { subtitle = "【手机】" + exdata.mobileShort + " (" + exdata.province + "-" + exdata.city + ")" @@ -256,6 +257,10 @@ billcharge[2].charge/100+'元'+ "\n "+ billcharge[0].chargetypeName + ': '+ b message = message + "\n" + bills } $.msg(config.name, subtitle, message) + } + catch(err){ + console.log("查询错误,错误原因:"+ err+'\n账单响应数据:'+bldata+'\n请将以上数据反馈给作者') + } } // MB 和 GB 自动转换 From 9cd1307b393fc48b825bc2124bdb846b235055dd Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 27 Sep 2020 13:41:49 +0800 Subject: [PATCH 039/266] =?UTF-8?q?update=20=E7=94=B5=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/telecomInfinity.js | 70 ++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 40 deletions(-) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index f3591315a5..4b3efded34 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -41,10 +41,10 @@ let config = { delay: 0, //自定义延迟签到,单位毫秒,(如填200则每个接口延迟0.2秒执行),默认无延迟 info: 1, //是否显示手机归属地,1为显示,0为不显示 } -const $ = new Env(config.name) - d = new Date(); - Y = d.getFullYear(), - M = $.getdata('Mon').slice(-2)||d.getMonth() //上月 +let $ = new Env(config.name), + Y = $.time('yyyy'), + M = $.getdata('Mon').slice(-2)||$.time('MM') ; //查询前几个月,可以')'号后减几 + let AUTHTOKEN = $.getdata(config.authTokenKey) let COOKIE = $.getdata(config.CookieKey) var requests = { @@ -82,7 +82,6 @@ var requests = { } } -//console.log(requests.bill) if (isGetCookie = typeof $request !== 'undefined') { GetCookie() $.done() @@ -101,7 +100,7 @@ function GetCookie() { if (cookieVal) { if ($.setdata(cookieVal, config.authTokenKey)) { $.msg(config.name, '获取authToken: 成功', '') - // $.log.info(`[${config.name}] 获取authToken: 成功, authToken: ${cookieVal}, Cookie: [${COOKIE}]` ) + // console.log(`[${config.name}] 获取authToken: 成功, authToken: ${cookieVal}, Cookie: [${COOKIE}]` ) } } } @@ -181,25 +180,14 @@ function parseData(detail, balance, info, bill) { } function notify(data, balance, exdata, bldata) { +//console.log(data.items) try{ var subtitle = "" if (config.info) { subtitle = "【手机】" + exdata.mobileShort + " (" + exdata.province + "-" + exdata.city + ")" } - var productname = "中国电信" - if (typeof data.items[1].offerType == 11) { - productname = data.items[1].productOFFName - } - else if (typeof data.items[0].productOFFName != "undefined") { - productname = data.items[0].productOFFName - } - var message = "【套餐】" + productname - var voiceAmount = " " - var voiceUsage = " " - var voiceBalance = " " - var msgUsage = "" - var msgBalance = "" - var msgAmount = "" + let productname = "中国电信", voiceAmount = " ", voiceUsage = " ", voiceBalance = " ", msgUsage = "", msgBalance = "", msgAmount = "",usagedCommon,balanceCommon,totalCommon; + if(data.usedCommon){ usagedCommon = formatFlow(data.usedCommon/1024) } @@ -208,44 +196,46 @@ function notify(data, balance, exdata, bldata) { } if(data.totalCommon){ totalCommon = formatFlow(data.totalCommon/1024) -} +} //流量信息 + for (i=0;i Date: Sun, 27 Sep 2020 17:04:17 +0800 Subject: [PATCH 040/266] fix error --- Task/txnews.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index ca11f6638d..d9b7c7446b 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -91,7 +91,7 @@ if (isGetCookie) { } else { !(async () => { if(!cookiesArr){ - $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); + $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); if ($.isNode()){ await notify.sendNotify($.name, '【提示】请先获取腾讯新闻一Cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); } @@ -270,17 +270,17 @@ function Redpack() { let rcash = JSON.parse(data) try{ redpacks = rcash.data.award.num/100 - if (rcash.ret == 0&&readredpack!=0&&getreadred>0){ - redpackres = `【阅读红包】到账`+readredpack+`元 🌷\n` - $.log("阅读红包到账"+readredpack+"元\n") + if (rcash.ret == 0&&redpacks>0&&getreadred > 0){ + redpackres = `【阅读红包】到账`+redpacks+`元 🌷\n` + $.log("阅读红包到账"+redpacks+"元\n") } - else if (rcash.ret == 0&&videoredpack!=0&&getvideored>0){ - redpackres = `【视频红包】到账`+videoredpack+`元 🌷\n` - $.log("视频红包到账"+videoredpack+"元\n") + else if (rcash.ret == 0&&redpacks>0){ + redpackres = `【视频红包】到账`+redpacks+`元 🌷\n` + $.log("视频红包到账"+redpacks+"元\n") } } - catch(err){ - $.log("打开红包失败,响应数据: "+ data+"\n错误代码:"+err) }; + catch(error){ + $.log("打开红包失败,响应数据: "+ data+"\n错误代码:"+error) }; $.msg($.name, "开红包失败,详情请看日志 ❌", err) resolve() }) From 6802126c30af9f4b933255d5f47c953f4eb65bdc Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 28 Sep 2020 20:07:04 +0800 Subject: [PATCH 041/266] =?UTF-8?q?=E4=B8=AD=E9=9D=92=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=A0=87=E5=87=86=E6=97=B6=E9=97=B419-23=E6=97=B6?= =?UTF-8?q?=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/youth_read.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index 1b3d209d9e..c74e651398 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -6,7 +6,7 @@ name: youth_read on: workflow_dispatch: schedule: - - cron: '*/29 19-21 * * *' + - cron: '*/29 19-23 * * *' watch: types: started jobs: From a9e0312a17ccde9dbe4682d82740a925af259788 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 29 Sep 2020 19:03:36 +0800 Subject: [PATCH 042/266] fix error --- Task/Youth_Read.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index cb3d46bb2c..9208f3c334 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -58,7 +58,7 @@ function AutoRead() { if (readres.error_code == '0' && typeof readres.items.read_score === 'number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) } - else if (readres.error_code == '200001'){ + else if (readres.success == false){ console.log(`第${$.index}次阅读请求有误,请删除此请求`) } else if (readres.items.max_notice == '\u770b\u592a\u4e45\u4e86\uff0c\u63621\u7bc7\u8bd5\u8bd5') { From 82d0e53e4b126e9a4c27e415c157baecd9a7e91d Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 3 Oct 2020 18:12:21 +0800 Subject: [PATCH 043/266] =?UTF-8?q?=E4=B8=AD=E9=9D=92=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E6=B2=A111=E5=88=86=E9=92=9F=E8=BF=90=E8=A1=8C?= =?UTF-8?q?=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/youth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index f0ea1dbd8a..2097f3d9c0 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -6,7 +6,7 @@ name: youth on: workflow_dispatch: schedule: - - cron: '*/14 * * * *' + - cron: '*/11 * * * *' watch: types: started From dc7cc36ebd6d2b33779c64c307cfad4e90e0ee61 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 6 Oct 2020 22:20:32 +0800 Subject: [PATCH 044/266] --- .github/workflows/youth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index 2097f3d9c0..2ed3a638ae 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -6,7 +6,7 @@ name: youth on: workflow_dispatch: schedule: - - cron: '*/11 * * * *' + - cron: '*/12 * * * *' watch: types: started From 8b6d7f4e7f2deec98553a307d7c012bc6cadcb90 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 08:59:35 +0800 Subject: [PATCH 045/266] fix erro --- Task/jddj.js | 2 + Task/lkyl.js | 164 +++++++++++++++++++------------------------------- Task/youth.js | 2 + 3 files changed, 65 insertions(+), 103 deletions(-) diff --git a/Task/jddj.js b/Task/jddj.js index f4ca7a57b5..24a7007f19 100644 --- a/Task/jddj.js +++ b/Task/jddj.js @@ -87,6 +87,7 @@ function GetCookie() { } else { $.msg("写入" + CookieName + "Cookie失败‼️", "", "配置错误, 无法读取请求头, "); } + $.done() } function signinfo() { @@ -142,6 +143,7 @@ async function showmsg() { } $.detail = gettoday+ `\n`+"已签到"+signdays+"天 "+tompoint $.msg(CookieName, $.subtitle, $.detail) + $.done() } function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/lkyl.js b/Task/lkyl.js index ed0c5e75e6..c913b1e2fe 100644 --- a/Task/lkyl.js +++ b/Task/lkyl.js @@ -1,5 +1,5 @@ /* -更新时间: 2020-06-15 15:35 取消打卡挑战,ck时效短,可弃坑 +更新时间: 2020-10-09 08:35 取消打卡挑战,ck时效短,可弃坑 本脚本仅适用于京东来客有礼每日获取京豆 获取Cookie方法: @@ -42,38 +42,16 @@ const challengebean= 100 //默认挑战赛100档 const jdbean = "500" //兑换京豆数 const logs = 0 //响应日志开关,默认关闭 const cookieName = '来客有礼小程序' -const sy = init() -const signurlVal = sy.getdata('sy_signurl_lkyl') -const signheaderVal = sy.getdata('sy_signheader_lkyl') -const openid = sy.getdata('openid_lkyl') -const appid = sy.getdata('app_lkyl') +const $ = new Env(cookieName) +const signurlVal = $.getdata('sy_signurl_lkyl') +const signheaderVal = $.getdata('sy_signheader_lkyl') +const openid = $.getdata('openid_lkyl') +const appid = $.getdata('app_lkyl') let isGetCookie = typeof $request !== 'undefined' if (isGetCookie) { GetCookie() } else { - all() -} -function GetCookie() { -const requrl = $request.url -if ($request && $request.method != 'OPTIONS') { - const signurlVal = requrl - const signheaderVal = JSON.stringify($request.headers) - const openid = $request.headers['openId']; - const appid = $request.headers['App-Id']; - sy.log(`signurlVal:${signurlVal}`) - sy.log(`signheaderVal:${signheaderVal}`) - if (signurlVal) sy.setdata(signurlVal, 'sy_signurl_lkyl') - if (signheaderVal) sy.setdata(signheaderVal, 'sy_signheader_lkyl') - if (openid) sy.setdata(openid,'openid_lkyl'); - if (appid) sy.setdata(appid,'app_lkyl'); - sy.log(`openid:${openid}`) - sy.log(`appid:${appid}`) - sy.msg(cookieName, `获取Cookie: 成功🎉`, ``) - } - } - -async function all() -{ +!(async () => { await sign(); // 签到 await info(); // 账号信息 await total(); // 总计 @@ -84,14 +62,37 @@ async function all() await video(); // 视频任务 await Daily(); // 日常任务 //await exChange(); // 银豆兑换 +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) } +function GetCookie() { +const requrl = $request.url +if ($request && $request.method != 'OPTIONS') { + const signurlVal = requrl + const signheaderVal = JSON.stringify($request.headers) + const openid = $request.headers['openId']; + const appid = $request.headers['App-Id']; + $.log(`signurlVal:${signurlVal}`) + $.log(`signheaderVal:${signheaderVal}`) + if (signurlVal) $.setdata(signurlVal, 'sy_signurl_lkyl') + if (signheaderVal) $.setdata(signheaderVal, 'sy_signheader_lkyl') + if (openid) $.setdata(openid,'openid_lkyl'); + if (appid) $.setdata(appid,'app_lkyl'); + $.log(`openid:${openid}`) + $.log(`appid:${appid}`) + $.msg(cookieName, `获取Cookie: 成功🎉`, ``) + } + $.done() + } + function sign() { return new Promise((resolve, reject) =>{ let signurl = { url: `https://draw.jdfcloud.com//api/turncard/sign?openId=${openid}&petSign=true&turnTableId=131&source=HOME&channelId=87&appId=${appid}`, headers:JSON.parse(signheaderVal)} - sy.post(signurl, (error, response, data) => { - if(logs) sy.log(`${cookieName}, 签到信息: ${data}`) + $.post(signurl, (error, response, data) => { + if(logs) $.log(`${cookieName}, 签到信息: ${data}`) let result = JSON.parse(data) const title = `${cookieName}` if (result.success == true) { @@ -103,7 +104,7 @@ function sign() { } else if (result.errorCode =='L0001') { subTitle = `签到失败,Cookie 失效❌` detail = `说明: ${result.errorMessage}` - sy.msg(cookieName, subTitle, detail) + $.msg(cookieName, subTitle, detail) return } resolve() @@ -115,8 +116,8 @@ function status() { let statusurl = { url: `https://draw.jdfcloud.com//api/bean/square/silverBean/task/get?openId=${openid}&appId=${appid}`, headers: JSON.parse(signheaderVal)} - sy.get(statusurl, (error, response, data) =>{ - if(logs)sy.log(`${cookieName}, 任务状态: ${data}`) + $.get(statusurl, (error, response, data) =>{ + if(logs)$.log(`${cookieName}, 任务状态: ${data}`) taskstatus = JSON.parse(data) if (taskstatus.data.dailyTasks[0].status!='received'){ detail += `【日常抽奖】: 🔕 已完成/总计: ${doneSteps}/${totalSteps}次\n` @@ -145,8 +146,8 @@ function video() { url: `https://draw.jdfcloud.com//api/bean/square/silverBean/task/join?appId=${appid}`,headers: JSON.parse(signheaderVal),body: bodyVal} videotaskurl = { url: `https://draw.jdfcloud.com//api/bean/square/silverBean/taskReward/get?openId=${openid}&taskCode=watch_video&inviterOpenId=&appId=${appid}`,headers: JSON.parse(signheaderVal)} - sy.post(videourl, function(error, response, data){if(logs)sy.log(`${cookieName}, 视频: ${data}`)}) - sy.get(videotaskurl, function(error, response, data){if(logs)sy.log(`${cookieName}, 视频银豆: ${data}`)}) + $.post(videourl, function(error, response, data){if(logs)$.log(`${cookieName}, 视频: ${data}`)}) + $.get(videotaskurl, function(error, response, data){if(logs)$.log(`${cookieName}, 视频银豆: ${data}`)}) } } if (taskstatus.data.dailyTasks[1].status=='received'){ @@ -162,8 +163,8 @@ function lottery() { url: `https://draw.jdfcloud.com//api/bean/square/getTaskInfo?openId=${openid}&taskCode=lottery&appId=${appid}`, headers: JSON.parse(signheaderVal) } - sy.get(daytaskurl, (error, response, data) => { - if(logs) sy.log(`${cookieName}, 0元抽奖 ${data}`) + $.get(daytaskurl, (error, response, data) => { + if(logs) $.log(`${cookieName}, 0元抽奖 ${data}`) let lotteryres = JSON.parse(data) doneSteps = lotteryres.data.doneSteps totalSteps = lotteryres.data.totalSteps @@ -186,8 +187,8 @@ function info() { let infourl = { url: `https://draw.jdfcloud.com//api/user/user/detail?openId=${openid}&appId=${appid}`, headers: JSON.parse(signheaderVal)} - sy.get(infourl, (error, response, data) => { - if(logs)sy.log(`${cookieName}, 账号信息: ${data}`) + $.get(infourl, (error, response, data) => { + if(logs)$.log(`${cookieName}, 账号信息: ${data}`) let info = JSON.parse(data) uesername = `${info.data.nickName}` resolve() @@ -206,8 +207,8 @@ function challenge() { headers: JSON.parse(signheaderVal), body: '{"appId":'+' "'+appid+'"'+', "openId":'+' "'+openid+'"'+',"challengeStage":"'+nowday+'","deductAmount":'+challengebean+',"signLevelAmount":'+challengebean+'}' } - sy.post(challurl, (error, response, data) => { - sy.log(`${cookieName}, 打卡挑战赛: ${data}`) + $.post(challurl, (error, response, data) => { + $.log(`${cookieName}, 打卡挑战赛: ${data}`) let challres = JSON.parse(data) if(challres.data==true){ detail += `【打卡挑战】: 报名成功,押金: `+challengebean+'\n' @@ -229,8 +230,8 @@ function tasklist() { url: `https://draw.jdfcloud.com//api/lottery/home/v2?openId=${openid}&appId=${appid}`, headers: JSON.parse(signheaderVal)} taskurl.headers['Content-Length'] = `0`; - sy.get(taskurl, (error, response, data) => { - if(logs)sy.log(`${cookieName}, 任务列表: ${data}`) + $.get(taskurl, (error, response, data) => { + if(logs)$.log(`${cookieName}, 任务列表: ${data}`) task = JSON.parse(data) resolve() }) @@ -242,8 +243,8 @@ function cycleLucky() { let luckyurl = { url: `https://draw.jdfcloud.com//api/lottery/participate?lotteryId=${lotteryId}&openId=${openid}&formId=123&source=HOME&appId=${appid}`,headers: JSON.parse(signheaderVal),body: '{}' } - sy.post(luckyurl, (error, response, data) => { - if(logs)sy.log(`${cookieName}, 抽奖任务: ${data}`) + $.post(luckyurl, (error, response, data) => { + if(logs)$.log(`${cookieName}, 抽奖任务: ${data}`) }) resolve() }) @@ -257,13 +258,13 @@ return new Promise((resolve, reject) => { headers: JSON.parse(signheaderVal) } beanurl.headers['Content-Length'] = `0`; - sy.get(beanurl, (error, response, data) => + $.get(beanurl, (error, response, data) => { - if(logs)sy.log(`${cookieName}, 日常银豆: ${data}`) + if(logs)$.log(`${cookieName}, 日常银豆: ${data}`) }) resolve() - sy.msg(cookieName, '昵称: '+ uesername+' '+subTitle, detail) - sy.log('昵称: '+ uesername+' '+subTitle+detail) + $.msg(cookieName, '昵称: '+ uesername+' '+subTitle, detail) + $.log('昵称: '+ uesername+' '+subTitle+detail) }) } // 每周银豆 @@ -274,9 +275,9 @@ return new Promise((resolve, reject) => { headers: JSON.parse(signheaderVal) } bean2url.headers['Content-Length'] = `0`; - sy.get(bean2url, (error, response, data) => + $.get(bean2url, (error, response, data) => { - if(logs)sy.log(`${cookieName}, 本周任务: ${data}`) + if(logs)$.log(`${cookieName}, 本周任务: ${data}`) }) resolve() }) @@ -284,13 +285,12 @@ return new Promise((resolve, reject) => { function total() { return new Promise((resolve, reject) =>{ - setTimeout(() => { let lotteryurl = { url: `https://draw.jdfcloud.com//api/bean/square/silverBean/getUserBalance?openId=${openid}&appId=${appid}`, headers: JSON.parse(signheaderVal) } - sy.get(lotteryurl, (error, response, data) => { - if(logs)sy.log(`${cookieName}, 统计: ${data}`) + $.get(lotteryurl, (error, response, data) => { + if(logs)$.log(`${cookieName}, 统计: ${data}`) let result = JSON.parse(data) const title = `${cookieName}` if (result.success == true) { @@ -301,8 +301,8 @@ function total() { url: `https://draw.jdfcloud.com//api/bean/square/silverBean/getJdBeanList?openId=${openid}&appId=${appid}`, headers: JSON.parse(signheaderVal)} hinturl.headers['Content-Length'] = `0`; - sy.get(hinturl, (error, response, data) => { - if(logs)sy.log(`${cookieName}, 可兑换: ${data}`) + $.get(hinturl, (error, response, data) => { + if(logs)$.log(`${cookieName}, 可兑换: ${data}`) let excresult = JSON.parse(data) const title = `${cookieName}` exchangebean = `` @@ -331,7 +331,6 @@ else if (SilverBean == excresult.datas[0].salePrice) resolve() }) }) - }) }) } function exChange() { @@ -342,8 +341,8 @@ function exChange() { headers: JSON.parse(signheaderVal), body: '{"appId":'+' "'+appid+'"'+', "openId":'+' "'+openid+'"'+', "jdPin":'+' "'+uesername+'"'+', "productCode":"jd_bean_'+jdbean+'"}' } - sy.post(changeurl, (error, response,data) =>{ - if(logs) sy.log(`${cookieName}, 兑换京豆: ${data}`) + $.post(changeurl, (error, response,data) =>{ + if(logs) $.log(`${cookieName}, 兑换京豆: ${data}`) let result = JSON.parse(data) if (result.errorCode== "success"){ detail += '\n【自动兑换】 兑换'+result.data+'个京豆 ✅' @@ -354,46 +353,5 @@ function exChange() { }) } -function init() { - isSurge = () => { - return undefined === this.$httpClient ? false : true - } - isQuanX = () => { - return undefined === this.$task ? false : true - } - getdata = (key) => { - if (isSurge()) return $persistentStore.read(key) - if (isQuanX()) return $prefs.valueForKey(key) - } - setdata = (key, val) => { - if (isSurge()) return $persistentStore.write(key, val) - if (isQuanX()) return $prefs.setValueForKey(key, val) - } - msg = (title, subTitle, body) => { - if (isSurge()) $notification.post(title, subTitle, body) - if (isQuanX()) $notify(title, subTitle, body) - } - log = (message) => console.log(message) - get = (url, cb) => { - if (isSurge()) { - $httpClient.get(url, cb) - } - if (isQuanX()) { - url.method = 'GET' - $task.fetch(url).then((resp) => cb(null, resp, resp.body)) - } - } - post = (url, cb) => { - if (isSurge()) { - $httpClient.post(url, cb) - } - if (isQuanX()) { - url.method = 'POST' - $task.fetch(url).then((resp) => cb(null, resp, resp.body)) - } - } - done = (value = {}) => { - $done(value) - } - return { isSurge, isQuanX, msg, log, getdata, setdata, get, post, done } -} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} + diff --git a/Task/youth.js b/Task/youth.js index 917d9f8a07..33e5913bd3 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -198,6 +198,7 @@ else if ($request && $request.method != `OPTIONS`&& $request.url.match(/\/articl $.log(`${$.name} 获取惊喜红包: 成功,redpbodyVal: ${redpbodyVal}`) $.msg($.name, `获取惊喜红包请求: 成功🎉`, ``) } + $.done() } function sign() { @@ -632,6 +633,7 @@ async function showmsg() { else { console.log(`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) } + $.done() } function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 4ca3acd673a2ddd37cc7ce2610a5f1f29545aead Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 09:12:11 +0800 Subject: [PATCH 046/266] --- Task/sinanews.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Task/sinanews.js b/Task/sinanews.js index ffa7c2ffab..07d71e358f 100644 --- a/Task/sinanews.js +++ b/Task/sinanews.js @@ -84,6 +84,7 @@ if ($request && $request.method != 'OPTIONS'&& if (infoheaderVal) $.setdata(infoheaderVal, `sy_infoheader_snews`) $.msg($.name, `获取信息Cookie: 成功`, ``) } + $.done() } //签到 function getsign() { From eeb7708c4094e756b1444857b34ea29c5491657b Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 09:23:43 +0800 Subject: [PATCH 047/266] fix error --- Task/sinanews.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/sinanews.js b/Task/sinanews.js index 07d71e358f..ad42704f8e 100644 --- a/Task/sinanews.js +++ b/Task/sinanews.js @@ -47,7 +47,7 @@ https?:\/\/lite\.sina\.cn\/\?resource=userpoint\/signIn - script-request-header */ const $ = new Env('新浪新闻') const signurlVal = $.getdata(`sy_signurl_snews`) -const infourlVal = $.getdata(`sy_ck_snews`) +const infourlVal = $.getdata(`sy_info_snews`) const signheaderVal =$.getdata(`sy_ck_snews`) const infoheaderVal =$.getdata(`sy_infoheader_snews`) From e70c9015880910b0cc81d6feced29ef9ff80f064 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 10:03:06 +0800 Subject: [PATCH 048/266] --- Task/youth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/youth.js b/Task/youth.js index 33e5913bd3..836a6c39b5 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -384,7 +384,7 @@ function boxshare() { function Invitant() { return new Promise((resolve, reject) => { - $.post({ url: `${YOUTH_HOST}User/fillCode`,headers: JSON.parse(signheaderVal),body: `{"code": "46308484"}` + $.post({ url: `${YOUTH_HOST}User/fillCode`,headers: JSON.parse(signheaderVal),body: `{"code": "46746961"}` }, (error, response, data) => { // $.log(`Invitdata:${data}`) From 81240a7f0d547088e94d58aa50188ce1b2481e97 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 20:28:40 +0800 Subject: [PATCH 049/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=92=89=E9=92=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 18 ------- .github/workflows/jingxi.yml | 2 + .github/workflows/txnews.yml | 2 + .github/workflows/youth.yml | 3 +- .github/workflows/youth_read.yml | 3 +- Task/jingxi.js | 3 ++ Task/sendNotify.js | 87 ++++++++++++++++++++++++++++++-- app.js | 66 ------------------------ 8 files changed, 95 insertions(+), 89 deletions(-) delete mode 100644 .gitignore delete mode 100644 app.js diff --git a/ .gitignore b/ .gitignore deleted file mode 100644 index 3e4350fc08..0000000000 --- a/ .gitignore +++ /dev/null @@ -1,18 +0,0 @@ - -# OSX -.DS_Store - - -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Dependency directories -node_modules/ -package-lock.json - -jingxi.js -result.txt \ No newline at end of file diff --git a/.github/workflows/jingxi.yml b/.github/workflows/jingxi.yml index d86821db32..db6378b348 100644 --- a/.github/workflows/jingxi.yml +++ b/.github/workflows/jingxi.yml @@ -30,3 +30,5 @@ jobs: TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} TG_USER_ID: ${{ secrets.TG_USER_ID }} BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index cedc36da20..4aa2ad6e9e 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -39,4 +39,6 @@ jobs: TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} TG_USER_ID: ${{ secrets.TG_USER_ID }} BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index 2ed3a638ae..0e304eada9 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -37,6 +37,7 @@ jobs: TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} TG_USER_ID: ${{ secrets.TG_USER_ID }} BARK_SOUND: ${{ secrets.BARK_SOUND }} - + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index c74e651398..9d85cf1226 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -32,6 +32,7 @@ jobs: TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} TG_USER_ID: ${{ secrets.TG_USER_ID }} BARK_SOUND: ${{ secrets.BARK_SOUND }} - + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} diff --git a/Task/jingxi.js b/Task/jingxi.js index 649fe2be0e..de64fd9532 100644 --- a/Task/jingxi.js +++ b/Task/jingxi.js @@ -193,6 +193,9 @@ function showmsg() { $.desc = signdays +doubleres+ '\n' + "今日签到得" + todaypoint + "个金币 共计" + (daytotal+todaypoint)+'个金币' $.msg($.name + " 账号昵称:" + nickname, $.sub, $.desc) } + if ($.isNode()){ + await notify.sendNotify($.name + " 账号昵称:" + nickname, $.sub+`\n`+$.desc) + } resolve() }) } diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 4d363a717d..ae7949b3ca 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -19,7 +19,13 @@ let TG_BOT_TOKEN = ''; //注:此处设置github action用户填写到Settings-Secrets里面(Name输入TG_USER_ID) let TG_USER_ID = ''; -//运行农场脚本是否静默运行(即:不推送通知),false打开通知推送,true关闭通知推送 +//此处填你钉钉 bot 的webhook,例如:5a544165465465645d0f31dca676e7bd07415asdasd +//注:此处设置github action用户填写到Settings-Secrets里面(Name输入DD_BOT_TOKEN) +let DD_BOT_TOKEN = ''; +//密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串 +let DD_BOT_SECRET = ''; + +//运行脚本是否静默运行(即:不推送通知),false打开通知推送,true关闭通知推送 let txnewsNotifyControl = false;//(默认腾讯新闻脚本推送通知) @@ -39,8 +45,8 @@ if (process.env.BARK_PUSH) { BARK_SOUND = process.env.BARK_SOUND } } else { - if(BARK_PUSH.indexOf('https') === -1 && BARK_PUSH.indexOf('http') === -1) { - //兼容BARK自建用户 + if(BARK_PUSH && BARK_PUSH.indexOf('https') === -1 && BARK_PUSH.indexOf('http') === -1) { + //兼容BARK本地用户只填写设备码的情况 BARK_PUSH = `https://api.day.app/${BARK_PUSH}` } } @@ -51,6 +57,13 @@ if (process.env.TG_USER_ID) { TG_USER_ID = process.env.TG_USER_ID; } +if (process.env.DD_BOT_TOKEN) { + DD_BOT_TOKEN = process.env.DD_BOT_TOKEN; + if (process.env.DD_BOT_SECRET) { + DD_BOT_SECRET = process.env.DD_BOT_SECRET; + } +} + if (process.env.YOUTH_NOTIFY_CONTROL) { youthNotifyControl = process.env.YOUTH_NOTIFY_CONTROL; } @@ -62,6 +75,7 @@ async function sendNotify(text, desp) { await serverNotify(text, desp); await BarkNotify(text, desp); await tgBotNotify(text, desp); + await ddBotNotify(text, desp) } function serverNotify(text, desp) { @@ -168,6 +182,72 @@ function tgBotNotify(text, desp) { } }) } +function ddBotNotify(text, desp) { + return new Promise(resolve => { + const options = { + url: `https://oapi.dingtalk.com/robot/send?access_token=${DD_BOT_TOKEN}`, + json: { + "msgtype": "text", + "text": { + "content": ` ${text}\n\n${desp}` + } + }, + headers: { + 'Content-Type': 'application/json' + } + } + if (DD_BOT_TOKEN && DD_BOT_SECRET) { + const crypto = require('crypto'); + const dateNow = Date.now(); + const hmac = crypto.createHmac('sha256', DD_BOT_SECRET); + hmac.update(`${dateNow}\n${DD_BOT_SECRET}`); + const result = encodeURIComponent(hmac.digest('base64')); + options.url = `${options.url}×tamp=${dateNow}&sign=${result}`; + $.post(options, (err, resp, data) => { + try { + if (err) { + console.log('\n钉钉发送通知消息失败!!\n') + console.log(err); + } else { + data = JSON.parse(data); + if (data.errcode === 0) { + console.log('\n钉钉发送通知消息完成。\n') + } else { + console.log(`\n${data.errmsg}\n`) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(data); + } + }) + } else if (DD_BOT_TOKEN) { + $.post(options, (err, resp, data) => { + try { + if (err) { + console.log('\n钉钉发送通知消息失败!!\n') + console.log(err); + } else { + data = JSON.parse(data); + if (data.errcode === 0) { + console.log('\n钉钉发送通知消息完成。\n') + } else { + console.log(`\n${data.errmsg}\n`) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve(data); + } + }) + } else { + console.log('\n您未提供钉钉机器人推送所需的DD_BOT_TOKEN或者DD_BOT_SECRET,取消钉钉推送消息通知\n'); + resolve() + } + }) +} module.exports = { sendNotify, BarkNotify, @@ -175,6 +255,7 @@ module.exports = { BARK_PUSH, TG_BOT_TOKEN, TG_USER_ID, + DD_BOT_TOKEN, txnewsNotifyControl, youthNotifyControl } diff --git a/app.js b/app.js deleted file mode 100644 index e4da561783..0000000000 --- a/app.js +++ /dev/null @@ -1,66 +0,0 @@ -// version v0.0.1 -// create by ruicky -// detail url: https://github.com/ruicky/jd_sign_bot - -const exec = require('child_process').execSync -const fs = require('fs') -const rp = require('request-promise') -const download = require('download') - -// 公共变量 -const KEY = process.env.JD_COOKIE -const serverJ = process.env.PUSH_KEY - -async function downFile () { - // const url = 'https://cdn.jsdelivr.net/gh/NobyDa/Script@master/JD-DailyBonus/JD_DailyBonus.js' - const url = 'https://raw.githubusercontent.com/NobyDa/Script/master/JD-DailyBonus/JD_DailyBonus.js' - await download(url, './') -} - -async function changeFiele () { - let content = await fs.readFileSync('./JD_DailyBonus.js', 'utf8') - content = content.replace(/var Key = ''/, `var Key = '${KEY}'`) - await fs.writeFileSync( './JD_DailyBonus.js', content, 'utf8') -} - -async function sendNotify (text,desp) { - const options ={ - uri: `https://sc.ftqq.com/${serverJ}.send`, - form: { text, desp }, - json: true, - method: 'POST' - } - await rp.post(options).then(res=>{ - console.log(res) - }).catch((err)=>{ - console.log(err) - }) -} - -async function start() { - if (!KEY) { - console.log('请填写 key 后在继续') - return - } - // 下载最新代码 - await downFile(); - console.log('下载代码完毕') - // 替换变量 - await changeFiele(); - console.log('替换变量完毕') - // 执行 - await exec("node JD_DailyBonus.js >> result.txt"); - console.log('执行完毕') - - if (serverJ) { - const path = "./result.txt"; - let content = ""; - if (fs.existsSync(path)) { - content = fs.readFileSync(path, "utf8"); - } - await sendNotify("京东签到-" + new Date().toLocaleDateString(), content); - console.log('发送结果完毕') - } -} - -start() \ No newline at end of file From 337c09186703c100015992130f43de23c21a1111 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 20:36:06 +0800 Subject: [PATCH 050/266] --- Task/jingxi.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Task/jingxi.js b/Task/jingxi.js index de64fd9532..4e05c4cc25 100644 --- a/Task/jingxi.js +++ b/Task/jingxi.js @@ -1,5 +1,5 @@ /* -更新时间:09-16 09:05 +更新时间:10-09 20:05 本脚本为京东旗下京喜app签到脚本 本脚本使用京东公共Cooike,支持双账号,获取方法请查看NobyDa大佬脚本说明 @@ -41,7 +41,10 @@ if ($.isNode()) { await Tasklist(); await doublesign(); await coininfo(); - await showmsg() + await showmsg(); + if ($.isNode()){ + await notify.sendNotify($.name + " 账号昵称:" + nickname, $.sub+`\n`+$.desc) + } } } })() @@ -193,9 +196,6 @@ function showmsg() { $.desc = signdays +doubleres+ '\n' + "今日签到得" + todaypoint + "个金币 共计" + (daytotal+todaypoint)+'个金币' $.msg($.name + " 账号昵称:" + nickname, $.sub, $.desc) } - if ($.isNode()){ - await notify.sendNotify($.name + " 账号昵称:" + nickname, $.sub+`\n`+$.desc) - } resolve() }) } From 080538de903e6697d242a45303608cf8cbb3a106 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 20:50:10 +0800 Subject: [PATCH 051/266] --- Task/jdCookie.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Task/jdCookie.js b/Task/jdCookie.js index 0a1dde0d12..6c64accb94 100644 --- a/Task/jdCookie.js +++ b/Task/jdCookie.js @@ -8,7 +8,15 @@ let CookieJDs = [ ] // 判断github action里面是否有京东ck if (process.env.JD_COOKIE && process.env.JD_COOKIE.split('&') && process.env.JD_COOKIE.split('&').length > 0) { - CookieJDs = process.env.JD_COOKIE.split('&'); + if (process.env.JD_COOKIE.indexOf('&') > -1) { + console.log(`您的cookie选择的是用&隔开\n`) + CookieJDs = process.env.JD_COOKIE.split('&'); + } else if (process.env.JD_COOKIE.indexOf('\n') > -1) { + console.log(`您的cookie选择的是用换行隔开\n`) + CookieJDs = process.env.JD_COOKIE.split('\n'); + } else { + CookieJDs = process.env.JD_COOKIE.split(); + } console.log(`\n==================脚本执行来自 github action=====================\n`) console.log(`==================脚本执行-国际标准时间(UTC):${new Date().toLocaleString()}=====================\n`) console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=====================\n`) From 0be708cd21672702d50e8d4d2f6f2737c4ab4fa8 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 22:27:32 +0800 Subject: [PATCH 052/266] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=AE=E5=8D=9Ack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/weibo.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index 74ca718add..710266b287 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -1,5 +1,5 @@ /* -更新时间: 2020-09-07 21:25 +更新时间: 2020-10-09 22:25 本脚本仅适用于微博每日签到 获取Cookie方法: @@ -16,7 +16,7 @@ Surge 4.0 : weibo.js = type=cron,cronexp=35 5 0 * * *,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js,script-update-interval=0 # 获取微博 Cookie. -weibo.js = type=http-request,pattern=https:\/\/api\.weibo\.cn\/\d\/video\/machine\?gsid,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js +weibo.js = type=http-request,pattern=https:\/\/api\.weibo\.cn\/\d\/[a-z]+\/\w+\?gsid,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js # 微博钱包签到Cookie weibo.js = type=http-request,pattern=https:\/\/pay\.sc\.weibo\.com\/aj\/mobile\/home\/welfare\/signin\/do\?,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js @@ -26,7 +26,7 @@ Loon 2.1.0+ # 本地脚本 cron "04 00 * * *" script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js, enabled=true, tag=新浪微博 -http-request https:\/\/api\.weibo\.cn\/\d\/video\/machine\?gsid script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js +http-request https:\/\/api\.weibo\.cn\/\d\/[a-z]+\/\w+\?gsid script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js http-request https:\/\/pay\.sc\.weibo\.com\/aj\/mobile\/home\/welfare\/signin\/do\? script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js @@ -37,7 +37,7 @@ QX 1.0.6+ : 0 9 * * * https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js [rewrite_local] -https:\/\/api\.weibo\.cn\/\d\/video\/machine\?gsid url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js +https:\/\/api\.weibo\.cn\/\d\/[a-z]+\/\w+\?gsid url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js # 钱包签到Cookie https:\/\/pay\.sc\.weibo\.com\/aj\/mobile\/home\/welfare\/signin\/do\? url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js @@ -70,7 +70,7 @@ if (isGetCookie = typeof $request !==`undefined`) { } function GetCookie() { -if ($request && $request.method != 'OPTIONS' && $request.url.match(/\/video\/machine/)) { +if ($request && $request.method != 'OPTIONS' && $request.url.match(/\/\d\/[a-z]+\/\w+\?gsid/)) { const signurlVal = $request.url const token = signurlVal.split(`?`)[1] const signheaderVal = JSON.stringify($request.headers) From 869215968ef28e751e5f84178c93f3669d6786ae Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 9 Oct 2020 22:45:42 +0800 Subject: [PATCH 053/266] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=BE=AE=E5=8D=9Ack?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/weibo.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index 710266b287..35b224d44c 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -16,7 +16,7 @@ Surge 4.0 : weibo.js = type=cron,cronexp=35 5 0 * * *,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js,script-update-interval=0 # 获取微博 Cookie. -weibo.js = type=http-request,pattern=https:\/\/api\.weibo\.cn\/\d\/[a-z]+\/\w+\?gsid,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js +weibo.js = type=http-request,pattern=https:\/\/api\.weibo\.cn\/\d\/page\/\w+\?gsid,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js # 微博钱包签到Cookie weibo.js = type=http-request,pattern=https:\/\/pay\.sc\.weibo\.com\/aj\/mobile\/home\/welfare\/signin\/do\?,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js @@ -26,7 +26,7 @@ Loon 2.1.0+ # 本地脚本 cron "04 00 * * *" script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js, enabled=true, tag=新浪微博 -http-request https:\/\/api\.weibo\.cn\/\d\/[a-z]+\/\w+\?gsid script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js +http-request https:\/\/api\.weibo\.cn\/\d\/page\/\w+\?gsid script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js http-request https:\/\/pay\.sc\.weibo\.com\/aj\/mobile\/home\/welfare\/signin\/do\? script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js @@ -37,7 +37,7 @@ QX 1.0.6+ : 0 9 * * * https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js [rewrite_local] -https:\/\/api\.weibo\.cn\/\d\/[a-z]+\/\w+\?gsid url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js +https:\/\/api\.weibo\.cn\/\d\/page\/\w+\?gsid url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js # 钱包签到Cookie https:\/\/pay\.sc\.weibo\.com\/aj\/mobile\/home\/welfare\/signin\/do\? url script-request-header https://raw.githubusercontent.com/Sunert/Scripts/master/Task/weibo.js From 4048ea58befdeca37008bd2839d21df5bf90a85e Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 10 Oct 2020 10:47:41 +0800 Subject: [PATCH 054/266] --- Task/jddj.js | 1 - Task/jingxi.js | 18 +++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Task/jddj.js b/Task/jddj.js index 24a7007f19..8c9b5f1932 100644 --- a/Task/jddj.js +++ b/Task/jddj.js @@ -143,7 +143,6 @@ async function showmsg() { } $.detail = gettoday+ `\n`+"已签到"+signdays+"天 "+tompoint $.msg(CookieName, $.subtitle, $.detail) - $.done() } function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/jingxi.js b/Task/jingxi.js index 4e05c4cc25..137fb1b7b0 100644 --- a/Task/jingxi.js +++ b/Task/jingxi.js @@ -25,7 +25,6 @@ if ($.isNode()) { cookiesArr.push($.getdata('CookieJD')); cookiesArr.push($.getdata('CookieJD2')) } - !(async () => { if (!cookiesArr[0]) { $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); @@ -34,7 +33,7 @@ if ($.isNode()) { for (let i = 0; i < cookiesArr.length; i++) { if (cookiesArr[i]) { cookie = cookiesArr[i]; - UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1]) + UserName = decodeURIComponent(cookie.match(/pt_pin=(\w+)/) && cookie.match(/pt_pin=(\w+)/)[1]) $.index = i + 1; console.log(`\n开始【京东账号${$.index}】${UserName}\n`); await getsign(); @@ -62,18 +61,19 @@ function getsign() { }, } $.get(signurl, (err, resp, data) => { - if (data.match(/"retCode":\d+/) == '"retCode":0') { - nickname = data.split(':')[6].split(',')[0].replace(/[\"]+/g, "") - totalpoints = data.match(/[0-9]+/g)[3] - signdays = "已签" + data.match(/[0-9]+/g)[6] + "天" - if (data.match(/[0-9]+/g)[9] == 0) { + signres = JSON.parse(data) + if (signres.retCode == '0') { + nickname = signres.data.nickname + totalpoints = signres.data.pgAmountTotal + signdays = "已签" + signres.data.signDays + "天" + if (signres.data.signStatus == 0) { signresult = "签到成功" signdays += " 今日获得" + data.match(/[0-9]+/g)[4] + "积分" - } else if (data.match(/[0-9]+/g)[9] == 1) { + } else if (signres.data.signStatus == 1) { signresult = "签到重复" } - } else if (data.match(/"retCode":\d+/) == '"retCode":30003') { + } else if (signres.retCode == '30003') { $.msg($.name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); } resolve() From 6d721920c9868888e6fa2ff903173ec5c08c0b1d Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 12 Oct 2020 13:56:03 +0800 Subject: [PATCH 055/266] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B5=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/telecomInfinity.js | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index 4b3efded34..a2389ef5f4 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -180,14 +180,13 @@ function parseData(detail, balance, info, bill) { } function notify(data, balance, exdata, bldata) { -//console.log(data.items) try{ var subtitle = "" if (config.info) { subtitle = "【手机】" + exdata.mobileShort + " (" + exdata.province + "-" + exdata.city + ")" } let productname = "中国电信", voiceAmount = " ", voiceUsage = " ", voiceBalance = " ", msgUsage = "", msgBalance = "", msgAmount = "",usagedCommon,balanceCommon,totalCommon; - + if(data.usedCommon){ usagedCommon = formatFlow(data.usedCommon/1024) } @@ -200,25 +199,39 @@ function notify(data, balance, exdata, bldata) { for (i=0;i Date: Mon, 12 Oct 2020 14:59:23 +0800 Subject: [PATCH 056/266] fix --- Task/telecomInfinity.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index a2389ef5f4..ca4e23fad7 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -218,9 +218,6 @@ if(data.items[i].items[k].nameType == '401100'||data.items[i].items[k].nameType //console.log(data.items) //套餐信息 if (data.items[i].offerType == '11'|| data.items[i].offerType == '21') { productname = data.items[i].productOFFName - } -else if (data.items[i].offerType == '19'&&data.items[i].items[k].nameType != "331101") { - productname = data.items[i].productOFFName }; //主套餐名称 if(data.items[i].items[k].nameType == "331101"){ usagedCommon = formatFlow(data.items[i].items[k].usageAmount/1024) @@ -229,8 +226,8 @@ if(data.items[i].items[k].nameType == "331101"){ } // 畅享套餐 else if(data.items[i].items[k].nameType == "331100"){ usagedCommon = formatFlow(data.items[i].items[k].usageAmount/1024) - balanceCommon = data.items[i].items[k].balanceAmount - totalCommon = data.items[i].ratableAmount + balanceCommon = formatFlow(data.items[i].items[k].balanceAmount/1024) + totalCommon = formatFlow(data.items[i].items[k].ratableAmount/1024) }; } } From e573adedc046d807ccb139ae377074e43d918846 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 12 Oct 2020 15:23:33 +0800 Subject: [PATCH 057/266] --- Task/telecomInfinity.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index ca4e23fad7..662d23af29 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -180,13 +180,13 @@ function parseData(detail, balance, info, bill) { } function notify(data, balance, exdata, bldata) { + let productname = "中国电信", voiceAmount = " ", voiceUsage = " ", voiceBalance = " ", msgUsage = "", msgBalance = "", msgAmount = "",usagedCommon,balanceCommon,totalCommon,message; +//console.log(data.items) //套餐信息 try{ var subtitle = "" if (config.info) { subtitle = "【手机】" + exdata.mobileShort + " (" + exdata.province + "-" + exdata.city + ")" } - let productname = "中国电信", voiceAmount = " ", voiceUsage = " ", voiceBalance = " ", msgUsage = "", msgBalance = "", msgAmount = "",usagedCommon,balanceCommon,totalCommon; - if(data.usedCommon){ usagedCommon = formatFlow(data.usedCommon/1024) } @@ -209,15 +209,16 @@ else if(data.items[i].items[k].nameType == '131100'){ voiceBalance = data.items[i].items[k].balanceAmount voiceUsage = data.items[i].items[k].usageAmount }; //语音余量 - if(data.items[i].items[k].nameType == '401100'||data.items[i].items[k].nameType == '431100'){ msgUsage = data.items[i].items[k].usageAmount msgAmount = data.items[i].items[k].ratableAmount msgBalance = data.items[i].items[k].balanceAmount }; //短信余量 -//console.log(data.items) //套餐信息 if (data.items[i].offerType == '11'|| data.items[i].offerType == '21') { productname = data.items[i].productOFFName + } +else if (data.items[i].offerType == '19'&&data.items[i].items[k].nameType != "331101") { + productname = data.items[i].productOFFName }; //主套餐名称 if(data.items[i].items[k].nameType == "331101"){ usagedCommon = formatFlow(data.items[i].items[k].usageAmount/1024) @@ -248,9 +249,9 @@ if(data.items[i].items[k].nameType == "331101"){ catch(err){ console.log("查询错误,错误原因:"+ err+'\n套餐响应数据:'+JSON.stringify(data)+'\n请将以上数据机主姓名删除后反馈给作者') };//以上为套餐用量 + //console.log(bldata.items) //账单信息 try{ message += "\n" +"【话费】剩余: " + (Number(balance.totalBalanceAvailable)/100).toFixed(2) + "元" - //console.log(bldata.items) //账单信息 if (bldata != '无'){message += ` ${M}月消费合计: `+ bldata.items[0].sumCharge/100+'元'}; if (bldata == '无'){ message = message + "\n" + `【${M}月账单】 `+ bldata From c1012c79ae751ddef6f403e7831b7711d583810a Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 12 Oct 2020 18:05:11 +0800 Subject: [PATCH 058/266] fix telephone --- Task/telecomInfinity.js | 151 +++++++++++++++++++--------------------- 1 file changed, 72 insertions(+), 79 deletions(-) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index 662d23af29..f413a91987 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -1,4 +1,5 @@ /** +更新时间: 2028-10-12 18:05 1.根据原版脚本修改,增加上月账单信息,需重新获取Cookie,打开app即可 2.适合流量畅享套餐使用,其他套餐,自行测试,此项仅供测试 3.可能因地区不同,脚本不一定适用 @@ -180,93 +181,85 @@ function parseData(detail, balance, info, bill) { } function notify(data, balance, exdata, bldata) { + return new Promise((resolve) => { let productname = "中国电信", voiceAmount = " ", voiceUsage = " ", voiceBalance = " ", msgUsage = "", msgBalance = "", msgAmount = "",usagedCommon,balanceCommon,totalCommon,message; -//console.log(data.items) //套餐信息 - try{ + //console.log(data) //套餐信息 + try { var subtitle = "" if (config.info) { subtitle = "【手机】" + exdata.mobileShort + " (" + exdata.province + "-" + exdata.city + ")" + } //手机号码 + for (i = 0; i < data.items.length; i++) { + for (k = 0; k < data.items[i].items.length; k++) { + let item = data.items[i].items[k] + if (data.items[i].offerType == '11' || data.items[i].offerType == '21') { + productname = data.items[i].productOFFName + } else { + productname = data.items[0].productOFFName + } + message = "【套餐】" + productname; //主套餐名称 + if (item.nameType == '401100' || item.nameType == '431100') { + msgUsage = item.usageAmount, + msgAmount = item.ratableAmount, + msgBalance = item.balanceAmount + } + if (msgUsage) { + msginfo = "【短信】已用: " + msgUsage + "条 剩余: " + msgBalance + "条 合计: " + msgAmount + "条", + message += "\n" + msginfo + }; //短信余量 + let VoiceArr = data.items[i].items; + if (item.nameType == '131100') { + for ( Voiceiterm of VoiceArr) + voiceAmount = Voiceiterm.ratableAmount, + voiceBalance = Voiceiterm.balanceAmount, + voiceUsage = Voiceiterm.usageAmount; + voice = "【通话】已用: " + voiceUsage + "分钟 剩余: " + voiceBalance + "分钟 合计: " + voiceAmount + "分钟" + } + message += "\n" + voice; //语音 + + if (item.nameType == "331101") { + usagedCommon = formatFlow(item.usageAmount / 1024), + balanceCommon = item.ratableResourcename, + totalCommon = data.items[i].productOFFName + } // 畅享套餐 + else if (item.nameType == "331100") { + usagedCommon = formatFlow(item.usageAmount / 1024), + balanceCommon = formatFlow(item.balanceAmount / 1024), + totalCommon = formatFlow(item.ratableAmount / 1024) + }; //套餐流量 + if (usagedCommon) { + flow = "【流量】已用: " + usagedCommon + " 剩余:" + balanceCommon + " 合计:" + totalCommon, + message += "\n" + flow + } + } } - if(data.usedCommon){ - usagedCommon = formatFlow(data.usedCommon/1024) -} - if(data.balanceCommon){ - balanceCommon = formatFlow(data.balanceCommon/1024) -} - if(data.totalCommon){ - totalCommon = formatFlow(data.totalCommon/1024) -} //流量信息 +} catch(err) { + console.log("查询错误,错误原因:" + err + '\n套餐响应数据:' + JSON.stringify(data) + '\n请将以上数据机主姓名删除后反馈给作者') +}; //以上为套餐用量 + + + message += "\n" + "【话费】剩余: " + (parseInt(balance.totalBalanceAvailable) / 100).toFixed(2) + "元"; //话费余额 -for (i=0;i Date: Mon, 12 Oct 2020 19:48:52 +0800 Subject: [PATCH 059/266] updata --- .github/pull.yml | 8 ++++++++ Task/Youth_Read.js | 6 +++++- Task/telecomInfinity.js | 2 +- Task/txnews.js | 2 +- Task/youth.js | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .github/pull.yml diff --git a/.github/pull.yml b/.github/pull.yml new file mode 100644 index 0000000000..d7df40b61f --- /dev/null +++ b/.github/pull.yml @@ -0,0 +1,8 @@ +# 使用方法见[@lxk0301](https://raw.githubusercontent.com/lxk0301/scripts/master/githubAction.md) + +version: "1" +rules: # Array of rules + - base: master # Required. Target branch + upstream: Sunert:master # Required. Must be in the same fork network. + mergeMethod: merge # Optional, one of [none, merge, squash, rebase, hardreset], Default: none. + mergeUnstable: true # Optional, merge pull request even when the mergeable_state is not clean. Default: false \ No newline at end of file diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 9208f3c334..04679567bf 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -1,9 +1,10 @@ /* 更新时间: 2020-09-26 8:46 +Github Actions使用方法见[@lxk0301](https://raw.githubusercontent.com/lxk0301/scripts/master/githubAction.md) 使用方法大同小异 请自行抓包,阅读文章和看视频,倒计时转一圈显示青豆到账即可,多看几篇文章和视频,获得更多包数据,抓包地址为"https://ios.baertt.com/v5/article/complete.json",在Github Actions中的Secrets新建name为'YOUTH_READ'的一个值,拷贝抓包的请求体到下面Value的文本框中,添加的请求体越多,获得青豆次数越多,本脚本不包含任何推送通知 -多个请求体时用'&'号隔开" ‼️ +多个请求体时用'&'号或者换行隔开" ‼️ */ @@ -15,6 +16,9 @@ let YOUTH_READ = [ '','',]; if (process.env.YOUTH_READ && process.env.YOUTH_READ.split('&') && process.env.YOUTH_READ.split('&').length > 0) { YouthBody = process.env.YOUTH_READ.split('&'); } + else if (process.env.YOUTH_READ && process.env.YOUTH_READ.split('\n') && process.env.YOUTH_READ.split('\n').length > 0) { + YouthBody = process.env.YOUTH_READ.split('\n'); + } Object.keys(YouthBody).forEach((item) => { if (YouthBody[item]) { ReadArr.push(YouthBody[item]) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index f413a91987..18e10cc89e 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -213,8 +213,8 @@ function notify(data, balance, exdata, bldata) { voiceAmount = Voiceiterm.ratableAmount, voiceBalance = Voiceiterm.balanceAmount, voiceUsage = Voiceiterm.usageAmount; - voice = "【通话】已用: " + voiceUsage + "分钟 剩余: " + voiceBalance + "分钟 合计: " + voiceAmount + "分钟" } + voice = "【通话】已用: " + voiceUsage + "分钟 剩余: " + voiceBalance + "分钟 合计: " + voiceAmount + "分钟" message += "\n" + voice; //语音 if (item.nameType == "331101") { diff --git a/Task/txnews.js b/Task/txnews.js index d9b7c7446b..03fe10d41e 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -47,7 +47,7 @@ Cookie获取后,请注释掉Cookie地址。 */ const $ = new Env('腾讯新闻'); const notify = $.isNode() ? require('./sendNotify') : ''; -let s = Number($.getdata('delay'))||200 // 间隔延迟时间 +let s = parseInt($.getdata('delay'))||200 // 间隔延迟时间 let notifyInterval =$.getdata('notifynum')||50; //阅读篇数间隔通知开为1,常关为0; const TX_HOST = 'https://api.inews.qq.com/activity/v1/' let SignArr = [],signurlVal = ""; diff --git a/Task/youth.js b/Task/youth.js index 836a6c39b5..868718b318 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -225,7 +225,7 @@ function sign() { signresult = `【签到结果】重复`; detail = ""; if(runtimes!==undefined){ - $.setdata(`${Number(runtimes)+1}`,'times') + $.setdata(`${parseInt(runtimes)+1}`,'times') } } resolve() From 77814a1a4be76505fc311bc537c9e16e4844eff8 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 12 Oct 2020 20:19:59 +0800 Subject: [PATCH 060/266] --- Task/telecomInfinity.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index 18e10cc89e..6a8b9775eb 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -1,5 +1,5 @@ /** -更新时间: 2028-10-12 18:05 +更新时间: 2020-10-12 20:05 1.根据原版脚本修改,增加上月账单信息,需重新获取Cookie,打开app即可 2.适合流量畅享套餐使用,其他套餐,自行测试,此项仅供测试 3.可能因地区不同,脚本不一定适用 @@ -62,22 +62,25 @@ var requests = { url: "https://e.189.cn/store/user/balance_new.do", headers: { "authToken": AUTHTOKEN, - "type": "alipayMiniApp" + "type": "alipayMiniApp", + "User-Agent": "TYUserCenter/2.8 (iPhone; iOS 14.0; Scale/3.00)" }, - method: "GET" + body: "t=tysuit", + method: "POST" }, info: { url: "https://e.189.cn/store/user/getExtInfo.do", headers: { "authToken": AUTHTOKEN, - "type": "alipayMiniApp" + "type": "alipayMiniApp", + // "Cookie": COOKIE }, method: "GET" }, bill: { url: `https://e.189.cn/store/user/bill.do?year=${Y}&month=${M}&t=tysuit`, headers: { - "Cookie": COOKIE, + "Cookie": COOKIE }, method: "GET" } @@ -212,9 +215,9 @@ function notify(data, balance, exdata, bldata) { for ( Voiceiterm of VoiceArr) voiceAmount = Voiceiterm.ratableAmount, voiceBalance = Voiceiterm.balanceAmount, - voiceUsage = Voiceiterm.usageAmount; + voiceUsage = Voiceiterm.usageAmount } - voice = "【通话】已用: " + voiceUsage + "分钟 剩余: " + voiceBalance + "分钟 合计: " + voiceAmount + "分钟" + voice = "【通话】已用: " + voiceUsage + "分钟 剩余: " + voiceBalance + "分钟 合计: " + voiceAmount + "分钟"; message += "\n" + voice; //语音 if (item.nameType == "331101") { @@ -237,8 +240,8 @@ function notify(data, balance, exdata, bldata) { console.log("查询错误,错误原因:" + err + '\n套餐响应数据:' + JSON.stringify(data) + '\n请将以上数据机主姓名删除后反馈给作者') }; //以上为套餐用量 - - message += "\n" + "【话费】剩余: " + (parseInt(balance.totalBalanceAvailable) / 100).toFixed(2) + "元"; //话费余额 + //console.log(balance) //话费余额 + message += "\n" + "【话费】剩余: " + (parseInt(balance.totalBalanceAvailable) / 100).toFixed(2) + "元"; //console.log(bldata.items) //账单信息 try { From 124d7e5d39b7227872dc898cd367d1f87f9cc597 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 10:22:37 +0800 Subject: [PATCH 061/266] --- .github/workflows/jingxi.yml | 2 +- .github/workflows/txnews.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/jingxi.yml b/.github/workflows/jingxi.yml index db6378b348..e5461d67f7 100644 --- a/.github/workflows/jingxi.yml +++ b/.github/workflows/jingxi.yml @@ -4,7 +4,7 @@ name: jingxi on: workflow_dispatch: schedule: - - cron: '5 23 * * *' + - cron: '5 5 * * *' watch: types: started jobs: diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index 4aa2ad6e9e..91841d259a 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -9,7 +9,7 @@ name: txnews on: workflow_dispatch: schedule: - - cron: '*/7 1-14 * * *' + - cron: '*/7 1-15 * * *' watch: types: started From e0a944a1f9c7039a5626e6950d9b293018f5d519 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:05:13 +0800 Subject: [PATCH 062/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=B5=E8=A7=86?= =?UTF-8?q?=E5=AE=B6,=E5=BE=AE=E5=8D=9AActions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/pull.yml | 2 +- .github/workflows/dianshijia.yml | 37 +++++++++++ .github/workflows/weibo.yml | 35 +++++++++++ Task/Youth_Read.js | 1 - Task/dianshijia.js | 88 +++++++++++++++++++++----- Task/sendNotify.js | 6 +- Task/weibo.js | 105 ++++++++++++++++++------------- Task/youth.js | 1 - 8 files changed, 213 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/dianshijia.yml create mode 100644 .github/workflows/weibo.yml diff --git a/.github/pull.yml b/.github/pull.yml index d7df40b61f..a2bbd1a57a 100644 --- a/.github/pull.yml +++ b/.github/pull.yml @@ -4,5 +4,5 @@ version: "1" rules: # Array of rules - base: master # Required. Target branch upstream: Sunert:master # Required. Must be in the same fork network. - mergeMethod: merge # Optional, one of [none, merge, squash, rebase, hardreset], Default: none. + mergeMethod: hardreset # Optional, one of [none, merge, squash, rebase, hardreset], Default: none. mergeUnstable: true # Optional, merge pull request even when the mergeable_state is not clean. Default: false \ No newline at end of file diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml new file mode 100644 index 0000000000..78ba200fda --- /dev/null +++ b/.github/workflows/dianshijia.yml @@ -0,0 +1,37 @@ + +name: dianshijia + +on: + workflow_dispatch: + schedule: + - cron: '5 5 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + steps: + - uses: actions/checkout@v1 + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: npm install + run: | + npm install + - name: '运行 【电视家】' + run: | + node Task/dianshijia.js + env: + DSJ_SIGN: ${{ secrets.DSJ_SIGN }} + DSJ_HEADERS: ${{ secrets.DSJ_HEADERS }} + DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} + DSJ_NOTIFY_CONTROL: ${{ secrets.DSJ_NOTIFY_CONTROL }} + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml new file mode 100644 index 0000000000..104971e2a0 --- /dev/null +++ b/.github/workflows/weibo.yml @@ -0,0 +1,35 @@ + +name: weibo_signin + +on: + workflow_dispatch: + schedule: + - cron: '5 18 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + steps: + - uses: actions/checkout@v1 + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: npm install + run: | + npm install + - name: '运行 【新浪微博】' + run: | + node Task/weibo.js + env: + WB_TOKEN: ${{ secrets.WB_TOKEN }} + WB_PAY: ${{ secrets.WB_PAY }} + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 04679567bf..2bb17515de 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -24,7 +24,6 @@ let YOUTH_READ = [ '','',]; ReadArr.push(YouthBody[item]) } }) - console.log(`\n============ 脚本执行来自 Github Action ==============\n`) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) !(async () => { diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 7e55942b30..5588b80ba4 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -1,8 +1,8 @@ /* -更新时间: 2020-09-08 11:21 +更新时间: 2020-10-13 21:21 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 -本脚本仅适用于电视家签到, +本脚本仅适用于电视家签到,支持Actions多账号运行 获取Cookie方法: 1.将下方[rewrite_local]和[Task]地址复制的相应的区域,无需添加 hostname,每日7点、12点、20点各运行一次,其他随意 2.APP登陆账号后,点击菜单栏'领现金',即可获取Cookie,进入提现页面,点击随机金额,可获取提现地址!! @@ -43,15 +43,68 @@ const walkstep = '20000';//每日步数设置,可设置0-20000 const gametimes = "2888"; //游戏时长 const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') -const signheaderVal = $.getdata('sy_signheader_dsj') -const drawalVal = $.getdata('drawal_dsj') -const dianshijia_API = 'http://api.gaoqingdianshi.com/api' +const dianshijia_API = 'http://api.gaoqingdianshi.com/api' +let tokenArr = [], DsjurlArr = [], DrawalArr = []; +if ($.isNode()) { + if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('&') && process.env.DSJ_HEADERS.split('&').length > 0) { + Dsjheaders = process.env.DSJ_HEADERS.split('&'); + } + else if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('\n') && process.env.DSJ_HEADERS.split('\n').length > 0) { + Dsjheaders = process.env.DSJ_HEADERS.split('\n'); + }; + if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('&') && process.env.DSJ_DRAWAL.split('&').length > 0) { + Drawals = process.env.DSJ_DRAWAL.split('&'); + } + else if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('\n') && process.env.DSJ_DRAWAL.split('\n').length > 0) { + Drawals = process.env.DSJ_DRAWAL.split('\n'); + }; + if (process.env.DSJ_SIGN && process.env.DSJ_SIGN.split('&') && process.env.DSJ_SIGN.split('&').length > 0) { + Dsjurl = process.env.DSJ_SIGN.split('&'); + } + else if (process.env.DSJ_SIGN && process.env.DSJ_SIGN.split('\n') && process.env.DSJ_SIGN.split('\n').length > 0) { + Dsjurl = process.env.DSJ_SIGN.split('\n'); + }; + Object.keys(Dsjheaders).forEach((item) => { + if (Dsjheaders[item]) { + tokenArr.push(Dsjheaders[item]) + } + }); + Object.keys(Drawals).forEach((item) => { + if (Drawals[item]) { + DrawalArr.push(Drawals[item]) + } + }); + Object.keys(Dsjurl).forEach((item) => { + if (Dsjurl[item]) { + DdjurlArr.push(Dsjurl[item]) + } + }); + console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) + } else { + tokenArr.push($.getdata('sy_signheader_dsj')) + DrawalArr.push($.getdata('drawal_dsj')) + DsjurlArr.push($.getdata('sy_signurl_dsj')) + } + if (isGetCookie = typeof $request !== 'undefined') { - GetCookie() + GetCookie(); + $.done() } else { - -!(async() => { + !(async () => { + if (!tokenArr[0]) { + $.msg($.name, '【提示】请先获取电视家一cookie') + return; + } + for (let i = 0; i < tokenArr.length; i++) { + if (tokenArr[i]) { + signurl= DsjurlArr[i]; + signheaderVal = tokenArr[i]; + drawalVal = DrawalArr[i]; + $.index = i + 1; + console.log(`-------------------------\n\n开始【电视家${$.index}】`) + } await signin(); // 签到 await signinfo(); // 签到信息 await Withdrawal(); // 金额提现 @@ -62,6 +115,10 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 + if ($.isNode()) { + await notify.sendNotify($.name, subTitle+'\n'+ detail) + } + } })() .catch((e) => $.logErr(e)) .finally(() => $.done()) @@ -82,7 +139,6 @@ function GetCookie() { if (drawalVal) $.setdata(drawalVal, 'drawal_dsj') $.msg($.name, `获取提现地址: 成功`, ``) } - $.done() } var date = new Date(); @@ -104,7 +160,7 @@ function GetCookie() { function signin() { return new Promise((resolve, reject) => { - $.get({url: $.getdata('sy_signurl_dsj'), headers: JSON.parse(signheaderVal)}, (error, response, data) => + $.get({url: signurl, headers: JSON.parse(signheaderVal)}, async(error, response, data) => { if(logs)$.log(`${$.name}, 签到结果: ${data}\n`) const result = JSON.parse(data) @@ -125,8 +181,12 @@ function signin() { { subTitle = `【签到结果】 失败` detail = `原因: ${result.msg}` + if ($.isNode()) { + await notify.sendNotify($.name,subTitle+'\n'+detail) + } + return } - resolve() + resolve() }) }) } @@ -378,7 +438,7 @@ function CarveUp() { headers: JSON.parse(signheaderVal), } $.get(url, (error, response, data) => { - $.log(`瓜分百万金币: ${data}`) + if(logs)$.log(`瓜分百万金币: ${data}`) const result = JSON.parse(data) if (result.errCode == 0) { detail += `【金币瓜分】✅ 报名成功\n` @@ -401,7 +461,7 @@ function getCUpcoin() { } function Withdrawal() { return new Promise((resolve, reject) => { - if (drawalVal !=undefined||null){ + if (drawalVal !=undefined){ let url = { url: drawalVal, headers: JSON.parse(signheaderVal), @@ -412,7 +472,7 @@ function Withdrawal() { if (result.errCode == 0) { detail += `【金额提现】✅ 到账`+result.data.price/100+`元 🌷\n` } - resolve() + resolve() }) } else { diff --git a/Task/sendNotify.js b/Task/sendNotify.js index ae7949b3ca..4a41353090 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -70,6 +70,9 @@ if (process.env.YOUTH_NOTIFY_CONTROL) { if (process.env.TXNEWS_NOTIFY_CONTROL) { txnewsNotifyControl = process.env.TXNEWS_NOTIFY_CONTROL; } +if (process.env.DSJ_NOTIFY_CONTROL) { + dsjNotifyControl = process.env.DSJ_NOTIFY_CONTROL; +} async function sendNotify(text, desp) { //提供三种通知 await serverNotify(text, desp); @@ -257,7 +260,8 @@ module.exports = { TG_USER_ID, DD_BOT_TOKEN, txnewsNotifyControl, - youthNotifyControl + youthNotifyControl, + dsjNotifyControl } // prettier-ignore function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file diff --git a/Task/weibo.js b/Task/weibo.js index 35b224d44c..ac32a04673 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -1,7 +1,7 @@ /* -更新时间: 2020-10-09 22:25 +更新时间: 2020-10-13 21:25 -本脚本仅适用于微博每日签到 +本脚本仅适用于微博每日签到,支持Actions多账号运行 获取Cookie方法: 1.将下方[rewrite_local]和[MITM]地址复制的相应的区域下 2.打开微博App,刷微博视频,获取Cookie,获取后请注释或禁用Cookie @@ -49,21 +49,59 @@ hostname = api.weibo.cn, pay.sc.weibo.com */ const $ = new Env('新浪微博') -const token = $.getdata('sy_token_wb') -const payheaderVal = $.getdata('sy_payheader_wb') - +let tokenArr = [],payArr = []; +if ($.isNode()) { + if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('&') && process.env.WB_TOKEN.split('&').length > 0) { + wbtoken = process.env.WB_TOKEN.split('&'); + } + else if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('\n') && process.env.WB_TOKEN.split('\n').length > 0) { + wbtoken = process.env.WB_TOKEN.split('\n'); + }; + if (process.env.WB_PAY && process.env.WB_PAY.split('&') && process.env.WB_PAY.split('&').length > 0) { + wbPay = process.env.WB_PAY.split('&'); + } + else if (process.env.WB_PAY && process.env.WB_PAY.split('\n') && process.env.WB_PAY.split('\n').length > 0) { + wbPay = process.env.WB_PAY.split('\n'); + }; + Object.keys(wbtoken).forEach((item) => { + if (wbtoken[item]) { + tokenArr.push(wbtoken[item]) + } + }); + Object.keys(wbPay).forEach((item) => { + if (wbPay[item]) { + payArr.push(wbPay[item]) + } + }); + console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) + } else { + tokenArr.push($.getdata('sy_token_wb')) + payArr.push($.getdata('sy_payheader_wb')) + } + if (isGetCookie = typeof $request !==`undefined`) { GetCookie() } else { - !(async() => { - await getsign(); - await doCard(); - if (payheaderVal !== undefined||null){ - await paysign() - }; - //await getst(); - //await userinfo(); - await showmsg() + !(async () => { + if (!tokenArr[0]) { + $.msg($.name, '【提示】请先获取新浪微博一cookie') + return; + } + for (let i = 0; i < tokenArr.length; i++) { + if (tokenArr[i]) { + token = tokenArr[i]; + payheaderVal = payArr[i]; + $.index = i + 1; + console.log(`-------------------------\n\n开始【微博签到${$.index}】`) + } + await getsign(); + await doCard(); + if (payheaderVal !== undefined){ + await paysign() + }; + await showmsg() + } })() .catch((e) => $.logErr(e)) .finally(() => $.done()) @@ -97,7 +135,7 @@ function getsign() { let signurl = { url: `https://api.weibo.cn/2/checkin/add?${token}`, headers: {"User-Agent": `Weibo/46902 (iPhone; iOS 14; Scale/3.00)`}} - $.post(signurl, (error, response, data) => { + $.post(signurl, async(error, response, data) => { let result = JSON.parse(data) if (result.status == 10000){ wbsign = `【微博签到】✅ 连续签到${result.data.continuous}天,收益: ${result.data.desc}💰\n` @@ -111,6 +149,9 @@ function getsign() { else { wbsign = `【每日签到】 ❌ 签到失败`+result.errmsg $.msg($.name, wbsign, ``) + if ($.isNode()) { + await notify.sendNotify($.name, wbsign) + } return } resolve() @@ -162,40 +203,16 @@ $.post(payurl, (error, response, data) => { }) } -function getst() { - return new Promise((resolve, reject) =>{ - let sturl = { - url: `https://m.weibo.cn/c/checkin?ua=iPhone10%2C2__weibo__10.8.3__iphone__os14&from=10A8393010`, - headers: JSON.parse($.getdata('infoheader_wb'))} - sturl.headers['Accept']='json' -$.post(sturl, (error, response, data) => { - st = data.split(":")[7].replace("login","").replace(/[\'\,\s]+/g,"") - resolve() - }) - }) -} - -function userinfo() { - return new Promise((resolve, reject) =>{ - let infourl = { - url: `https://m.weibo.cn/c/checkin/ug/v2/signin/signin?st=${st}`, - headers: JSON.parse($.getdata('infoheader_wb')) -} - //console.log(infourl) -$.post(infourl, (error, response, data) => { - $.log(data) - resolve() - }) - }) -} - -function showmsg() { - if (payheaderVal == undefined||null){ +async function showmsg() { + if (payheaderVal == undefined){ paybag = `【钱包签到】❌ 未获取Cooiekie` } $.sub = nickname $.desc = wbsign+paybag+docard $.msg($.name, $.sub, $.desc) + if ($.isNode()) { + await notify.sendNotify($.name, $.sub+'\n'+ $.desc) + } } function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/Task/youth.js b/Task/youth.js index 868718b318..d313cabc47 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -114,7 +114,6 @@ if ($.isNode()) { timeArr.push(READTIME[item]) } }) - console.log(`\n============ 脚本执行来自 Github Action ==============\n`) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) } else { From b2fcf020d3b259ef5d16ba4f88eaa4daaaab03f9 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:12:25 +0800 Subject: [PATCH 063/266] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=B5=E8=A7=86?= =?UTF-8?q?=E5=AE=B6=E8=BF=90=E8=A1=8C=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/dianshijia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index 78ba200fda..0c6b1c66ff 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -4,7 +4,7 @@ name: dianshijia on: workflow_dispatch: schedule: - - cron: '5 5 * * *' + - cron: '*/29 4,12,23 * * *' watch: types: started jobs: From 4f4c6fb6707987cb61d733ea77650c0e515a42f2 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:21:08 +0800 Subject: [PATCH 064/266] --- Task/dianshijia.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 5588b80ba4..8c9f50b7a4 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -2,7 +2,7 @@ /* 更新时间: 2020-10-13 21:21 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 -本脚本仅适用于电视家签到,支持Actions多账号运行 +本脚本仅适用于电视家签到,支持Actions多账号运行,请用'#'或者换行隔开‼️ 获取Cookie方法: 1.将下方[rewrite_local]和[Task]地址复制的相应的区域,无需添加 hostname,每日7点、12点、20点各运行一次,其他随意 2.APP登陆账号后,点击菜单栏'领现金',即可获取Cookie,进入提现页面,点击随机金额,可获取提现地址!! @@ -47,20 +47,20 @@ const $ = new Env('电视家') const dianshijia_API = 'http://api.gaoqingdianshi.com/api' let tokenArr = [], DsjurlArr = [], DrawalArr = []; if ($.isNode()) { - if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('&') && process.env.DSJ_HEADERS.split('&').length > 0) { - Dsjheaders = process.env.DSJ_HEADERS.split('&'); + if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('#') && process.env.DSJ_HEADERS.split('#').length > 0) { + Dsjheaders = process.env.DSJ_HEADERS.split('#'); } else if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('\n') && process.env.DSJ_HEADERS.split('\n').length > 0) { Dsjheaders = process.env.DSJ_HEADERS.split('\n'); }; - if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('&') && process.env.DSJ_DRAWAL.split('&').length > 0) { - Drawals = process.env.DSJ_DRAWAL.split('&'); + if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('#') && process.env.DSJ_DRAWAL.split('#').length > 0) { + Drawals = process.env.DSJ_DRAWAL.split('#'); } else if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('\n') && process.env.DSJ_DRAWAL.split('\n').length > 0) { Drawals = process.env.DSJ_DRAWAL.split('\n'); }; - if (process.env.DSJ_SIGN && process.env.DSJ_SIGN.split('&') && process.env.DSJ_SIGN.split('&').length > 0) { - Dsjurl = process.env.DSJ_SIGN.split('&'); + if (process.env.DSJ_SIGN && process.env.DSJ_SIGN.split('#') && process.env.DSJ_SIGN.split('#').length > 0) { + Dsjurl = process.env.DSJ_SIGN.split('#'); } else if (process.env.DSJ_SIGN && process.env.DSJ_SIGN.split('\n') && process.env.DSJ_SIGN.split('\n').length > 0) { Dsjurl = process.env.DSJ_SIGN.split('\n'); From cef041ea3522bcb2540c45afc61578ed852b3735 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:24:09 +0800 Subject: [PATCH 065/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 8c9f50b7a4..404b25e0ee 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -77,7 +77,7 @@ if ($.isNode()) { }); Object.keys(Dsjurl).forEach((item) => { if (Dsjurl[item]) { - DdjurlArr.push(Dsjurl[item]) + DsjurlArr.push(Dsjurl[item]) } }); console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) From ea2b0b22807b2a5a9754de7d1167c938f378f8cd Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:29:16 +0800 Subject: [PATCH 066/266] --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 404b25e0ee..89846d2505 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -104,7 +104,6 @@ if (isGetCookie = typeof $request !== 'undefined') { drawalVal = DrawalArr[i]; $.index = i + 1; console.log(`-------------------------\n\n开始【电视家${$.index}】`) - } await signin(); // 签到 await signinfo(); // 签到信息 await Withdrawal(); // 金额提现 @@ -118,7 +117,8 @@ if (isGetCookie = typeof $request !== 'undefined') { if ($.isNode()) { await notify.sendNotify($.name, subTitle+'\n'+ detail) } - } + } + } })() .catch((e) => $.logErr(e)) .finally(() => $.done()) From 8a011064df21dbad11ab741efd2d8de6c30f0df3 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:32:26 +0800 Subject: [PATCH 067/266] test --- Task/dianshijia.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 89846d2505..42a95bb046 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -101,6 +101,7 @@ if (isGetCookie = typeof $request !== 'undefined') { if (tokenArr[i]) { signurl= DsjurlArr[i]; signheaderVal = tokenArr[i]; + console.log(signheaderVal) drawalVal = DrawalArr[i]; $.index = i + 1; console.log(`-------------------------\n\n开始【电视家${$.index}】`) From 0f6901f88f189b887c90db4d538201f91c188dbb Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:36:56 +0800 Subject: [PATCH 068/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 42a95bb046..48609e91ac 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -101,7 +101,7 @@ if (isGetCookie = typeof $request !== 'undefined') { if (tokenArr[i]) { signurl= DsjurlArr[i]; signheaderVal = tokenArr[i]; - console.log(signheaderVal) + console.log(tokenArr) drawalVal = DrawalArr[i]; $.index = i + 1; console.log(`-------------------------\n\n开始【电视家${$.index}】`) From 8d2236f33630265048d8f0f082cdda5be7b24e64 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:46:08 +0800 Subject: [PATCH 069/266] fix --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 48609e91ac..bd6b1fad52 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -43,6 +43,7 @@ const walkstep = '20000';//每日步数设置,可设置0-20000 const gametimes = "2888"; //游戏时长 const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') +const notify = $.isNode() ? require('./sendNotify') : ''; const dianshijia_API = 'http://api.gaoqingdianshi.com/api' let tokenArr = [], DsjurlArr = [], DrawalArr = []; @@ -101,7 +102,6 @@ if (isGetCookie = typeof $request !== 'undefined') { if (tokenArr[i]) { signurl= DsjurlArr[i]; signheaderVal = tokenArr[i]; - console.log(tokenArr) drawalVal = DrawalArr[i]; $.index = i + 1; console.log(`-------------------------\n\n开始【电视家${$.index}】`) From 8384cb7d4710783214074ca8b2e125a5c544677d Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:48:52 +0800 Subject: [PATCH 070/266] fix --- Task/sendNotify.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 4a41353090..f83f8980bb 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -31,6 +31,8 @@ let txnewsNotifyControl = false;//(默认腾讯新闻脚本推送通知) let youthNotifyControl = false;//(默认中青脚本推送通知) +let dsjNotifyControl = false;//(默认电视家脚本推送通知) + if (process.env.PUSH_KEY) { SCKEY = process.env.PUSH_KEY; } From 5973fe45e7e79e7ee977d142b0ee26ce47d3058a Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 22:53:44 +0800 Subject: [PATCH 071/266] --- Task/dianshijia.js | 4 ++-- Task/weibo.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index bd6b1fad52..90c1d96bbf 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -100,7 +100,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { - signurl= DsjurlArr[i]; + signurl = DsjurlArr[i]; signheaderVal = tokenArr[i]; drawalVal = DrawalArr[i]; $.index = i + 1; @@ -164,7 +164,7 @@ function signin() { $.get({url: signurl, headers: JSON.parse(signheaderVal)}, async(error, response, data) => { if(logs)$.log(`${$.name}, 签到结果: ${data}\n`) - const result = JSON.parse(data) + let result = JSON.parse(data) if (result.errCode == 0) { signinres = `签到成功 ` var h = result.data.reward.length diff --git a/Task/weibo.js b/Task/weibo.js index ac32a04673..3a9516fa22 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -49,6 +49,7 @@ hostname = api.weibo.cn, pay.sc.weibo.com */ const $ = new Env('新浪微博') +const notify = $.isNode() ? require('./sendNotify') : ''; let tokenArr = [],payArr = []; if ($.isNode()) { if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('&') && process.env.WB_TOKEN.split('&').length > 0) { From 6ed810d75896ef6debf31d1ed77e8c203f07f5b5 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 23:03:48 +0800 Subject: [PATCH 072/266] --- Task/weibo.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index 3a9516fa22..c70de94af0 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -94,8 +94,7 @@ if (isGetCookie = typeof $request !==`undefined`) { token = tokenArr[i]; payheaderVal = payArr[i]; $.index = i + 1; - console.log(`-------------------------\n\n开始【微博签到${$.index}】`) - } + console.log(`-------------共${tokenArr.length}个账号\n开始【微博签到${$.index}】`) await getsign(); await doCard(); if (payheaderVal !== undefined){ @@ -103,6 +102,7 @@ if (isGetCookie = typeof $request !==`undefined`) { }; await showmsg() } + } })() .catch((e) => $.logErr(e)) .finally(() => $.done()) From 7265f96a8b613e80d2a2d14be0235d3a0b664a30 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 23:07:49 +0800 Subject: [PATCH 073/266] --- Task/weibo.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index c70de94af0..adea6ec0a1 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -52,14 +52,14 @@ const $ = new Env('新浪微博') const notify = $.isNode() ? require('./sendNotify') : ''; let tokenArr = [],payArr = []; if ($.isNode()) { - if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('&') && process.env.WB_TOKEN.split('&').length > 0) { - wbtoken = process.env.WB_TOKEN.split('&'); + if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('#') && process.env.WB_TOKEN.split('#').length > 0) { + wbtoken = process.env.WB_TOKEN.split('#'); } else if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('\n') && process.env.WB_TOKEN.split('\n').length > 0) { wbtoken = process.env.WB_TOKEN.split('\n'); }; - if (process.env.WB_PAY && process.env.WB_PAY.split('&') && process.env.WB_PAY.split('&').length > 0) { - wbPay = process.env.WB_PAY.split('&'); + if (process.env.WB_PAY && process.env.WB_PAY.split('#') && process.env.WB_PAY.split('#').length > 0) { + wbPay = process.env.WB_PAY.split('#'); } else if (process.env.WB_PAY && process.env.WB_PAY.split('\n') && process.env.WB_PAY.split('\n').length > 0) { wbPay = process.env.WB_PAY.split('\n'); From 1004e45f206a5619a474db07eeb5e0026b9a1a11 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 23:13:55 +0800 Subject: [PATCH 074/266] --- Task/weibo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/weibo.js b/Task/weibo.js index adea6ec0a1..02b5c2cd47 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -185,7 +185,8 @@ function paysign() { return new Promise((resolve, reject) =>{ let payurl = { url: `https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do?_=${$.startTime+50}`, - headers: JSON.parse($.getdata('sy_payheader_wb'))} + headers: payheaderVal + } $.post(payurl, (error, response, data) => { try{ let result = JSON.parse(data) From f5cfce14b301fe0734abd1d226dded991234cc81 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 23:19:05 +0800 Subject: [PATCH 075/266] fix --- Task/weibo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/weibo.js b/Task/weibo.js index 02b5c2cd47..d857d203ec 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -185,7 +185,7 @@ function paysign() { return new Promise((resolve, reject) =>{ let payurl = { url: `https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do?_=${$.startTime+50}`, - headers: payheaderVal + headers: JSON.parse(payheaderVal) } $.post(payurl, (error, response, data) => { try{ From 50309a770af60d6d9cc1969944bdaab25c4f9c38 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 23:24:18 +0800 Subject: [PATCH 076/266] --- Task/dianshijia.js | 3 ++- Task/weibo.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 90c1d96bbf..5c8dc3e3e5 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -98,13 +98,14 @@ if (isGetCookie = typeof $request !== 'undefined') { $.msg($.name, '【提示】请先获取电视家一cookie') return; } + console.log(`------------- 共${tokenArr.length}个账号\n`) for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { signurl = DsjurlArr[i]; signheaderVal = tokenArr[i]; drawalVal = DrawalArr[i]; $.index = i + 1; - console.log(`-------------------------\n\n开始【电视家${$.index}】`) + console.log(`\n开始【电视家${$.index}】`) await signin(); // 签到 await signinfo(); // 签到信息 await Withdrawal(); // 金额提现 diff --git a/Task/weibo.js b/Task/weibo.js index d857d203ec..dc6b6a0df1 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -89,12 +89,13 @@ if (isGetCookie = typeof $request !==`undefined`) { $.msg($.name, '【提示】请先获取新浪微博一cookie') return; } + console.log(`------------- 共${tokenArr.length}个账号\n`) for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { token = tokenArr[i]; payheaderVal = payArr[i]; $.index = i + 1; - console.log(`-------------共${tokenArr.length}个账号\n开始【微博签到${$.index}】`) + console.log(`\n开始【微博签到${$.index}】`) await getsign(); await doCard(); if (payheaderVal !== undefined){ From 649d89c2484eb93505aa44ee77aaab6941c03351 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 23:31:23 +0800 Subject: [PATCH 077/266] --- Task/dianshijia.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 5c8dc3e3e5..eabf3151c0 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -162,6 +162,7 @@ function GetCookie() { function signin() { return new Promise((resolve, reject) => { + console.log(signurl) $.get({url: signurl, headers: JSON.parse(signheaderVal)}, async(error, response, data) => { if(logs)$.log(`${$.name}, 签到结果: ${data}\n`) From f2c88ab41d570733ccd970b5e66ed0abe0b39306 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 13 Oct 2020 23:46:03 +0800 Subject: [PATCH 078/266] fix --- .github/workflows/dianshijia.yml | 1 - Task/dianshijia.js | 19 +------------------ Task/sunert.boxjs.json | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index 0c6b1c66ff..ae18db6315 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -24,7 +24,6 @@ jobs: run: | node Task/dianshijia.js env: - DSJ_SIGN: ${{ secrets.DSJ_SIGN }} DSJ_HEADERS: ${{ secrets.DSJ_HEADERS }} DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} DSJ_NOTIFY_CONTROL: ${{ secrets.DSJ_NOTIFY_CONTROL }} diff --git a/Task/dianshijia.js b/Task/dianshijia.js index eabf3151c0..718bc1aed4 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -60,12 +60,6 @@ if ($.isNode()) { else if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('\n') && process.env.DSJ_DRAWAL.split('\n').length > 0) { Drawals = process.env.DSJ_DRAWAL.split('\n'); }; - if (process.env.DSJ_SIGN && process.env.DSJ_SIGN.split('#') && process.env.DSJ_SIGN.split('#').length > 0) { - Dsjurl = process.env.DSJ_SIGN.split('#'); - } - else if (process.env.DSJ_SIGN && process.env.DSJ_SIGN.split('\n') && process.env.DSJ_SIGN.split('\n').length > 0) { - Dsjurl = process.env.DSJ_SIGN.split('\n'); - }; Object.keys(Dsjheaders).forEach((item) => { if (Dsjheaders[item]) { tokenArr.push(Dsjheaders[item]) @@ -76,17 +70,11 @@ if ($.isNode()) { DrawalArr.push(Drawals[item]) } }); - Object.keys(Dsjurl).forEach((item) => { - if (Dsjurl[item]) { - DsjurlArr.push(Dsjurl[item]) - } - }); console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) } else { tokenArr.push($.getdata('sy_signheader_dsj')) DrawalArr.push($.getdata('drawal_dsj')) - DsjurlArr.push($.getdata('sy_signurl_dsj')) } if (isGetCookie = typeof $request !== 'undefined') { @@ -101,7 +89,6 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`------------- 共${tokenArr.length}个账号\n`) for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { - signurl = DsjurlArr[i]; signheaderVal = tokenArr[i]; drawalVal = DrawalArr[i]; $.index = i + 1; @@ -127,11 +114,8 @@ if (isGetCookie = typeof $request !== 'undefined') { } function GetCookie() { if ($request && $request.method != 'OPTIONS'&&$request.url.match(/\/sign\/signin/)) { - const signurlVal = $request.url const signheaderVal = JSON.stringify($request.headers) - $.log(`signurlVal:${signurlVal}`) $.log(`signheaderVal:${signheaderVal}`) - if(signurlVal) $.setdata(signurlVal, 'sy_signurl_dsj') if (signheaderVal) $.setdata(signheaderVal, 'sy_signheader_dsj') $.msg($.name, `获取Cookie: 成功`, ``) } @@ -162,8 +146,7 @@ function GetCookie() { function signin() { return new Promise((resolve, reject) => { - console.log(signurl) - $.get({url: signurl, headers: JSON.parse(signheaderVal)}, async(error, response, data) => + $.get({url: `${dianshijia_API}/v5/sign/signin?accelerate=0&ext=0&ticket=`, headers: JSON.parse(signheaderVal)}, async(error, response, data) => { if(logs)$.log(`${$.name}, 签到结果: ${data}\n`) let result = JSON.parse(data) diff --git a/Task/sunert.boxjs.json b/Task/sunert.boxjs.json index d95dccfc1f..3054d95b53 100644 --- a/Task/sunert.boxjs.json +++ b/Task/sunert.boxjs.json @@ -42,7 +42,7 @@ { "id": "dianshijia", "name": "电视家", - "keys": ["sy_signurl_dsj", "sy_signheader_dsj", "drawal_dsj"], + "keys": ["sy_signheader_dsj", "drawal_dsj"], "author": "@sunert", "repo": "https://gitee.com/Sunert/Scripts/blob/master/Task/dianshijia.js", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/dianshijia.png", "https://raw.githubusercontent.com/Orz-3/task/master/dianshijia.png"], From 8bb9e7e57c952e32368c95adb2f265b49f2baeea Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 00:08:23 +0800 Subject: [PATCH 079/266] --- Task/dianshijia.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 718bc1aed4..0a330d61fb 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -251,10 +251,10 @@ function cashlist() { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/cash/detail`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - //if(logs)$.log(`提现列表: ${data}`) const result = JSON.parse(data) totalcash = Number() cashres = "" + try{ if (result.errCode == 0) { for (i=0;i { + $.get({url: drawalVal, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`金币随机兑换 : ${data}\n`) const result = JSON.parse(data) if (result.errCode == 0) { From 760b5e300e954dd1fae8e768046a68eb14bc7ec9 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 00:16:21 +0800 Subject: [PATCH 080/266] updata env --- Task/Youth_Read.js | 2 +- Task/dianshijia.js | 4 +--- Task/exchangeRate.js | 2 +- Task/jddj.js | 2 +- Task/jingxi.js | 2 +- Task/kuaishou.js | 2 +- Task/mydigit.js | 2 +- Task/sendNotify.js | 2 +- Task/sinanews.js | 3 +-- Task/telecomInfinity.js | 3 +-- Task/trainquery.js | 2 +- Task/translate.js | 2 +- Task/tvpreview.js | 2 +- Task/txnews.js | 3 +-- Task/weibo.js | 2 +- Task/youth.js | 2 +- 16 files changed, 16 insertions(+), 21 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 2bb17515de..a9c254fa99 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -73,4 +73,4 @@ function AutoRead() { }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 0a330d61fb..58aeed6c9f 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -483,6 +483,4 @@ function getGametime() { resolve() }) } - - -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/exchangeRate.js b/Task/exchangeRate.js index 2ee0b1aa23..993029ab48 100644 --- a/Task/exchangeRate.js +++ b/Task/exchangeRate.js @@ -103,4 +103,4 @@ function rate() { }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/jddj.js b/Task/jddj.js index 8c9b5f1932..99ee975113 100644 --- a/Task/jddj.js +++ b/Task/jddj.js @@ -145,4 +145,4 @@ async function showmsg() { $.msg(CookieName, $.subtitle, $.detail) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/jingxi.js b/Task/jingxi.js index 137fb1b7b0..fae87ebc4d 100644 --- a/Task/jingxi.js +++ b/Task/jingxi.js @@ -201,4 +201,4 @@ function showmsg() { } // prettier-ignore -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/kuaishou.js b/Task/kuaishou.js index 66aba11227..a1e42b5e12 100644 --- a/Task/kuaishou.js +++ b/Task/kuaishou.js @@ -141,4 +141,4 @@ function info() { }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/mydigit.js b/Task/mydigit.js index 68c121e3ee..0a12f8496f 100644 --- a/Task/mydigit.js +++ b/Task/mydigit.js @@ -135,4 +135,4 @@ function Minfo() { } // prettier-ignore -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/sendNotify.js b/Task/sendNotify.js index f83f8980bb..0fd3897c16 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -266,4 +266,4 @@ module.exports = { dsjNotifyControl } // prettier-ignore -function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/sinanews.js b/Task/sinanews.js index ad42704f8e..c02cd12a87 100644 --- a/Task/sinanews.js +++ b/Task/sinanews.js @@ -132,5 +132,4 @@ function signinfo() { }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} - +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/telecomInfinity.js b/Task/telecomInfinity.js index 6a8b9775eb..00c4ae4aca 100644 --- a/Task/telecomInfinity.js +++ b/Task/telecomInfinity.js @@ -272,5 +272,4 @@ function formatFlow(number) { } return (number / 1024).toFixed(2) + "GB" } - -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/trainquery.js b/Task/trainquery.js index 0793dadab9..5116e98573 100644 --- a/Task/trainquery.js +++ b/Task/trainquery.js @@ -297,4 +297,4 @@ const subTitle = '始发站: '+startstation+ '--终点站: '+edstation+' ('+purp } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/translate.js b/Task/translate.js index 6c32d19dfc..2b36cdf121 100644 --- a/Task/translate.js +++ b/Task/translate.js @@ -75,4 +75,4 @@ return new Promise((resolve, reject) => { } // prettier-ignore -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/tvpreview.js b/Task/tvpreview.js index 66b7ce7d21..b8aca9019f 100644 --- a/Task/tvpreview.js +++ b/Task/tvpreview.js @@ -98,4 +98,4 @@ const wurl = { //console.log(playlist) -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/txnews.js b/Task/txnews.js index 03fe10d41e..7aba797ad8 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -324,5 +324,4 @@ function showmsg() { } // prettier-ignore -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} - +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/weibo.js b/Task/weibo.js index dc6b6a0df1..c5ea4e6b50 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -218,4 +218,4 @@ async function showmsg() { } } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/youth.js b/Task/youth.js index d313cabc47..4bcea0500a 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -635,4 +635,4 @@ async function showmsg() { $.done() } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From 3678f057ce371bd6a333332ea7c3606b9de230b3 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 02:31:18 +0800 Subject: [PATCH 081/266] --- Task/dianshijia.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 58aeed6c9f..7846734c15 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -364,14 +364,9 @@ function coinlist() { headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { //$.log(`金币列表: ${data}`) - const result = JSON.parse(data) - let onlamount = Number(); - vdamount = new Number(); - gamestime = new Number() + let result = JSON.parse(data) + let onlamount = vdamount = gamestime = todaysign = 0; for (i=0;i=time;i++){ - if (result.data[i].from=="签到"){ - detail += `【每日签到】✅ 获得金币`+result.data[i].amount+'\n' - } if (result.data[i].from=="领取走路金币"){ detail += `【走路任务】✅ 获得金币`+result.data[i].amount+'\n' } @@ -399,7 +394,13 @@ function coinlist() { if (result.data[i].from=="手机在线"){ onlamount += result.data[i].amount } + if (result.data[i].from=="签到"){ + todaysign += parseInt(result.data[i].amount) + } } +if(todaysign){ + detail += `【每日签到】✅ 获得金币`+todaysign+'\n' +} if(vdamount){ detail += `【激励视频】✅ 获得金币`+vdamount+'\n' } From 7ea7aaf882bc03e3233d68c2b02db0418f9eaef2 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:03:54 +0800 Subject: [PATCH 082/266] --- Task/dianshijia.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 7846734c15..04b0318a0e 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -266,7 +266,7 @@ function cashlist() { detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` } else if(cashtotal){ - detail += `【提现结果】今日未提现 共计提现:`+cashtotal+`元\n` + detail += `【提现结果】今日未提现 共计提现:`+cashtotal+`元\n` } } } @@ -452,11 +452,8 @@ function getCUpcoin() { } function Withdrawal() { return new Promise((resolve, reject) => { - if (drawalVal !=undefined){ - let url = { - url: drawalVal, - headers: JSON.parse(signheaderVal), - } + console.log(drawal) + if (drawalVal != undefined){ $.get({url: drawalVal, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`金币随机兑换 : ${data}\n`) const result = JSON.parse(data) From 8d51b802450bb706004aa11fade2db9ce4052170 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:13:03 +0800 Subject: [PATCH 083/266] --- Task/dianshijia.js | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 04b0318a0e..d03f22a8e3 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -95,8 +95,12 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`\n开始【电视家${$.index}】`) await signin(); // 签到 await signinfo(); // 签到信息 - await Withdrawal(); // 金额提现 -//await Withdrawal2();// 固定金额 + console.log(drawalVal) + if (drawalVal != undefined){ + await Withdrawal() + } else { + detail += `【金额提现】❌ 请获取提现地址 \n` + };// 金额提现 await tasks(); // 任务状态 await getGametime();// 游戏时长 await total(); // 总计 @@ -440,11 +444,7 @@ resolve() } function getCUpcoin() { return new Promise((resolve, reject) => { - let url = { - url: `${dianshijia_API}/taskext/getCoin?code=carveUp&coin=0&ext=1`, - headers: JSON.parse(signheaderVal), - } - $.get(url, (error, response, data) => { + $.get({ url: `${dianshijia_API}/taskext/getCoin?code=carveUp&coin=0&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs) $.log(`瓜分百万金币: ${data}`) }) resolve() @@ -452,8 +452,6 @@ function getCUpcoin() { } function Withdrawal() { return new Promise((resolve, reject) => { - console.log(drawal) - if (drawalVal != undefined){ $.get({url: drawalVal, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`金币随机兑换 : ${data}\n`) const result = JSON.parse(data) @@ -462,11 +460,6 @@ function Withdrawal() { } resolve() }) - } -else { - detail += `【金额提现】❌ 请获取提现地址 \n` - } -resolve() }) } function getGametime() { From 271d59930efc885b017272deb768472f8db3959b Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:17:33 +0800 Subject: [PATCH 084/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index d03f22a8e3..6c8c426c9a 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -46,7 +46,7 @@ const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; const dianshijia_API = 'http://api.gaoqingdianshi.com/api' -let tokenArr = [], DsjurlArr = [], DrawalArr = []; +let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal; if ($.isNode()) { if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('#') && process.env.DSJ_HEADERS.split('#').length > 0) { Dsjheaders = process.env.DSJ_HEADERS.split('#'); From 8c7fd74e8a74ec8358e6395d41ab8eb86fc666d2 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:20:26 +0800 Subject: [PATCH 085/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 6c8c426c9a..84f349f0bf 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -95,7 +95,7 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`\n开始【电视家${$.index}】`) await signin(); // 签到 await signinfo(); // 签到信息 - console.log(drawalVal) + console.log(DrawalArr) if (drawalVal != undefined){ await Withdrawal() } else { From 3b19d8376b3fb2ec4190d693b9073c29e00330fd Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:30:52 +0800 Subject: [PATCH 086/266] --- Task/dianshijia.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 84f349f0bf..2667a89475 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -95,7 +95,6 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`\n开始【电视家${$.index}】`) await signin(); // 签到 await signinfo(); // 签到信息 - console.log(DrawalArr) if (drawalVal != undefined){ await Withdrawal() } else { @@ -370,6 +369,7 @@ function coinlist() { //$.log(`金币列表: ${data}`) let result = JSON.parse(data) let onlamount = vdamount = gamestime = todaysign = 0; + try { for (i=0;i=time;i++){ if (result.data[i].from=="领取走路金币"){ detail += `【走路任务】✅ 获得金币`+result.data[i].amount+'\n' @@ -421,6 +421,9 @@ if(gamestime){ detail += `【任务统计】共完成${i-1}次任务🌷` } $.msg($.name+` `+sleeping, subTitle, detail) + } catch(error){ + console.log(`获取任务金币列表失败,错误代码${error},响应数据:`+data) + } resolve() }) }) From 7acd8c602e218bf8ffa1bbdf20fd816199584a44 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:35:24 +0800 Subject: [PATCH 087/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 2667a89475..1d3e34df70 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -422,7 +422,7 @@ if(gamestime){ } $.msg($.name+` `+sleeping, subTitle, detail) } catch(error){ - console.log(`获取任务金币列表失败,错误代码${error},响应数据:`+data) + console.log(`获取任务金币列表失败,错误代码${error}+ \n响应数据:${data}`) } resolve() }) From 51c6a9b72abbf11b8eca7b064d928f6432a3b409 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:39:09 +0800 Subject: [PATCH 088/266] --- Task/dianshijia.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 1d3e34df70..577937cd3a 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -393,13 +393,13 @@ function coinlist() { gamestime += result.data[i].amount } if (result.data[i].from =="激励视频"){ - vdamount += result.data[i].amount + vdamount += result.data[i].amount } if (result.data[i].from=="手机在线"){ - onlamount += result.data[i].amount + onlamount += result.data[i].amount } - if (result.data[i].from=="签到"){ - todaysign += parseInt(result.data[i].amount) + if (result.data[i].from=="签到"){ + todaysign += result.data[i].amount } } if(todaysign){ @@ -414,13 +414,12 @@ if(onlamount){ if(gamestime){ detail += `【游戏时长】✅ 获得金币`+gamestime+'\n' } - if (i<7){ - detail += '【未完成/总计】'+`${i-1}/7` -} - else if (i>=7){ + + if (i>=7){ detail += `【任务统计】共完成${i-1}次任务🌷` } $.msg($.name+` `+sleeping, subTitle, detail) + resolve() } catch(error){ console.log(`获取任务金币列表失败,错误代码${error}+ \n响应数据:${data}`) } From 7c924e93156187a4d51a8a95b3cfe5f1ba25dfc0 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:44:18 +0800 Subject: [PATCH 089/266] --- Task/dianshijia.js | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 577937cd3a..dc584500f9 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -366,7 +366,7 @@ function coinlist() { let url = { url: `${dianshijia_API}/coin/detail`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { -//$.log(`金币列表: ${data}`) + console.log(`金币列表: ${data}`) let result = JSON.parse(data) let onlamount = vdamount = gamestime = todaysign = 0; try { @@ -402,28 +402,24 @@ function coinlist() { todaysign += result.data[i].amount } } -if(todaysign){ - detail += `【每日签到】✅ 获得金币`+todaysign+'\n' -} -if(vdamount){ - detail += `【激励视频】✅ 获得金币`+vdamount+'\n' -} -if(onlamount){ - detail += `【手机在线】✅ 获得金币`+onlamount+'\n' -} -if(gamestime){ + if(todaysign){ + detail += `【每日签到】✅ 获得金币`+todaysign+'\n' + } + if(vdamount){ + detail += `【激励视频】✅ 获得金币`+vdamount+'\n' + } + if(onlamount){ + detail += `【手机在线】✅ 获得金币`+onlamount+'\n' + } + if(gamestime){ detail += `【游戏时长】✅ 获得金币`+gamestime+'\n' -} - - if (i>=7){ - detail += `【任务统计】共完成${i-1}次任务🌷` -} - $.msg($.name+` `+sleeping, subTitle, detail) - resolve() - } catch(error){ + } + } catch(error) { console.log(`获取任务金币列表失败,错误代码${error}+ \n响应数据:${data}`) } - resolve() + detail += `【任务统计】共完成${i-1}次任务🌷` + $.msg($.name+` `+sleeping, subTitle, detail) + resolve() }) }) } From 91efb1de922907af077b0c892aab417db6209256 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:49:59 +0800 Subject: [PATCH 090/266] --- Task/dianshijia.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index dc584500f9..7bd3c5ec65 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -414,12 +414,14 @@ function coinlist() { if(gamestime){ detail += `【游戏时长】✅ 获得金币`+gamestime+'\n' } - } catch(error) { - console.log(`获取任务金币列表失败,错误代码${error}+ \n响应数据:${data}`) - } detail += `【任务统计】共完成${i-1}次任务🌷` $.msg($.name+` `+sleeping, subTitle, detail) resolve() + } catch(error) { + console.log(`获取任务金币列表失败,错误代码${error}+ \n响应数据:${data}`) + $.msg($.name+` `+sleeping, subTitle, detail) + resolve() + } }) }) } From 373dd2d35ace5b79ea90f128ab59cdb4ee9c4fdc Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:52:59 +0800 Subject: [PATCH 091/266] --- Task/dianshijia.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 7bd3c5ec65..4dd370f7dc 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -414,7 +414,9 @@ function coinlist() { if(gamestime){ detail += `【游戏时长】✅ 获得金币`+gamestime+'\n' } + if(i>0){ detail += `【任务统计】共完成${i-1}次任务🌷` + } $.msg($.name+` `+sleeping, subTitle, detail) resolve() } catch(error) { From bde9353f1b3cd7c08ffaf1296235433e2543625e Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 09:57:28 +0800 Subject: [PATCH 092/266] --- Task/dianshijia.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 4dd370f7dc..428e5d8144 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -366,9 +366,12 @@ function coinlist() { let url = { url: `${dianshijia_API}/coin/detail`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { - console.log(`金币列表: ${data}`) + //console.log(`金币列表: ${data}`) let result = JSON.parse(data) - let onlamount = vdamount = gamestime = todaysign = 0; + let onlamount = 0, + vdamount = 0, + gamestime = 0, + todaysign = 0; try { for (i=0;i=time;i++){ if (result.data[i].from=="领取走路金币"){ From 1892b2f355dadf0bc8aa71d26d7b16cf714e001b Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 10:05:00 +0800 Subject: [PATCH 093/266] --- Task/dianshijia.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 428e5d8144..1272f4ebb9 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -368,12 +368,11 @@ function coinlist() { $.get(url, (error, response, data) => { //console.log(`金币列表: ${data}`) let result = JSON.parse(data) - let onlamount = 0, - vdamount = 0, - gamestime = 0, - todaysign = 0; + let onlamount = 0, vdamount = 0, + gamestime = 0, todaysign = 0; try { - for (i=0;i=time;i++){ + for (i=0;i= time;i++){ + console.log(i) if (result.data[i].from=="领取走路金币"){ detail += `【走路任务】✅ 获得金币`+result.data[i].amount+'\n' } From 7f673c43328de257d91045cb654219a383d344b6 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 12:18:42 +0800 Subject: [PATCH 094/266] --- Task/dianshijia.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 1272f4ebb9..402bfac050 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -372,7 +372,6 @@ function coinlist() { gamestime = 0, todaysign = 0; try { for (i=0;i= time;i++){ - console.log(i) if (result.data[i].from=="领取走路金币"){ detail += `【走路任务】✅ 获得金币`+result.data[i].amount+'\n' } From 3945ba221ff7535d313c436b1f3b239cabfb1d5f Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 12:22:07 +0800 Subject: [PATCH 095/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 402bfac050..d6f49bc263 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -416,7 +416,7 @@ function coinlist() { detail += `【游戏时长】✅ 获得金币`+gamestime+'\n' } if(i>0){ - detail += `【任务统计】共完成${i-1}次任务🌷` + detail += `【任务统计】共完成${i+1}次任务🌷` } $.msg($.name+` `+sleeping, subTitle, detail) resolve() From f8d22a47aea01f47735d473e29548af48653265d Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 12:59:55 +0800 Subject: [PATCH 096/266] --- Task/dianshijia.js | 57 ++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 38 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index d6f49bc263..ac04568303 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -40,11 +40,11 @@ http:\/\/api\.gaoqingdianshi\.com\/api\/v2\/cash\/withdrawal url script-request- */ const walkstep = '20000';//每日步数设置,可设置0-20000 -const gametimes = "2888"; //游戏时长 +const gametimes = "1999"; //游戏时长 const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; - + let sleeping = ""; const dianshijia_API = 'http://api.gaoqingdianshi.com/api' let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal; if ($.isNode()) { @@ -92,7 +92,7 @@ if (isGetCookie = typeof $request !== 'undefined') { signheaderVal = tokenArr[i]; drawalVal = DrawalArr[i]; $.index = i + 1; - console.log(`\n开始【电视家${$.index}】`) + console.log(`开始【电视家${$.index}】`) await signin(); // 签到 await signinfo(); // 签到信息 if (drawalVal != undefined){ @@ -100,6 +100,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } else { detail += `【金额提现】❌ 请获取提现地址 \n` };// 金额提现 + await run(); await tasks(); // 任务状态 await getGametime();// 游戏时长 await total(); // 总计 @@ -129,22 +130,19 @@ function GetCookie() { $.msg($.name, `获取提现地址: 成功`, ``) } } - - var date = new Date(); - var hour = date.getHours(); - var sleeping = ""; - if (hour>17){ +function run() { + if ($.time('HH')>17){ sleep(); CarveUp(); } - else if(hour > 11&&hour <14){ + else if($.time('HH') > 11&&$.time('HH') <14){ getCUpcoin(); walk(); } - else if(hour > 6&&hour <9){ + else if($.time('HH') > 6&&$.time('HH') <9){ wakeup() } - var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 +} function signin() { return new Promise((resolve, reject) => @@ -193,26 +191,9 @@ function signinfo() { { if (d == result.data.recentDays[i].day) {detail += ` 连续签到${d}天\n` - var j = result.data.recentDays[i].rewards.length - if (j > 1){ - detail += `【奖励信息】今日:${result.data.recentDays[i].rewards[1].name} ` - } - else if (j == 1) - { - detail += `【奖励信息】今日: 无 ` - } - var k = result.data.recentDays[i+1].rewards.length - if ( k > 1 ) { - detail += ` 明日: `+ result.data.recentDays[i+1].rewards[1].name+`\n` - - } - else { - detail += `明日: 无\n` - - } - } + } } - resolve() + resolve() } }) }) @@ -233,7 +214,7 @@ function total() { } } catch(err){ - err } + console.log(err) } resolve() }) }) @@ -255,8 +236,8 @@ function cashlist() { $.get({ url: `${dianshijia_API}/cash/detail`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { const result = JSON.parse(data) - totalcash = Number() - cashres = "" + let totalcash = Number(),cashres = "" + var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 try{ if (result.errCode == 0) { for (i=0;i { $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - taskres= JSON.parse(data) + taskres = JSON.parse(data) if (taskres.errCode==0){ console.log('任务代码:'+code+',获得金币:'+taskres.data.getCoin) if (code== 'playTask'&&taskres.data.doneStatus == 3) { @@ -314,8 +295,7 @@ function walk() { { if(logs)$.log(`走路任务: ${data}\n`) const result = JSON.parse(data) - walkcoin = result.data.unGetCoin - if (walkcoin>10){ + if (result.data.unGetCoin>10){ $.get({ url: `${dianshijia_API}/taskext/getCoin?code=walk&coin=${walkcoin}&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { }) @@ -363,13 +343,14 @@ resolve() function coinlist() { return new Promise((resolve, reject) => { - let url = { url: `${dianshijia_API}/coin/detail`, + let url = { url: `${dianshijia_API}/coin/detail`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { //console.log(`金币列表: ${data}`) let result = JSON.parse(data) let onlamount = 0, vdamount = 0, gamestime = 0, todaysign = 0; + var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 try { for (i=0;i= time;i++){ if (result.data[i].from=="领取走路金币"){ @@ -477,4 +458,4 @@ function getGametime() { resolve() }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From e2972aacbca77a044a7fccf20b9964c417c4ef81 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 14:08:34 +0800 Subject: [PATCH 097/266] --- Task/txnews.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index 7aba797ad8..3f17820e21 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -90,12 +90,9 @@ if (isGetCookie) { GetCookie() } else { !(async () => { - if(!cookiesArr){ + if(!cookiesArr[0]){ $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); - if ($.isNode()){ - await notify.sendNotify($.name, '【提示】请先获取腾讯新闻一Cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); - } - return; + return; } if ($.isNode()){ console.log(`\n============ 脚本执行来自 Github Action ==============\n`) From 9b65cd4d01b445411dfa0bc36ce7f581dd8e0294 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 14:14:22 +0800 Subject: [PATCH 098/266] --- Task/Youth_Read.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index a9c254fa99..ec864b862b 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -11,8 +11,7 @@ Github Actions使用方法见[@lxk0301](https://raw.githubusercontent.com/lxk030 let s = 30000 //等待延迟30s const $ = new Env("中青看点") //const notify = $.isNode() ? require('./sendNotify') : ''; -let ReadArr = [], articlebody =''; -let YOUTH_READ = [ '','',]; +let ReadArr = [], YouthBody; if (process.env.YOUTH_READ && process.env.YOUTH_READ.split('&') && process.env.YOUTH_READ.split('&').length > 0) { YouthBody = process.env.YOUTH_READ.split('&'); } From d2cc24cf84493bef9c35c785e51ba444fb31a498 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 14:17:26 +0800 Subject: [PATCH 099/266] --- Task/Youth_Read.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index ec864b862b..757d8934dd 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -11,7 +11,8 @@ Github Actions使用方法见[@lxk0301](https://raw.githubusercontent.com/lxk030 let s = 30000 //等待延迟30s const $ = new Env("中青看点") //const notify = $.isNode() ? require('./sendNotify') : ''; -let ReadArr = [], YouthBody; +let ReadArr = [], YouthBody =""; + if (process.env.YOUTH_READ && process.env.YOUTH_READ.split('&') && process.env.YOUTH_READ.split('&').length > 0) { YouthBody = process.env.YOUTH_READ.split('&'); } From c96b53e467c10a21731020b0a1b0159c9d897b46 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 14:50:29 +0800 Subject: [PATCH 100/266] --- .github/workflows/txnews.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index 91841d259a..a7d7757f40 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -17,10 +17,15 @@ jobs: build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id + env: + TXNEWS_SIGN: ${{ secrets.TXNEWS_SIGN }} + TXNEWS_COOKIE: ${{ secrets.TXNEWS_COOKIE }} + TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x uses: actions/setup-node@v1 + if: env.TXNEWS_COOKIE with: node-version: 10.x - name: npm install @@ -30,9 +35,6 @@ jobs: run: | node Task/txnews.js env: - TXNEWS_SIGN: ${{ secrets.TXNEWS_SIGN }} - TXNEWS_COOKIE: ${{ secrets.TXNEWS_COOKIE }} - TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} TXNEWS_NOTIFY_CONTROL: ${{ secrets.TXNEWS_NOTIFY_CONTROL }} From f4357c8650388d8d34c645f10df62e8a0a9e1e92 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 16:50:06 +0800 Subject: [PATCH 101/266] --- .github/workflows/txnews.yml | 2 +- Task/txnews.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index a7d7757f40..3a8e6d8153 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -25,10 +25,10 @@ jobs: - uses: actions/checkout@v1 - name: Use Node.js 10.x uses: actions/setup-node@v1 - if: env.TXNEWS_COOKIE with: node-version: 10.x - name: npm install + if: env.TXNEWS_COOKIE run: | npm install - name: '运行 【腾讯新闻】' diff --git a/Task/txnews.js b/Task/txnews.js index 3f17820e21..fd241c996f 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -50,9 +50,10 @@ const notify = $.isNode() ? require('./sendNotify') : ''; let s = parseInt($.getdata('delay'))||200 // 间隔延迟时间 let notifyInterval =$.getdata('notifynum')||50; //阅读篇数间隔通知开为1,常关为0; const TX_HOST = 'https://api.inews.qq.com/activity/v1/' -let SignArr = [],signurlVal = ""; - cookiesArr = [],cookieVal = ""; - VideoArr = [],videoVal = ""; +let SignArr = [],SignUrl = ""; + cookiesArr = [],CookieTxnews = ""; + VideoArr = [],SignUrl = ""; + if ($.isNode()) { if (process.env.TXNEWS_COOKIE && process.env.TXNEWS_COOKIE.split('&') && process.env.TXNEWS_COOKIE.split('&').length > 0) { From 4cd57262ac7a0862d31e2d94f54bf449798bddbb Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 17:03:30 +0800 Subject: [PATCH 102/266] --- .github/workflows/dianshijia.yml | 6 +++-- .github/workflows/jingxi.yml | 4 +++- .github/workflows/midu_read.yml | 41 ++++++++++++++++++++++++++++++++ .github/workflows/weibo.yml | 6 +++-- .github/workflows/youth.yml | 10 ++++---- .github/workflows/youth_read.yml | 4 +++- 6 files changed, 61 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/midu_read.yml diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index ae18db6315..e296084608 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -11,6 +11,9 @@ jobs: build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id + env: + DSJ_HEADERS: ${{ secrets.DSJ_HEADERS }} + DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -18,14 +21,13 @@ jobs: with: node-version: 10.x - name: npm install + if: env.DSJ_HEADERS run: | npm install - name: '运行 【电视家】' run: | node Task/dianshijia.js env: - DSJ_HEADERS: ${{ secrets.DSJ_HEADERS }} - DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} DSJ_NOTIFY_CONTROL: ${{ secrets.DSJ_NOTIFY_CONTROL }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} diff --git a/.github/workflows/jingxi.yml b/.github/workflows/jingxi.yml index e5461d67f7..8ab8e4b95c 100644 --- a/.github/workflows/jingxi.yml +++ b/.github/workflows/jingxi.yml @@ -11,6 +11,8 @@ jobs: build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id + env: + JD_COOKIE: ${{ secrets.JD_COOKIE }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -18,13 +20,13 @@ jobs: with: node-version: 10.x - name: npm install + if: env.JD_COOKIE run: | npm install - name: '运行 【京喜】' run: | node Task/jingxi.js env: - JD_COOKIE: ${{ secrets.JD_COOKIE }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml new file mode 100644 index 0000000000..f544e183a0 --- /dev/null +++ b/.github/workflows/midu_read.yml @@ -0,0 +1,41 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: midu_read + +on: + workflow_dispatch: + schedule: + - cron: '*/6 1-18 * * *' + +jobs: + build: + runs-on: ubuntu-latest + env: + TXNEWS_SIGN: ${{ secrets.TXNEWS_SIGN }} + TXNEWS_COOKIE: ${{ secrets.TXNEWS_COOKIE }} + TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} + steps: + - uses: actions/checkout@v1 + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: npm install + run: | + npm install + - name: '运行 【米读自动阅读】' + run: | + node Task/midu_Read.js + env: + MIDU_COOKIE: ${{ secrets.MIDU_COOKIE }} + MIDU_BODY: ${{ secrets.MIDU_BODY }} + MIDU_DRAW: ${{ secrets.MIDU_DRAW }} + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + + + diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml index 104971e2a0..c892946515 100644 --- a/.github/workflows/weibo.yml +++ b/.github/workflows/weibo.yml @@ -11,6 +11,9 @@ jobs: build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id + env: + WB_TOKEN: ${{ secrets.WB_TOKEN }} + WB_PAY: ${{ secrets.WB_PAY }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -18,14 +21,13 @@ jobs: with: node-version: 10.x - name: npm install + if: env.WB_TOKEN run: | npm install - name: '运行 【新浪微博】' run: | node Task/weibo.js env: - WB_TOKEN: ${{ secrets.WB_TOKEN }} - WB_PAY: ${{ secrets.WB_PAY }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index 0e304eada9..c2c76b26f3 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -14,6 +14,11 @@ jobs: build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id + env: + YOUTH_HEADER: ${{ secrets.YOUTH_HEADER }} + YOUTH_ARTBODY: ${{ secrets.YOUTH_ARTBODY }} + YOUTH_REDBODY: ${{ secrets.YOUTH_REDBODY }} + YOUTH_TIME: ${{ secrets.YOUTH_TIME }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -21,16 +26,13 @@ jobs: with: node-version: 10.x - name: npm install + if: env.YOUTH_HEADER run: | npm install - name: '运行 【中青看点】' run: | node Task/youth.js env: - YOUTH_HEADER: ${{ secrets.YOUTH_HEADER }} - YOUTH_ARTBODY: ${{ secrets.YOUTH_ARTBODY }} - YOUTH_REDBODY: ${{ secrets.YOUTH_REDBODY }} - YOUTH_TIME: ${{ secrets.YOUTH_TIME }} YOUTH_NOTIFY_CONTROL: ${{ secrets.YOUTH_NOTIFY_CONTROL }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index 9d85cf1226..500b5a6ac8 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -13,6 +13,8 @@ jobs: build: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id + env: + YOUTH_READ: ${{ secrets.YOUTH_READ }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -20,13 +22,13 @@ jobs: with: node-version: 10.x - name: npm install + if: env.YOUTH_READ run: | npm install - name: '运行 【中青看点自动阅读】' run: | node Task/Youth_Read.js env: - YOUTH_READ: ${{ secrets.YOUTH_READ }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} From 56370624f658441c8c1cb8c571bc353c2869a7ea Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 17:10:43 +0800 Subject: [PATCH 103/266] --- .github/workflows/youth.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index c2c76b26f3..bd3e64d974 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -26,7 +26,7 @@ jobs: with: node-version: 10.x - name: npm install - if: env.YOUTH_HEADER + if: env.YOUTH_HEADER run: | npm install - name: '运行 【中青看点】' From 0629dcf12b701eb61999d7c4af2ff562ec03b080 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 17:28:06 +0800 Subject: [PATCH 104/266] --- .github/workflows/midu_read.yml | 10 +- Task/midu_Read.js | 261 ++++++++++++++++++++++++++++++++ Task/txnews.js | 7 +- 3 files changed, 268 insertions(+), 10 deletions(-) create mode 100644 Task/midu_Read.js diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index f544e183a0..1452888ba9 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -12,9 +12,9 @@ jobs: build: runs-on: ubuntu-latest env: - TXNEWS_SIGN: ${{ secrets.TXNEWS_SIGN }} - TXNEWS_COOKIE: ${{ secrets.TXNEWS_COOKIE }} - TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} + MIDU_COOKIE: ${{ secrets.MIDU_COOKIE }} + MIDU_BODY: ${{ secrets.MIDU_BODY }} + MIDU_DRAW: ${{ secrets.MIDU_DRAW }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -22,15 +22,13 @@ jobs: with: node-version: 10.x - name: npm install + if: env.MIDU_COOKIE run: | npm install - name: '运行 【米读自动阅读】' run: | node Task/midu_Read.js env: - MIDU_COOKIE: ${{ secrets.MIDU_COOKIE }} - MIDU_BODY: ${{ secrets.MIDU_BODY }} - MIDU_DRAW: ${{ secrets.MIDU_DRAW }} PUSH_KEY: ${{ secrets.PUSH_KEY }} BARK_PUSH: ${{ secrets.BARK_PUSH }} TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} diff --git a/Task/midu_Read.js b/Task/midu_Read.js new file mode 100644 index 0000000000..7c215256fb --- /dev/null +++ b/Task/midu_Read.js @@ -0,0 +1,261 @@ + +const cookieName = '米读阅读时长' +const $ = new Env(cookieName) +let cookiesArr = [], BodyArr = [],DrawArr= []; + +if ($.isNode()) { + if (process.env.MIDU_COOKIE && process.env.MIDU_COOKIE.split('&') && process.env.MIDU_COOKIE.split('&').length > 0) { + miduCookie = process.env.MIDU_COOKIE.split('&'); + } + if (process.env.MIDU_BODY && process.env.MIDU_BODY.split('&') && process.env.MIDU_BODY.split('&').length > 0) { + miduBodys = process.env.MIDU_BODY.split('&'); + } + if (process.env.MIDU_DRAW && process.env.MIDU_DRAW.split('#') && process.env.MIDU_DRAW.split('#').length > 0) { + DrawBodys = process.env.MIDU_DRAW.split('#'); + } + Object.keys(miduCookie).forEach((item) => { + if (miduCookie[item]) { + cookiesArr.push(miduCookie[item]) + } + }) + Object.keys(miduBodys).forEach((item) => { + if (miduBodys[item]) { + BodyArr.push(miduBodys[item]) + } + }) + Object.keys(DrawBodys).forEach((item) => { + if (DrawBodys[item]) { + DrawArr.push(DrawBodys[item]) + } + }) + } else { + cookiesArr.push($.getdata('tokenMidu_read')); + BodyArr.push($.getdata('senku_readTimebody_midu')); +DrawArr.push($.getdata('senku_signbody_midu')) +} + +!(async () => { + if (!cookiesArr[0]){ + $.msg($.name, '【提示】米读一cookie'); + console.log($.name, '【提示】米读一cookie'); + return; + } + if ($.isNode()){ + console.log(`\n============ 脚本执行来自 Github Action ==============\n`) + console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) + }; + for (let i = 0; i < BodyArr.length; i++) { + if (BodyArr[i]) { + tokenVal = cookiesArr[i]; + bodyVal = BodyArr[i]; + drawVal = DrawArr[i]; + //console.log(bodyVal) + $.index = i + 1; + console.log(`-------------------------\n\n开始【米读账号${$.index}】`) + $.log(`🔔 ${cookieName}`) + await readTime(); + await drawPrize(); + await prizeTask(); + await prizeInfo(); + await dice_roll(); + await dice_double(); + } + } +})() + .catch((e) => $.log(`❌ ${cookieName} 签到失败: ${e}`)) + + +// 阅读时长 +function readTime() { + return new Promise((resolve, reject) => { + let request = { + url: "https://apiwz.midukanshu.com/user/readTimeBase/readTime", + headers: {'token' : tokenVal,'User-Agent' : `MRSpeedNovel/0918.1649 CFNetwork/1128.0.1 Darwin/19.6.0`,'mobile-brand': 'iPhone','Content-Type': 'application/x-www-form-urlencoded' + }, + body: bodyVal, + } + $.post(request, (error, response, data) => { + try { + // $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}`) + readtime = JSON.parse(data) + let subTitle = '' + let detail = '' + if (readtime && readtime.code == 0) { + const coin = readtime.data.coin + const readTotalMinute = readtime.data.readTotalMinute + const total_coin = readtime.data.total_coin + coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰` + if (readTotalMinute % 20 == 0) { + readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` + $.msg(cookieName, subTitle, detail) + } else if ($.getdata('debug') == 'true') { + readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` + $.msg(cookieName, subTitle, detail) + + + } + } else if (readTime.code != 0) { + detail += `【阅读时长】错误代码${readtime.code},错误信息${readtime.message}` + $.msg(cookieName, subTitle, detail) + } else { + detail += '【阅读时长】失败' + $.msg(cookieName, subTitle, detail) + } + resolve() + } catch (e) { + $.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} readTime - 签到失败: ${e}`) + $.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} +function drawPrize() { + return new Promise((resolve, reject) => { + const drawPrizeurlVal = 'https://apiwz.midukanshu.com/wz/task/drawPrize' + const url = { + url: drawPrizeurlVal, + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) + if (data) { + drawprize = JSON.parse(data) + } + resolve() + } catch (e) { + // $.msg(cookieName, `抽奖: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} drawPrize - 抽奖失败: ${e}`) + $.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + +// 观看视频获取抽奖机会 +function prizeTask() { + return new Promise((resolve, reject) => { + const prizeTaskurlVal = 'https://apiwz.midukanshu.com/wz/task/prizeTask' + const url = { + url: prizeTaskurlVal, + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) + if (data) { + prizetask = JSON.parse(data) + } + resolve() + } catch (e) { + // $.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} prizeTask - 观看视频抽奖失败: ${e}`) + $.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + +// 抽奖信息 +function prizeInfo() { + return new Promise((resolve, reject) => { + const prizeInfourlVal = 'https://apiwz.midukanshu.com/wz/task/prizeList' + const url = { + url: prizeInfourlVal, + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) + if (data) { + prizeinfo = JSON.parse(data) + } + resolve() + } catch (e) { + // $.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} prizeInfo - 抽奖信息失败: ${e}`) + $.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + +// 掷骰子 +function dice_roll() { + return new Promise((resolve, reject) => { + const dice_roll_urlVal = 'https://apiwz.midukanshu.com/wz/dice/roll' + const url = { + url: dice_roll_urlVal, + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) + if (JSON.parse(data).code == 0) { + rollList=JSON.parse(data) + } + resolve() + } catch (e) { + $.msg(cookieName, `掷骰子: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} dice_roll - 掷骰子失败: ${e}`) + $.log(`❌ ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + +// 骰子双倍奖励 +function dice_double() { + return new Promise((resolve, reject) => { + const dice_double_urlVal = 'https://apiwz.midukanshu.com/wz/dice/doubleReward' + const url = { + url: dice_double_urlVal, + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}`) + if (JSON.parse(data).code == 0) { + doubleList=JSON.parse(data) + } + resolve() + } catch (e) { + $.msg(cookieName, `骰子双倍奖励: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} dice_double - 骰子双倍奖励失败: ${e}`) + $.log(`❌ ${cookieName} dice_double - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + + + +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/Task/txnews.js b/Task/txnews.js index fd241c996f..7b558b1858 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -81,8 +81,8 @@ if ($.isNode()) { } }) } else { - cookiesArr.push($.getdata('sy_cookie_txnews')); - SignArr.push($.getdata( 'sy_signurl_txnews')); + cookiesArr.push($.getdata('sy_cookie_txnews')); + SignArr.push($.getdata( 'sy_signurl_txnews')); VideoArr.push($.getdata( 'video_txnews')) } @@ -93,10 +93,9 @@ if (isGetCookie) { !(async () => { if(!cookiesArr[0]){ $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); - return; + return } if ($.isNode()){ - console.log(`\n============ 脚本执行来自 Github Action ==============\n`) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) } From a7f3adf78b1643074d2e179c36b16f1811de3dd5 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 17:51:58 +0800 Subject: [PATCH 105/266] --- .github/workflows/youth_read.yml | 41 ++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index 500b5a6ac8..63b777573a 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -6,7 +6,7 @@ name: youth_read on: workflow_dispatch: schedule: - - cron: '*/29 19-23 * * *' + - cron: '6 1-10/2 * * *' watch: types: started jobs: @@ -14,7 +14,10 @@ jobs: runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id env: - YOUTH_READ: ${{ secrets.YOUTH_READ }} + YOUTH_READ: ${{ secrets.YOUTH_READ }} + YOUTH_READ2: ${{ secrets.YOUTH_READ2 }} + YOUTH_READ3: ${{ secrets.YOUTH_READ3 }} + YOUTH_READ4: ${{ secrets.YOUTH_READ4 }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -22,19 +25,33 @@ jobs: with: node-version: 10.x - name: npm install - if: env.YOUTH_READ run: | npm install - - name: '运行 【中青看点自动阅读】' + + - name: '运行 【中青看点自动阅读一】' + if: env.YOUTH_READ run: | node Task/Youth_Read.js env: - PUSH_KEY: ${{ secrets.PUSH_KEY }} - BARK_PUSH: ${{ secrets.BARK_PUSH }} - TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} - TG_USER_ID: ${{ secrets.TG_USER_ID }} - BARK_SOUND: ${{ secrets.BARK_SOUND }} - DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} - DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} + YOUTH_READ: ${{ secrets.YOUTH_READ }} - + - name: '运行 【中青看点自动阅读二】' + if: env.YOUTH_READ2 + run: | + node Task/Youth_Read.js + env: + YOUTH_READ: ${{ secrets.YOUTH_READ2 }} + + - name: '运行 【中青看点自动阅读三】' + if: env.YOUTH_READ3 + run: | + node Task/Youth_Read.js + env: + YOUTH_READ: ${{ secrets.YOUTH_READ3 }} + + - name: '运行 【中青看点自动阅读四】' + if: env.YOUTH_READ4 + run: | + node Task/Youth_Read.js + env: + YOUTH_READ: ${{ secrets.YOUTH_READ4 }} \ No newline at end of file From 9d4f216dedb785e62826bee51d61855795f88408 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 17:57:46 +0800 Subject: [PATCH 106/266] fix error --- .github/workflows/dianshijia.yml | 2 +- .github/workflows/jingxi.yml | 2 +- .github/workflows/midu_read.yml | 3 ++- .github/workflows/txnews.yml | 2 +- .github/workflows/weibo.yml | 1 + .github/workflows/youth.yml | 1 + 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index e296084608..3811697c12 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -21,10 +21,10 @@ jobs: with: node-version: 10.x - name: npm install - if: env.DSJ_HEADERS run: | npm install - name: '运行 【电视家】' + if: env.DSJ_HEADERS run: | node Task/dianshijia.js env: diff --git a/.github/workflows/jingxi.yml b/.github/workflows/jingxi.yml index 8ab8e4b95c..6baff88bfa 100644 --- a/.github/workflows/jingxi.yml +++ b/.github/workflows/jingxi.yml @@ -20,10 +20,10 @@ jobs: with: node-version: 10.x - name: npm install - if: env.JD_COOKIE run: | npm install - name: '运行 【京喜】' + if: env.JD_COOKIE run: | node Task/jingxi.js env: diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 1452888ba9..685f6d1918 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -22,10 +22,11 @@ jobs: with: node-version: 10.x - name: npm install - if: env.MIDU_COOKIE + run: | npm install - name: '运行 【米读自动阅读】' + if: env.MIDU_COOKIE run: | node Task/midu_Read.js env: diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index 3a8e6d8153..52ce177044 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -28,10 +28,10 @@ jobs: with: node-version: 10.x - name: npm install - if: env.TXNEWS_COOKIE run: | npm install - name: '运行 【腾讯新闻】' + if: env.TXNEWS_COOKIE run: | node Task/txnews.js env: diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml index c892946515..82b55587e5 100644 --- a/.github/workflows/weibo.yml +++ b/.github/workflows/weibo.yml @@ -25,6 +25,7 @@ jobs: run: | npm install - name: '运行 【新浪微博】' + if: env.WB_TOKEN run: | node Task/weibo.js env: diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index bd3e64d974..f9e765a189 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -30,6 +30,7 @@ jobs: run: | npm install - name: '运行 【中青看点】' + if: env.YOUTH_HEADER run: | node Task/youth.js env: From 163c5285af1df17017f17eba9f295f15aa118e6c Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 20:21:19 +0800 Subject: [PATCH 107/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index ac04568303..7b492035c8 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -296,7 +296,7 @@ function walk() { if(logs)$.log(`走路任务: ${data}\n`) const result = JSON.parse(data) if (result.data.unGetCoin>10){ - $.get({ url: `${dianshijia_API}/taskext/getCoin?code=walk&coin=${walkcoin}&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => + $.get({ url: `${dianshijia_API}/taskext/getCoin?code=walk&coin=${result.data.unGetCoin}&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { }) } From 76280e05930a92a157141220e3034ff0c14ca5d5 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 20:39:48 +0800 Subject: [PATCH 108/266] fix time --- Task/dianshijia.js | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 7b492035c8..3512d6d88a 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -130,18 +130,33 @@ function GetCookie() { $.msg($.name, `获取提现地址: 成功`, ``) } } -function run() { +async function run() { + if ($.isNode()) { + if ($.time('HH')>11){ + await sleep(); + await CarveUp(); + } + else if($.time('HH') > 3&&$.time('HH') <5){ + await getCUpcoin(); + await walk(); + } + else if($.time('HH') > 22 ){ + await wakeup() + } + } + else { if ($.time('HH')>17){ - sleep(); - CarveUp(); - } + await sleep(); + await CarveUp(); + } else if($.time('HH') > 11&&$.time('HH') <14){ - getCUpcoin(); - walk(); - } + await getCUpcoin(); + await walk(); + } else if($.time('HH') > 6&&$.time('HH') <9){ - wakeup() - } + await wakeup() + } + } } function signin() { From 05586ee25b0470f1246b68f15ce0830d7f79393a Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 20:43:56 +0800 Subject: [PATCH 109/266] --- Task/dianshijia.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 3512d6d88a..276e1baa34 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -358,6 +358,7 @@ resolve() function coinlist() { return new Promise((resolve, reject) => { + setTimeout(() => { let url = { url: `${dianshijia_API}/coin/detail`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { @@ -421,7 +422,8 @@ function coinlist() { $.msg($.name+` `+sleeping, subTitle, detail) resolve() } - }) + }) + },1000) }) } From 3baaf2246e6b16abbdea9c716c8e3def338f0e95 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 20:50:48 +0800 Subject: [PATCH 110/266] --- Task/midu_Read.js | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 7c215256fb..deddc1e995 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -255,6 +255,58 @@ function dice_double() { }) }) } + +// 每日签到 +function signDay(bodyVal) { + return new Promise((resolve, reject) => { + const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2?' + bodyVal + const url = { + url: signurlVal, + headers: {} + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}`) + signinfo.signDay = JSON.parse(data) + resolve() + } catch (e) { + $.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} signDay - 签到失败: ${e}`) + $.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + +// 签到视频奖励 +function signVideo(bodyVal) { + return new Promise((resolve, reject) => { + const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward?' + bodyVal + const url = { + url: signVideourlVal, + headers: {} + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}`) + signinfo.signVideo = JSON.parse(data) + resolve() + } catch (e) { + $.msg(cookieName, `签到视频: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} signVideo - 签到视频失败: ${e}`) + $.log(`❌ ${cookieName} signVideo - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} From 953f93a7b17066ecd9350421716083a91c38e251 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 21:17:02 +0800 Subject: [PATCH 111/266] --- .github/workflows/midu_read.yml | 9 +++---- Task/midu_Read.js | 48 ++++++++++++++++----------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 685f6d1918..24e9f4daf6 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -12,9 +12,9 @@ jobs: build: runs-on: ubuntu-latest env: - MIDU_COOKIE: ${{ secrets.MIDU_COOKIE }} - MIDU_BODY: ${{ secrets.MIDU_BODY }} - MIDU_DRAW: ${{ secrets.MIDU_DRAW }} + MIDU_TOKEN: ${{ secrets.MIDU_TOKEN }} + MIDU_TIME: ${{ secrets.MIDU_TIME }} + MIDU_SIGN: ${{ secrets.MIDU_SIGN }} steps: - uses: actions/checkout@v1 - name: Use Node.js 10.x @@ -22,11 +22,10 @@ jobs: with: node-version: 10.x - name: npm install - run: | npm install - name: '运行 【米读自动阅读】' - if: env.MIDU_COOKIE + if: env.MIDU_TOKEN run: | node Task/midu_Read.js env: diff --git a/Task/midu_Read.js b/Task/midu_Read.js index deddc1e995..b68ddc0030 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -4,38 +4,38 @@ const $ = new Env(cookieName) let cookiesArr = [], BodyArr = [],DrawArr= []; if ($.isNode()) { - if (process.env.MIDU_COOKIE && process.env.MIDU_COOKIE.split('&') && process.env.MIDU_COOKIE.split('&').length > 0) { - miduCookie = process.env.MIDU_COOKIE.split('&'); + if (process.env.MIDU_TOKEN && process.env.MIDU_TOKEN.split('&') && process.env.MIDU_TOKEN.split('&').length > 0) { + miduToken = process.env.MIDU_COOKIE.split('&'); } - if (process.env.MIDU_BODY && process.env.MIDU_BODY.split('&') && process.env.MIDU_BODY.split('&').length > 0) { - miduBodys = process.env.MIDU_BODY.split('&'); + if (process.env.MIDU_TIME && process.env.MIDU_BODY.split('&') && process.env.MIDU_TIME.split('&').length > 0) { + ReadBodys = process.env.MIDU_TIME.split('&'); } - if (process.env.MIDU_DRAW && process.env.MIDU_DRAW.split('#') && process.env.MIDU_DRAW.split('#').length > 0) { - DrawBodys = process.env.MIDU_DRAW.split('#'); + if (process.env.MIDU_SIGN && process.env.MIDU_SIGN.split('#') && process.env.MIDU_SIGN.split('#').length > 0) { + SignBodys = process.env.MIDU_SIGN.split('#'); } - Object.keys(miduCookie).forEach((item) => { - if (miduCookie[item]) { - cookiesArr.push(miduCookie[item]) + Object.keys(miduToken).forEach((item) => { + if (miduToken[item]) { + tokenArr.push(miduToken[item]) } }) - Object.keys(miduBodys).forEach((item) => { - if (miduBodys[item]) { - BodyArr.push(miduBodys[item]) + Object.keys(ReadBodys).forEach((item) => { + if (ReadBodys[item]) { + TimeArr.push(ReadBodys[item]) } }) - Object.keys(DrawBodys).forEach((item) => { - if (DrawBodys[item]) { - DrawArr.push(DrawBodys[item]) + Object.keys(SignBodys).forEach((item) => { + if (SignBodys[item]) { + SignArr.push(SignBodys[item]) } }) } else { - cookiesArr.push($.getdata('tokenMidu_read')); - BodyArr.push($.getdata('senku_readTimebody_midu')); -DrawArr.push($.getdata('senku_signbody_midu')) + tokenArr.push($.getdata('tokenMidu_read')); + TimeArr.push($.getdata('senku_readTimebody_midu')); + SignArr.push($.getdata('senku_signbody_midu')) } !(async () => { - if (!cookiesArr[0]){ + if (!tokenArr[0]){ $.msg($.name, '【提示】米读一cookie'); console.log($.name, '【提示】米读一cookie'); return; @@ -45,11 +45,11 @@ DrawArr.push($.getdata('senku_signbody_midu')) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) }; - for (let i = 0; i < BodyArr.length; i++) { - if (BodyArr[i]) { - tokenVal = cookiesArr[i]; - bodyVal = BodyArr[i]; - drawVal = DrawArr[i]; + for (let i = 0; i < tokenArr.length; i++) { + if (tokenArr[i]) { + tokenVal = tokenArr[i]; + bodyVal = TimeArr[i]; + drawVal = SignArr[i]; //console.log(bodyVal) $.index = i + 1; console.log(`-------------------------\n\n开始【米读账号${$.index}】`) From f6d4af438ccac8c2612fbcbf3cae547f21c9cc6a Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 21:24:01 +0800 Subject: [PATCH 112/266] --- Task/midu_Read.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index b68ddc0030..7ffc24664e 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -120,6 +120,7 @@ function drawPrize() { headers: {}, body: drawVal } + url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' @@ -149,6 +150,7 @@ function prizeTask() { headers: {}, body: drawVal } + url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' @@ -178,6 +180,7 @@ function prizeInfo() { headers: {}, body: drawVal } + url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' @@ -239,6 +242,7 @@ function dice_double() { url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}`) @@ -259,11 +263,13 @@ function dice_double() { // 每日签到 function signDay(bodyVal) { return new Promise((resolve, reject) => { - const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2?' + bodyVal + const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2' const url = { url: signurlVal, - headers: {} + headers: {}, + body: drawVal } + url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' @@ -285,14 +291,16 @@ function signDay(bodyVal) { // 签到视频奖励 function signVideo(bodyVal) { return new Promise((resolve, reject) => { - const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward?' + bodyVal + const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward' const url = { url: signVideourlVal, - headers: {} + headers: {}, + body: drawVal } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}`) From a19de573bc2a85c9e7580a9ec94812494fe72fb9 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 21:30:27 +0800 Subject: [PATCH 113/266] --- Task/midu_Read.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 7ffc24664e..02d6d650ad 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -267,7 +267,7 @@ function signDay(bodyVal) { const url = { url: signurlVal, headers: {}, - body: drawVal + body: tokenVal } url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' @@ -295,7 +295,7 @@ function signVideo(bodyVal) { const url = { url: signVideourlVal, headers: {}, - body: drawVal + body: tokenVal } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' From c683509605087757adb8e6dbeae2b9d0178ad1e6 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 22:29:04 +0800 Subject: [PATCH 114/266] --- Task/midu_Read.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 02d6d650ad..7f9d980154 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -1,14 +1,14 @@ const cookieName = '米读阅读时长' const $ = new Env(cookieName) -let cookiesArr = [], BodyArr = [],DrawArr= []; +let tokenArr = [], TimeArr = [],SignArr= []; if ($.isNode()) { - if (process.env.MIDU_TOKEN && process.env.MIDU_TOKEN.split('&') && process.env.MIDU_TOKEN.split('&').length > 0) { - miduToken = process.env.MIDU_COOKIE.split('&'); + if (process.env.MIDU_TOKEN && process.env.MIDU_TOKEN.split('#') && process.env.MIDU_TOKEN.split('#').length > 0) { + miduToken = process.env.MIDU_TOKEN.split('#'); } - if (process.env.MIDU_TIME && process.env.MIDU_BODY.split('&') && process.env.MIDU_TIME.split('&').length > 0) { - ReadBodys = process.env.MIDU_TIME.split('&'); + if (process.env.MIDU_TIME && process.env.MIDU_TIME.split('#') && process.env.MIDU_TIME.split('#').length > 0) { + ReadBodys = process.env.MIDU_TIME.split('#'); } if (process.env.MIDU_SIGN && process.env.MIDU_SIGN.split('#') && process.env.MIDU_SIGN.split('#').length > 0) { SignBodys = process.env.MIDU_SIGN.split('#'); @@ -60,6 +60,8 @@ if ($.isNode()) { await prizeInfo(); await dice_roll(); await dice_double(); + await signDay(); + await signVideo() } } })() @@ -77,7 +79,7 @@ function readTime() { } $.post(request, (error, response, data) => { try { - // $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}`) + $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}`) readtime = JSON.parse(data) let subTitle = '' let detail = '' @@ -186,7 +188,7 @@ function prizeInfo() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) + // $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) if (data) { prizeinfo = JSON.parse(data) } @@ -261,13 +263,13 @@ function dice_double() { } // 每日签到 -function signDay(bodyVal) { +function signDay() { return new Promise((resolve, reject) => { const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2' const url = { url: signurlVal, headers: {}, - body: tokenVal + body: drawVal } url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' @@ -276,7 +278,7 @@ function signDay(bodyVal) { $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}`) - signinfo.signDay = JSON.parse(data) + _signDay = JSON.parse(data) resolve() } catch (e) { $.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) @@ -289,13 +291,13 @@ function signDay(bodyVal) { } // 签到视频奖励 -function signVideo(bodyVal) { +function signVideo() { return new Promise((resolve, reject) => { const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward' const url = { url: signVideourlVal, headers: {}, - body: tokenVal + body: drawVal } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' @@ -304,7 +306,7 @@ function signVideo(bodyVal) { $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}`) - signinfo.signVideo = JSON.parse(data) + _signVideo = JSON.parse(data) resolve() } catch (e) { $.msg(cookieName, `签到视频: 失败`, `说明: ${e}`) From 36ef8028dd5e71796f3096c2015512a92a8bb169 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 22:35:10 +0800 Subject: [PATCH 115/266] --- Task/txnews.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/txnews.js b/Task/txnews.js index 7b558b1858..d87dffe9f0 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -278,7 +278,7 @@ function Redpack() { } catch(error){ $.log("打开红包失败,响应数据: "+ data+"\n错误代码:"+error) }; - $.msg($.name, "开红包失败,详情请看日志 ❌", err) + $.msg($.name, "开红包失败,详情请看日志 ❌", error) resolve() }) },s) From cd11144de6cdee88471875aee040b542c37127e5 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 22:50:43 +0800 Subject: [PATCH 116/266] --- .github/workflows/midu_read.yml | 2 +- Task/dianshijia.js | 5 +++-- Task/txnews.js | 7 ++++--- Task/weibo.js | 8 +++++--- Task/youth.js | 10 +++++----- 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 24e9f4daf6..eb2d4c9932 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -6,7 +6,7 @@ name: midu_read on: workflow_dispatch: schedule: - - cron: '*/6 1-18 * * *' + - cron: '*/30 1-18/2 * * *' jobs: build: diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 276e1baa34..51fcbb8331 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -80,7 +80,8 @@ if ($.isNode()) { if (isGetCookie = typeof $request !== 'undefined') { GetCookie(); $.done() - } else { +} + !(async () => { if (!tokenArr[0]) { $.msg($.name, '【提示】请先获取电视家一cookie') @@ -115,7 +116,7 @@ if (isGetCookie = typeof $request !== 'undefined') { })() .catch((e) => $.logErr(e)) .finally(() => $.done()) - } + function GetCookie() { if ($request && $request.method != 'OPTIONS'&&$request.url.match(/\/sign\/signin/)) { const signheaderVal = JSON.stringify($request.headers) diff --git a/Task/txnews.js b/Task/txnews.js index d87dffe9f0..5a112f6019 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -88,8 +88,9 @@ if ($.isNode()) { let isGetCookie = typeof $request !== 'undefined' if (isGetCookie) { - GetCookie() -} else { + GetCookie(); + $.done() +} !(async () => { if(!cookiesArr[0]){ $.msg($.name, '【提示】🉐登录腾讯新闻app获取cookie',"qqnews://article_9500?tab=news_news&from=self", {"open-url": "qqnews://article_9500?tab=news_news&from=self"}); @@ -127,7 +128,7 @@ if (isGetCookie) { })() .catch((e) => $.logErr(e)) .finally(() => $.done()) -} + function GetCookie() { if ($request &&$request.body.indexOf("article_read")> -1) { diff --git a/Task/weibo.js b/Task/weibo.js index c5ea4e6b50..0f22337dd7 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -82,8 +82,10 @@ if ($.isNode()) { } if (isGetCookie = typeof $request !==`undefined`) { - GetCookie() -} else { + GetCookie(); + $.done() +} + !(async () => { if (!tokenArr[0]) { $.msg($.name, '【提示】请先获取新浪微博一cookie') @@ -107,7 +109,7 @@ if (isGetCookie = typeof $request !==`undefined`) { })() .catch((e) => $.logErr(e)) .finally(() => $.done()) -} + function GetCookie() { if ($request && $request.method != 'OPTIONS' && $request.url.match(/\/\d\/[a-z]+\/\w+\?gsid/)) { diff --git a/Task/youth.js b/Task/youth.js index 4bcea0500a..db93bb77a2 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -128,8 +128,10 @@ const runtimes = $.getdata('times'); const opboxtime = $.getdata('opbox'); if (isGetCookie = typeof $request !== 'undefined') { - GetCookie() -} else { + GetCookie(); + $.done() +} + !(async () => { if (!cookiesArr[0]) { $.msg($.name, '【提示】请先获取中青看点一cookie') @@ -170,7 +172,7 @@ else if ($.time('HH')>4&&$.time('HH')<8){ })() .catch((e) => $.logErr(e)) .finally(() => $.done()) -} + function GetCookie() { if ($request && $request.method != `OPTIONS`&& $request.url.match(/\/TaskCenter\/(sign|getSign)/)) { @@ -197,7 +199,6 @@ else if ($request && $request.method != `OPTIONS`&& $request.url.match(/\/articl $.log(`${$.name} 获取惊喜红包: 成功,redpbodyVal: ${redpbodyVal}`) $.msg($.name, `获取惊喜红包请求: 成功🎉`, ``) } - $.done() } function sign() { @@ -632,7 +633,6 @@ async function showmsg() { else { console.log(`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) } - $.done() } function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From f64e44061cca1c96bd377ff262a36f942302d34c Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 23:06:10 +0800 Subject: [PATCH 117/266] --- Task/weibo.js | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index 0f22337dd7..44d0b71065 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -102,8 +102,13 @@ if (isGetCookie = typeof $request !==`undefined`) { await doCard(); if (payheaderVal !== undefined){ await paysign() + } else { + paybag = `【钱包签到】❌ 未获取Cooiekie` }; - await showmsg() + $.msg($.name, nickname, wbsign+paybag+docard) + if ($.isNode()) { + await notify.sendNotify($.name, $.sub+'\n'+ $.desc) + } } } })() @@ -186,11 +191,8 @@ function doCard() { // 钱包签到 function paysign() { return new Promise((resolve, reject) =>{ - let payurl = { - url: `https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do?_=${$.startTime+50}`, - headers: JSON.parse(payheaderVal) - } -$.post(payurl, (error, response, data) => { + $.post({url: `https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do?_=${$.startTime+10}`,headers: JSON.parse(payheaderVal) + }, (error, response, data) => { try{ let result = JSON.parse(data) if (result.status == 1){ @@ -201,23 +203,12 @@ $.post(payurl, (error, response, data) => { } } catch(e){ - paybag = `【钱包签到】❌ 签到失败`+ e+ '\n' + paybag = `【钱包签到】❌ Cookie失效`+'\n' } resolve() }) }) } -async function showmsg() { - if (payheaderVal == undefined){ - paybag = `【钱包签到】❌ 未获取Cooiekie` - } - $.sub = nickname - $.desc = wbsign+paybag+docard - $.msg($.name, $.sub, $.desc) - if ($.isNode()) { - await notify.sendNotify($.name, $.sub+'\n'+ $.desc) - } -} -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 9fd1fbc0039ab90d5ea175ef7d329b5b934c714c Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 23:26:54 +0800 Subject: [PATCH 118/266] --- .github/workflows/weibo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml index 82b55587e5..afeaabbfd7 100644 --- a/.github/workflows/weibo.yml +++ b/.github/workflows/weibo.yml @@ -1,5 +1,5 @@ -name: weibo_signin +name: weibo on: workflow_dispatch: From 2c289867faca6d9ba4e2c8bba6793a948a84d777 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 14 Oct 2020 23:54:48 +0800 Subject: [PATCH 119/266] fix --- Task/Env.js | 474 ++++++++++++++++++++++++++++++++++++++++++++++++++ Task/weibo.js | 33 ++-- 2 files changed, 486 insertions(+), 21 deletions(-) create mode 100644 Task/Env.js diff --git a/Task/Env.js b/Task/Env.js new file mode 100644 index 0000000000..ee7e7d8197 --- /dev/null +++ b/Task/Env.js @@ -0,0 +1,474 @@ +function Env(name, opts) { + class Http { + constructor(env) { + this.env = env + } + + send(opts, method = 'GET') { + opts = typeof opts === 'string' ? { url: opts } : opts + let sender = this.get + if (method === 'POST') { + sender = this.post + } + return new Promise((resolve, reject) => { + sender.call(this, opts, (err, resp, body) => { + if (err) reject(err) + else resolve(resp) + }) + }) + } + + get(opts) { + return this.send.call(this.env, opts) + } + + post(opts) { + return this.send.call(this.env, opts, 'POST') + } + } + + return new (class { + constructor(name, opts) { + this.name = name + this.http = new Http(this) + this.data = null + this.dataFile = 'box.dat' + this.logs = [] + this.isMute = false + this.isNeedRewrite = false + this.logSeparator = '\n' + this.startTime = new Date().getTime() + Object.assign(this, opts) + 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(str, defaultValue = null) { + try { + return JSON.parse(str) + } catch { + return defaultValue + } + } + + toStr(obj, defaultValue = null) { + try { + return JSON.stringify(obj) + } catch { + return defaultValue + } + } + + getjson(key, defaultValue) { + let json = defaultValue + const val = this.getdata(key) + if (val) { + try { + json = JSON.parse(this.getdata(key)) + } catch {} + } + return json + } + + setjson(val, key) { + try { + return this.setdata(JSON.stringify(val), key) + } catch { + return false + } + } + + getScript(url) { + return new Promise((resolve) => { + this.get({ url }, (err, resp, body) => resolve(body)) + }) + } + + runScript(script, runOpts) { + return new Promise((resolve) => { + let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi') + httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi + let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout') + httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20 + httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout + const [key, addr] = httpapi.split('@') + const opts = { + url: `http://${addr}/v1/scripting/evaluate`, + body: { script_text: script, mock_type: 'cron', timeout: httpapi_timeout }, + headers: { 'X-Key': key, 'Accept': '*/*' } + } + this.post(opts, (err, resp, body) => resolve(body)) + }).catch((e) => this.logErr(e)) + } + + loaddata() { + if (this.isNode()) { + this.fs = this.fs ? this.fs : require('fs') + this.path = this.path ? this.path : require('path') + const curDirDataFilePath = this.path.resolve(this.dataFile) + const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) + const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) + const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) + if (isCurDirDataFile || isRootDirDataFile) { + const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath + try { + return JSON.parse(this.fs.readFileSync(datPath)) + } catch (e) { + return {} + } + } else return {} + } else return {} + } + + writedata() { + if (this.isNode()) { + this.fs = this.fs ? this.fs : require('fs') + this.path = this.path ? this.path : require('path') + const curDirDataFilePath = this.path.resolve(this.dataFile) + const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) + const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) + const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) + const jsondata = JSON.stringify(this.data) + if (isCurDirDataFile) { + this.fs.writeFileSync(curDirDataFilePath, jsondata) + } else if (isRootDirDataFile) { + this.fs.writeFileSync(rootDirDataFilePath, jsondata) + } else { + this.fs.writeFileSync(curDirDataFilePath, jsondata) + } + } + } + + lodash_get(source, path, defaultValue = undefined) { + const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') + let result = source + for (const p of paths) { + result = Object(result)[p] + if (result === undefined) { + return defaultValue + } + } + return result + } + + lodash_set(obj, path, value) { + if (Object(obj) !== obj) return obj + if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [] + path + .slice(0, -1) + .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ + path[path.length - 1] + ] = value + return obj + } + + getdata(key) { + let val = this.getval(key) + // 如果以 @ + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objval = objkey ? this.getval(objkey) : '' + if (objval) { + try { + const objedval = JSON.parse(objval) + val = objedval ? this.lodash_get(objedval, paths, '') : val + } catch (e) { + val = '' + } + } + } + return val + } + + setdata(val, key) { + let issuc = false + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objdat = this.getval(objkey) + const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}' + try { + const objedval = JSON.parse(objval) + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + } catch (e) { + const objedval = {} + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + } + } else { + issuc = this.setval(val, key) + } + return issuc + } + + getval(key) { + if (this.isSurge() || this.isLoon()) { + return $persistentStore.read(key) + } else if (this.isQuanX()) { + return $prefs.valueForKey(key) + } else if (this.isNode()) { + this.data = this.loaddata() + return this.data[key] + } else { + return (this.data && this.data[key]) || null + } + } + + setval(val, key) { + if (this.isSurge() || this.isLoon()) { + return $persistentStore.write(val, key) + } else if (this.isQuanX()) { + return $prefs.setValueForKey(val, key) + } else if (this.isNode()) { + this.data = this.loaddata() + this.data[key] = val + this.writedata() + return true + } else { + return (this.data && this.data[key]) || null + } + } + + initGotEnv(opts) { + 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() + if (opts) { + opts.headers = opts.headers ? opts.headers : {} + if (undefined === opts.headers.Cookie && undefined === opts.cookieJar) { + opts.cookieJar = this.ckjar + } + } + } + + get(opts, callback = () => {}) { + if (opts.headers) { + delete opts.headers['Content-Type'] + delete opts.headers['Content-Length'] + } + if (this.isSurge() || this.isLoon()) { + if (this.isSurge() && this.isNeedRewrite) { + opts.headers = opts.headers || {} + Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) + } + $httpClient.get(opts, (err, resp, body) => { + if (!err && resp) { + resp.body = body + resp.statusCode = resp.status + } + callback(err, resp, body) + }) + } else if (this.isQuanX()) { + if (this.isNeedRewrite) { + opts.opts = opts.opts || {} + Object.assign(opts.opts, { hints: false }) + } + $task.fetch(opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => callback(err) + ) + } else if (this.isNode()) { + this.initGotEnv(opts) + this.got(opts) + .on('redirect', (resp, nextOpts) => { + try { + if (resp.headers['set-cookie']) { + const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString() + this.ckjar.setCookieSync(ck, null) + nextOpts.cookieJar = this.ckjar + } + } catch (e) { + this.logErr(e) + } + // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString()) + }) + .then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => { + const { message: error, response: resp } = err + callback(error, resp, resp && resp.body) + } + ) + } + } + + post(opts, callback = () => {}) { + // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成 + if (opts.body && opts.headers && !opts.headers['Content-Type']) { + opts.headers['Content-Type'] = 'application/x-www-form-urlencoded' + } + if (opts.headers) delete opts.headers['Content-Length'] + if (this.isSurge() || this.isLoon()) { + if (this.isSurge() && this.isNeedRewrite) { + opts.headers = opts.headers || {} + Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) + } + $httpClient.post(opts, (err, resp, body) => { + if (!err && resp) { + resp.body = body + resp.statusCode = resp.status + } + callback(err, resp, body) + }) + } else if (this.isQuanX()) { + opts.method = 'POST' + if (this.isNeedRewrite) { + opts.opts = opts.opts || {} + Object.assign(opts.opts, { hints: false }) + } + $task.fetch(opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => callback(err) + ) + } else if (this.isNode()) { + this.initGotEnv(opts) + const { url, ..._opts } = opts + this.got.post(url, _opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => { + const { message: error, response: resp } = err + callback(error, resp, resp && resp.body) + } + ) + } + } + /** + * + * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S') + * :$.time('yyyyMMddHHmmssS') + * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒 + * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符 + * @param {*} fmt 格式化参数 + * + */ + time(fmt) { + let o = { + 'M+': new Date().getMonth() + 1, + 'd+': new Date().getDate(), + 'H+': new Date().getHours(), + 'm+': new Date().getMinutes(), + 's+': new Date().getSeconds(), + 'q+': Math.floor((new Date().getMonth() + 3) / 3), + 'S': new Date().getMilliseconds() + } + if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length)) + for (let k in o) + if (new RegExp('(' + k + ')').test(fmt)) + fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) + return fmt + } + + /** + * 系统通知 + * + * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知 + * + * 示例: + * $.msg(title, subt, desc, 'twitter://') + * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * + * @param {*} title 标题 + * @param {*} subt 副标题 + * @param {*} desc 通知详情 + * @param {*} opts 通知参数 + * + */ + msg(title = name, subt = '', desc = '', opts) { + const toEnvOpts = (rawopts) => { + if (!rawopts) return rawopts + if (typeof rawopts === 'string') { + if (this.isLoon()) return rawopts + else if (this.isQuanX()) return { 'open-url': rawopts } + else if (this.isSurge()) return { url: rawopts } + else return undefined + } else if (typeof rawopts === 'object') { + if (this.isLoon()) { + let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url'] + let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] + return { openUrl, mediaUrl } + } else if (this.isQuanX()) { + let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl + let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl + return { 'open-url': openUrl, 'media-url': mediaUrl } + } else if (this.isSurge()) { + let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url'] + return { url: openUrl } + } + } else { + return undefined + } + } + if (!this.isMute) { + if (this.isSurge() || this.isLoon()) { + $notification.post(title, subt, desc, toEnvOpts(opts)) + } else if (this.isQuanX()) { + $notify(title, subt, desc, toEnvOpts(opts)) + } + } + let logs = ['', '==============📣系统通知📣=============='] + logs.push(title) + subt ? logs.push(subt) : '' + desc ? logs.push(desc) : '' + console.log(logs.join('\n')) + this.logs = this.logs.concat(logs) + } + + log(...logs) { + if (logs.length > 0) { + this.logs = [...this.logs, ...logs] + } + console.log(logs.join(this.logSeparator)) + } + + logErr(err, msg) { + const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon() + if (!isPrintSack) { + this.log('', `❗️${this.name}, 错误!`, err) + } else { + this.log('', `❗️${this.name}, 错误!`, err.stack) + } + } + + wait(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } + + done(val = {}) { + const endTime = new Date().getTime() + const costTime = (endTime - this.startTime) / 1000 + this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`) + this.log() + if (this.isSurge() || this.isQuanX() || this.isLoon()) { + $done(val) + } + } + })(name, opts) +} diff --git a/Task/weibo.js b/Task/weibo.js index 44d0b71065..8174c1d80c 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -51,6 +51,11 @@ hostname = api.weibo.cn, pay.sc.weibo.com const $ = new Env('新浪微博') const notify = $.isNode() ? require('./sendNotify') : ''; let tokenArr = [],payArr = []; + +if (isGetCookie = typeof $request !==`undefined`) { + GetCookie(); + $.done() +} if ($.isNode()) { if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('#') && process.env.WB_TOKEN.split('#').length > 0) { wbtoken = process.env.WB_TOKEN.split('#'); @@ -79,14 +84,9 @@ if ($.isNode()) { } else { tokenArr.push($.getdata('sy_token_wb')) payArr.push($.getdata('sy_payheader_wb')) - } +} -if (isGetCookie = typeof $request !==`undefined`) { - GetCookie(); - $.done() -} - - !(async () => { +!(async () => { if (!tokenArr[0]) { $.msg($.name, '【提示】请先获取新浪微博一cookie') return; @@ -120,19 +120,11 @@ function GetCookie() { if ($request && $request.method != 'OPTIONS' && $request.url.match(/\/\d\/[a-z]+\/\w+\?gsid/)) { const signurlVal = $request.url const token = signurlVal.split(`?`)[1] - const signheaderVal = JSON.stringify($request.headers) + //const signheaderVal = JSON.stringify($request.headers) $.log(`token:${token}`) - //if (signheaderVal) $.setdata(signheaderVal, 'sy_signheader_wb') if (token) $.setdata(token, 'sy_token_wb') $.msg($.name, `获取微博签到Cookie: 成功`, ``) -} else if ($request && $request.method != 'OPTIONS' && $request.url.match(/\/ug\/v2\/signin/)) { - const infourl = $request.url - const infoheaderVal = JSON.stringify($request.headers) - //if (infourl) $.setdata(infourl, 'infourl_wb') - //if (infoheaderVal) $.setdata(infoheaderVal, 'infoheader_wb') -// $.msg($.name, `获取微博信息Cookie: 成功`, ``) -} -else if ($request && $request.method != 'OPTIONS' && $request.url.match(/\/home\/welfare\/signin\/do\?_=[1-9]+/)) { +} else if ($request && $request.method != 'OPTIONS' && $request.url.match(/\/home\/welfare\/signin\/do\?_=[1-9]+/)) { const payheaderVal = JSON.stringify($request.headers) if (payheaderVal) $.setdata(payheaderVal, 'sy_payheader_wb') $.msg($.name, `获取微博钱包Cookie: 成功`, ``)} @@ -158,7 +150,7 @@ function getsign() { else { wbsign = `【每日签到】 ❌ 签到失败`+result.errmsg $.msg($.name, wbsign, ``) - if ($.isNode()) { + if ($.isNode()) { await notify.sendNotify($.name, wbsign) } return @@ -202,13 +194,12 @@ function paysign() { paybag = `【微博钱包】 🔁\n` } } - catch(e){ + catch(error){ paybag = `【钱包签到】❌ Cookie失效`+'\n' } - resolve() + resolve() }) }) } - function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From efae0a38d2d97f7b5710df9b2482a6a06771a486 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 15 Oct 2020 07:01:48 +0800 Subject: [PATCH 120/266] --- Task/weibo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/weibo.js b/Task/weibo.js index 8174c1d80c..af30953298 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -107,7 +107,7 @@ if ($.isNode()) { }; $.msg($.name, nickname, wbsign+paybag+docard) if ($.isNode()) { - await notify.sendNotify($.name, $.sub+'\n'+ $.desc) + await notify.sendNotify($.name, nickname+'\n'+ wbsign+paybag+docard) } } } From 8b77011224522d54146a6e3f85bb5515ac968b94 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 15 Oct 2020 09:25:14 +0800 Subject: [PATCH 121/266] --- Task/sendNotify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 0fd3897c16..68faabc899 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -31,7 +31,7 @@ let txnewsNotifyControl = false;//(默认腾讯新闻脚本推送通知) let youthNotifyControl = false;//(默认中青脚本推送通知) -let dsjNotifyControl = false;//(默认电视家脚本推送通知) +let dsjNotifyControl = true;//(默认电视家脚本推送不通知) if (process.env.PUSH_KEY) { SCKEY = process.env.PUSH_KEY; From 396bbe58cb1fe441239696948f88237ac489da73 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 15 Oct 2020 16:42:34 +0800 Subject: [PATCH 122/266] fix error --- Task/sendNotify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 68faabc899..fc66bebbd6 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -266,4 +266,4 @@ module.exports = { dsjNotifyControl } // prettier-ignore -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From 600c42559c4d1708344afb255109891758eb3610 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 15 Oct 2020 19:05:43 +0800 Subject: [PATCH 123/266] fix error --- Task/youth.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index db93bb77a2..8cf99c4ccc 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -75,15 +75,13 @@ let CookieYouth = [ '',//账号一ck '',//账号二ck,如有更多,依次类推 ] , - ARTBODYs = ['', ''], - REDBODYs = ['', ''], - READTIME = ['', '']; + ARTBODYs = [], REDBODYs = [], READTIME = []; if ($.isNode()) { if (process.env.YOUTH_HEADER && process.env.YOUTH_HEADER.split('#') && process.env.YOUTH_HEADER.split('#').length > 0) { CookieYouth = process.env.YOUTH_HEADER.split('#'); } if (process.env.YOUTH_ARTBODY && process.env.YOUTH_ARTBODY.split('&') && process.env.YOUTH_ARTBODY.split('&').length > 0) { - ARTBODYs = process.env. YOUTH_ARTBODY.split('&'); + ARTBODYs = process.env.YOUTH_ARTBODY.split('&'); } if (process.env.YOUTH_REDBODY && process.env.YOUTH_REDBODY.split('&') && process.env.YOUTH_REDBODY.split('&').length > 0) { REDBODYs = process.env.YOUTH_REDBODY.split('&'); @@ -114,6 +112,7 @@ if ($.isNode()) { timeArr.push(READTIME[item]) } }) + console.log(`============ 共${cookiesArr.length}个中青账号 =============\n`) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) } else { @@ -137,7 +136,7 @@ if (isGetCookie = typeof $request !== 'undefined') { $.msg($.name, '【提示】请先获取中青看点一cookie') return; } - for (let i = 0; i < readArr.length; i++) { + for (let i = 0; i < cookiesArr.length; i++) { if (cookiesArr[i]) { signheaderVal = cookiesArr[i]; articlebodyVal = readArr[i]; From 8848db3c682f845ebdc47eda1268de729aacbb9a Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 15 Oct 2020 23:22:44 +0800 Subject: [PATCH 124/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0Actions=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/GithubActions.md | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Task/GithubActions.md diff --git a/Task/GithubActions.md b/Task/GithubActions.md new file mode 100644 index 0000000000..6d05c4f205 --- /dev/null +++ b/Task/GithubActions.md @@ -0,0 +1,43 @@ +# 关于本仓库 ***Actions Secrets*** 配置说明 :
+ +

+ + | Name | 脚本/相关YML | Value分割符 | 必须/可选 | 注意事项及样式 (其中"xxx"代表任意字符) | +| :---: | :---: | :--------------: | :---: | + | YOUTH_HEADER | **中青看点** youth.yml| # | 必须 | 请求地址: "https://kd.youth.cn/TaskCenter/getSign",
中青签到请求头: { xxx } | + | YOUTH_ARTBODY | 同上 | & | 必须 | 请求地址: "https://ios.baertt.com/v5/article/complete",
阅读请求体: p=xxx | + | YOUTH_REDBODY | 同上 | & | 必须 | 请求地址: "https://ios.baertt.com/v5/article/red_packet",
惊喜红包请求体: p=xxx | + | YOUTH_TIME | 同上 | & | 必须 | 请求地址: "https://ios.baertt.com/v5/user/app_stay.json",
阅读时长请求体: p=xxx | + | YOUTH_NOTIFY_CONTROL | 同上 | true/false | 可选 | 中青通知开关 | + | | | | - | | + | YOUTH_READ | **中青阅读** youth_read.yml| &或者换行 | 必须 | 请求地址: "https://ios.baertt.com/v5/article/complete",
阅读请求体: p=xxx | + | | | | - | | + | TXNEWS_COOKIE | **腾讯新闻** txnews.yml| & | 必须 | 请求地址: "https://api.inews.qq.com/event/v1/user/event/report?",
腾讯新闻 Cookie: openxx=xxx | + | TXNEWS_SIGN | 同上 | # | 必须 | 请求地址同上, 阅读请求地址链接 | + | TXNEWS_VIDEO | 同上 | # | 必须 | 请求地址同上, 视频请求地址链接 | + | TXNEWS_NOTIFY_CONTROL | 同上 | true/false | 可选 | 腾讯新闻通知开关 | + | | | | - | | + | DSJ_HEADERS | **电视家** dianshijia.yml | #或换行 | 必须 | 请求地址: "http://api.gaoqingdianshi.com/api/v2/sign/signin",
签到请求头: { xxx } | + | DSJ_DRAWAL | 同上 | #或换行 | 必须 | 请求地址: "http://api.gaoqingdianshi.com/api/v2/cash/withdrawal",
即提现请求地址 | + | DSJ_NOTIFY_CONTROL | 同上 | true/false | 可选 | 电视家通知开关 | + | | | | - | | + | WB_TOKEN | **新浪微博** weibo.yml | #或换行 | 必须 | 请求地址: "https://api.weibo.cn/xxx?gsid=",
签到token: gsid=xxx | + | WB_PAY | 同上 | #或换行 | 必须 | 请求地址: "https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do",
提现请求头 | + | | | | - | | + | JD_COOKIE | **京喜**
jingxi.yml | &或换行| 必须 | 京东cookie,多个账号的cookie使用`&`隔开或者换行。具体获取参考[浏览器获取京东cookie教程](https://github.com/lxk0301/scripts/blob/master/backUp/GetJdCookie.md) 或者 [插件获取京东cookie教程](https://github.com/lxk0301/scripts/blob/master/backUp/GetJdCookie2.md) | + | | | | - | | + | PUSH_KEY | 微信推送 | - | 可选 | cookie失效推送[server酱的微信通知](http://sc.ftqq.com/3.version) | + | BARK_PUSH | BARK推送 | - | 可选 | cookie失效推送BARK这个APP,填写内容是app提供的`设备码`,例如:https://api.day.app/123 ,那么此处的设备码就是`123`,再不懂看 [这个图](icon/bark.jpg) | + | BARK_SOUND | BARK推送 | - | 可选 | bark推送声音设置,例如`choo`,具体值请在`bark`-`推送铃声`-`查看所有铃声` | + | TG_BOT_TOKEN | telegram推送 | - | 可选 | tg推送,填写自己申请[@BotFather](https://t.me/BotFather)的Token,如`10xxx4:AAFcqxxxxgER5uw` , [具体教程](https://github.com/lxk0301/scripts/pull/37#issuecomment-692415594) | + | TG_USER_ID | telegram推送 | - | 可选 | tg推送,填写[@getuseridbot](https://t.me/getuseridbot)中获取到的纯数字ID, [具体教程](https://github.com/lxk0301/scripts/pull/37#issuecomment-692415594) | + | DD_BOT_TOKEN | 钉钉推送 | - | 可选 | 钉钉推送[官方文档](https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq) ,只需`https://oapi.dingtalk.com/robot/send?access_token=XXX` 等于符号后面的XXX, 注:如果钉钉推送只填写`DD_BOT_TOKEN`,那么安全设置需勾选`自定义关键词`,内容输入输入`账号`即可,其他安全设置不要勾选 | + | DD_BOT_SECRET | 钉钉推送 | - | 可选 | 密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串 , 注:填写了`DD_BOT_TOKEN`和`DD_BOT_SECRET`,钉钉机器人安全设置只需勾选`加签`即可,其他选项不要勾选,再不懂看 [这个图](icon/DD_bot.png) | + + # 以上为配置方法详见[@lxk0301](https://raw.githubusercontent.com/lxk0301/scripts/master/githubAction.md) + + ## ***感谢*** + * [@lxk0301](https://t.me/lxk0301) + * [@chavy](https://t.me/chavyleung) + + \ No newline at end of file From afcaa6ed714760888fb585231342dd5641089498 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 15 Oct 2020 23:37:25 +0800 Subject: [PATCH 125/266] --- Task/dianshijia.js | 2 +- Task/sendNotify.js | 21 --------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 51fcbb8331..52cbfe1551 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -108,7 +108,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - if ($.isNode()) { + if ($.isNode()&& process.env.process.env.DSJ_NOTIFY_CONTROL == false) { await notify.sendNotify($.name, subTitle+'\n'+ detail) } } diff --git a/Task/sendNotify.js b/Task/sendNotify.js index fc66bebbd6..3e6aedc995 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -25,14 +25,6 @@ let DD_BOT_TOKEN = ''; //密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串 let DD_BOT_SECRET = ''; -//运行脚本是否静默运行(即:不推送通知),false打开通知推送,true关闭通知推送 - -let txnewsNotifyControl = false;//(默认腾讯新闻脚本推送通知) - -let youthNotifyControl = false;//(默认中青脚本推送通知) - -let dsjNotifyControl = true;//(默认电视家脚本推送不通知) - if (process.env.PUSH_KEY) { SCKEY = process.env.PUSH_KEY; } @@ -65,16 +57,6 @@ if (process.env.DD_BOT_TOKEN) { DD_BOT_SECRET = process.env.DD_BOT_SECRET; } } - -if (process.env.YOUTH_NOTIFY_CONTROL) { - youthNotifyControl = process.env.YOUTH_NOTIFY_CONTROL; -} -if (process.env.TXNEWS_NOTIFY_CONTROL) { - txnewsNotifyControl = process.env.TXNEWS_NOTIFY_CONTROL; -} -if (process.env.DSJ_NOTIFY_CONTROL) { - dsjNotifyControl = process.env.DSJ_NOTIFY_CONTROL; -} async function sendNotify(text, desp) { //提供三种通知 await serverNotify(text, desp); @@ -261,9 +243,6 @@ module.exports = { TG_BOT_TOKEN, TG_USER_ID, DD_BOT_TOKEN, - txnewsNotifyControl, - youthNotifyControl, - dsjNotifyControl } // prettier-ignore function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From 3efb73b3c1ab8982c05b3dd310c5bb62014d2a28 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 15 Oct 2020 23:42:26 +0800 Subject: [PATCH 126/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 52cbfe1551..498a1f6896 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -108,7 +108,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - if ($.isNode()&& process.env.process.env.DSJ_NOTIFY_CONTROL == false) { + if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false) { await notify.sendNotify($.name, subTitle+'\n'+ detail) } } From 30e343a9d0f2b256ad4d15f25e25a0dfc713aeda Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 12:47:32 +0800 Subject: [PATCH 127/266] --- .github/workflows/youth_read.yml | 2 +- Task/Youth_Read.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index 63b777573a..df3dfc7ef7 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -6,7 +6,7 @@ name: youth_read on: workflow_dispatch: schedule: - - cron: '6 1-10/2 * * *' + - cron: '6 1-12/2 * * *' watch: types: started jobs: diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 757d8934dd..0bfd433fa2 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -13,10 +13,10 @@ const $ = new Env("中青看点") //const notify = $.isNode() ? require('./sendNotify') : ''; let ReadArr = [], YouthBody =""; - if (process.env.YOUTH_READ && process.env.YOUTH_READ.split('&') && process.env.YOUTH_READ.split('&').length > 0) { + if (process.env.YOUTH_READ && process.env.YOUTH_READ.indexOf('&') > -1) { YouthBody = process.env.YOUTH_READ.split('&'); } - else if (process.env.YOUTH_READ && process.env.YOUTH_READ.split('\n') && process.env.YOUTH_READ.split('\n').length > 0) { + else if (process.env.YOUTH_READ && process.env.YOUTH_READ.indexOf('\n') > -1) { YouthBody = process.env.YOUTH_READ.split('\n'); } Object.keys(YouthBody).forEach((item) => { From 3b05826cdc0544cb76afb826b0bf753f7051994b Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 14:16:43 +0800 Subject: [PATCH 128/266] --- Task/Youth_Read.js | 18 +++++++++++++----- Task/dianshijia.js | 19 +++++++++++++------ Task/midu_Read.js | 24 +++++++++++++++--------- Task/txnews.js | 18 ++++++++++++------ Task/weibo.js | 22 ++++++++++++++-------- Task/youth.js | 27 +++++++++++++++++++-------- 6 files changed, 86 insertions(+), 42 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 0bfd433fa2..9ae5db516b 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -11,13 +11,16 @@ Github Actions使用方法见[@lxk0301](https://raw.githubusercontent.com/lxk030 let s = 30000 //等待延迟30s const $ = new Env("中青看点") //const notify = $.isNode() ? require('./sendNotify') : ''; -let ReadArr = [], YouthBody =""; - +let ReadArr = [], YouthBody = "",readscore = 0; if (process.env.YOUTH_READ && process.env.YOUTH_READ.indexOf('&') > -1) { YouthBody = process.env.YOUTH_READ.split('&'); + console.log(`您选择的是用"&"隔开\n`) } else if (process.env.YOUTH_READ && process.env.YOUTH_READ.indexOf('\n') > -1) { YouthBody = process.env.YOUTH_READ.split('\n'); + console.log(`您选择的是用换行隔开\n`) + } else { + YouthBody = process.env.YOUTH_READ.split() } Object.keys(YouthBody).forEach((item) => { if (YouthBody[item]) { @@ -39,7 +42,7 @@ let ReadArr = [], YouthBody =""; } await AutoRead(); } - console.log(`-------------------------\n\n中青看点共完成${$.index}次阅读,阅读请求全部结束`) + console.log(`-------------------------\n\n中青看点共完成${$.index}次阅读,共计获得${readscore}个青豆,阅读请求全部结束`) })() .catch((e) => $.logErr(e)) .finally(() => $.done()) @@ -58,9 +61,14 @@ function AutoRead() { $.post(url, (error, response, data) => { let readres = JSON.parse(data); console.log(data) - if (readres.error_code == '0' && typeof readres.items.read_score === 'number') { + if (readres.success == 'true' && typeof readres.items.read_score === 'number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) - } + readscore += readres.items.read_score + } + else if (readres.success == 'true' && typeof readres.items.score === 'number') { + console.log(`\n本次阅读获得${readres.items.score}个青豆,即将开始下次阅读\n`) + readscore += readres.items.score + } else if (readres.success == false){ console.log(`第${$.index}次阅读请求有误,请删除此请求`) } diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 498a1f6896..3ebf16ea2a 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -48,17 +48,24 @@ const notify = $.isNode() ? require('./sendNotify') : ''; const dianshijia_API = 'http://api.gaoqingdianshi.com/api' let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal; if ($.isNode()) { - if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('#') && process.env.DSJ_HEADERS.split('#').length > 0) { + if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.indexOf('#') > -1) { Dsjheaders = process.env.DSJ_HEADERS.split('#'); + console.log(`您选择的是用"#"隔开\n`) } - else if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.split('\n') && process.env.DSJ_HEADERS.split('\n').length > 0) { + else if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.indexOf('\n') > -1) { Dsjheaders = process.env.DSJ_HEADERS.split('\n'); + console.log(`您选择的是用换行隔开\n`) + } else { + Dsjheaders = process.env.DSJ_HEADERS.split() }; - if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('#') && process.env.DSJ_DRAWAL.split('#').length > 0) { - Drawals = process.env.DSJ_DRAWAL.split('#'); + + if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.indexOf('#') > -1) { + Drawals = process.env.DSJ_DRAWAL.split('#'); } - else if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.split('\n') && process.env.DSJ_DRAWAL.split('\n').length > 0) { - Drawals = process.env.DSJ_DRAWAL.split('\n'); + else if (process.env.DSJ_DRAWAL && process.env.DSJ_DRAWAL.indexOf('\n') > -1) { + Drawals = process.env.DSJ_DRAWAL.split('\n'); + } else { + Drawals = process.env.DSJ_DRAWAL.split() }; Object.keys(Dsjheaders).forEach((item) => { if (Dsjheaders[item]) { diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 7f9d980154..84f63cdccd 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -4,15 +4,21 @@ const $ = new Env(cookieName) let tokenArr = [], TimeArr = [],SignArr= []; if ($.isNode()) { - if (process.env.MIDU_TOKEN && process.env.MIDU_TOKEN.split('#') && process.env.MIDU_TOKEN.split('#').length > 0) { - miduToken = process.env.MIDU_TOKEN.split('#'); - } - if (process.env.MIDU_TIME && process.env.MIDU_TIME.split('#') && process.env.MIDU_TIME.split('#').length > 0) { - ReadBodys = process.env.MIDU_TIME.split('#'); - } - if (process.env.MIDU_SIGN && process.env.MIDU_SIGN.split('#') && process.env.MIDU_SIGN.split('#').length > 0) { - SignBodys = process.env.MIDU_SIGN.split('#'); - } + if (process.env.MIDU_TOKEN && process.env.MIDU_TOKEN.indexOf('#') > -1) { + miduToken = process.env.MIDU_TOKEN.split('#'); + } else { + miduToken = process.env.MIDU_TOKEN.split() + }; + if (process.env.MIDU_TIME && process.env.MIDU_TIME.indexOf('#') > -1) { + ReadBodys = process.env.MIDU_TIME.split('#'); + } else { + ReadBodys = process.env.MIDU_TIME.split() + }; + if (process.env.MIDU_SIGN && process.env.MIDU_SIGN.split('#') && process.env.MIDU_SIGN.indexOf('#') > -1) { + SignBodys = process.env.MIDU_SIGN.split('#'); + } else { + SignBodys = process.env.MIDU_SIGN.split() + }; Object.keys(miduToken).forEach((item) => { if (miduToken[item]) { tokenArr.push(miduToken[item]) diff --git a/Task/txnews.js b/Task/txnews.js index 5a112f6019..87b71e31ab 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -56,14 +56,20 @@ let SignArr = [],SignUrl = ""; if ($.isNode()) { - if (process.env.TXNEWS_COOKIE && process.env.TXNEWS_COOKIE.split('&') && process.env.TXNEWS_COOKIE.split('&').length > 0) { - CookieTxnews = process.env.TXNEWS_COOKIE.split('&'); - } - if (process.env.TXNEWS_SIGN && process.env.TXNEWS_SIGN.split('#') && process.env.TXNEWS_SIGN.split('#').length > 0) { + if (process.env.TXNEWS_COOKIE && process.env.TXNEWS_COOKIE.indexOf('&') > -1) { + CookieTxnews = process.env.TXNEWS_COOKIE.split('&'); + } else { + CookieTxnews = process.env.TXNEWS_COOKIE.split() + }; + if (process.env.TXNEWS_SIGN && process.env.TXNEWS_SIGN.indexOf('#') > -1) { SignUrl = process.env.TXNEWS_SIGN.split('#'); - } - if (process.env.TXNEWS_VIDEO && process.env.TXNEWS_VIDEO.split('#') && process.env.TXNEWS_VIDEO.split('#').length > 0) { + } else { + SignUrl = process.env.TXNEWS_SIGN.split() + }; + if (process.env.TXNEWS_VIDEO && process.env.TXNEWS_VIDEO.indexOf('#') > -1) { VideoUrl = process.env.TXNEWS_VIDEO.split('#'); + } else { + VideoUrl = process.env.TXNEWS_VIDEO.split() }; Object.keys(CookieTxnews).forEach((item) => { if (CookieTxnews[item]) { diff --git a/Task/weibo.js b/Task/weibo.js index af30953298..c7853188de 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -57,17 +57,23 @@ if (isGetCookie = typeof $request !==`undefined`) { $.done() } if ($.isNode()) { - if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('#') && process.env.WB_TOKEN.split('#').length > 0) { - wbtoken = process.env.WB_TOKEN.split('#'); + if (process.env.WB_TOKEN && process.env.WB_TOKEN.indexOf('#') > -1) { + wbtoken = process.env.WB_TOKEN.split('#'); + console.log(`您选择的是用"#"隔开\n`) } - else if (process.env.WB_TOKEN && process.env.WB_TOKEN.split('\n') && process.env.WB_TOKEN.split('\n').length > 0) { - wbtoken = process.env.WB_TOKEN.split('\n'); + else if (process.env.WB_TOKEN && process.env.WB_TOKEN.indexOf('\n') > -1) { + wbtoken = process.env.WB_TOKEN.split('\n'); + console.log(`您选择的是用换行隔开\n`) + } else { + wbtoken = process.env.WB_TOKEN.split() }; - if (process.env.WB_PAY && process.env.WB_PAY.split('#') && process.env.WB_PAY.split('#').length > 0) { - wbPay = process.env.WB_PAY.split('#'); + if (process.env.WB_PAY && process.env.WB_PAY.indexOf('#') > -1) { + wbPay = process.env.WB_PAY.split('#'); } - else if (process.env.WB_PAY && process.env.WB_PAY.split('\n') && process.env.WB_PAY.split('\n').length > 0) { - wbPay = process.env.WB_PAY.split('\n'); + else if (process.env.WB_PAY && process.env.WB_PAY.split('\n').length > 0) { + wbPay = process.env.WB_PAY.split('\n'); + } else { + wbPay = process.env.WB_PAY.split() }; Object.keys(wbtoken).forEach((item) => { if (wbtoken[item]) { diff --git a/Task/youth.js b/Task/youth.js index 8cf99c4ccc..5abaeb9d49 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -77,18 +77,29 @@ let CookieYouth = [ ] , ARTBODYs = [], REDBODYs = [], READTIME = []; if ($.isNode()) { - if (process.env.YOUTH_HEADER && process.env.YOUTH_HEADER.split('#') && process.env.YOUTH_HEADER.split('#').length > 0) { + if (process.env.YOUTH_HEADER && process.env.YOUTH_HEADER.indexOf('#') > -1) { CookieYouth = process.env.YOUTH_HEADER.split('#'); - } - if (process.env.YOUTH_ARTBODY && process.env.YOUTH_ARTBODY.split('&') && process.env.YOUTH_ARTBODY.split('&').length > 0) { + } else { + CookieYouth = process.env.YOUTH_HEADER.split() + }; + + if (process.env.YOUTH_ARTBODY && process.env.YOUTH_ARTBODY.indexOf('&') > -1) { ARTBODYs = process.env.YOUTH_ARTBODY.split('&'); - } - if (process.env.YOUTH_REDBODY && process.env.YOUTH_REDBODY.split('&') && process.env.YOUTH_REDBODY.split('&').length > 0) { + } else { + ARTBODYs = process.env.YOUTH_ARTBODY.split() + }; + + if (process.env.YOUTH_REDBODY && process.env.YOUTH_REDBODY.indexOf('&') > -1) { REDBODYs = process.env.YOUTH_REDBODY.split('&'); - } - if (process.env.YOUTH_TIME && process.env.YOUTH_TIME.split('&') && process.env.YOUTH_TIME.split('&').length > 0) { + } else { + REDBODYs = process.env.YOUTH_REDBODY.split() + }; + + if (process.env.YOUTH_TIME && process.env.YOUTH_TIME.indexOf('&') > -1) { READTIME = process.env.YOUTH_TIME.split('&'); - } + }else { + READTIME = process.env.YOUTH_TIME.split() + }; } if ($.isNode()) { From 574dfa79b58359a28b1487ebd1c6463c04a0dd21 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 14:22:43 +0800 Subject: [PATCH 129/266] --- Task/jdCookie.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Task/jdCookie.js b/Task/jdCookie.js index 6c64accb94..3063efcefa 100644 --- a/Task/jdCookie.js +++ b/Task/jdCookie.js @@ -1,13 +1,14 @@ /* 此文件为Node.js专用。其他用户请忽略 */ -//此处填写京东账号cookie。注:github action用户ck填写到Settings-Secrets里面 +//此处填写京东账号cookie。 +//注:github action用户cookie填写到Settings-Secrets里面,新增JD_COOKIE,多个账号的cookie使用`&`隔开或者换行 let CookieJDs = [ '',//账号一ck '',//账号二ck,如有更多,依次类推 ] // 判断github action里面是否有京东ck -if (process.env.JD_COOKIE && process.env.JD_COOKIE.split('&') && process.env.JD_COOKIE.split('&').length > 0) { +if (process.env.JD_COOKIE) { if (process.env.JD_COOKIE.indexOf('&') > -1) { console.log(`您的cookie选择的是用&隔开\n`) CookieJDs = process.env.JD_COOKIE.split('&'); From 4ad33a51b0f09ebd77bffd5b2db65d251d8c1c0a Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 15:18:17 +0800 Subject: [PATCH 130/266] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/GithubActions.md | 6 +++--- Task/sendNotify.js | 16 ++++++++++++++++ Task/txnews.js | 6 ++++-- Task/youth.js | 18 ++++++++---------- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/Task/GithubActions.md b/Task/GithubActions.md index 6d05c4f205..81c2521d84 100644 --- a/Task/GithubActions.md +++ b/Task/GithubActions.md @@ -8,18 +8,18 @@ | YOUTH_ARTBODY | 同上 | & | 必须 | 请求地址: "https://ios.baertt.com/v5/article/complete",
阅读请求体: p=xxx | | YOUTH_REDBODY | 同上 | & | 必须 | 请求地址: "https://ios.baertt.com/v5/article/red_packet",
惊喜红包请求体: p=xxx | | YOUTH_TIME | 同上 | & | 必须 | 请求地址: "https://ios.baertt.com/v5/user/app_stay.json",
阅读时长请求体: p=xxx | - | YOUTH_NOTIFY_CONTROL | 同上 | true/false | 可选 | 中青通知开关 | + | YOUTH_NOTIFY_CONTROL | 同上 | true/false | 可选 | 中青通知开关
默认当转盘次数为50或者100并且余额大于10元时推送通知 | | | | | - | | | YOUTH_READ | **中青阅读** youth_read.yml| &或者换行 | 必须 | 请求地址: "https://ios.baertt.com/v5/article/complete",
阅读请求体: p=xxx | | | | | - | | | TXNEWS_COOKIE | **腾讯新闻** txnews.yml| & | 必须 | 请求地址: "https://api.inews.qq.com/event/v1/user/event/report?",
腾讯新闻 Cookie: openxx=xxx | | TXNEWS_SIGN | 同上 | # | 必须 | 请求地址同上, 阅读请求地址链接 | | TXNEWS_VIDEO | 同上 | # | 必须 | 请求地址同上, 视频请求地址链接 | - | TXNEWS_NOTIFY_CONTROL | 同上 | true/false | 可选 | 腾讯新闻通知开关 | + | TXNEWS_NOTIFY_CONTROL | 同上 | true/false | 可选 | 腾讯新闻通知开关
默认当余额大于2元且通知间隔为50时推送通知 | | | | | - | | | DSJ_HEADERS | **电视家** dianshijia.yml | #或换行 | 必须 | 请求地址: "http://api.gaoqingdianshi.com/api/v2/sign/signin",
签到请求头: { xxx } | | DSJ_DRAWAL | 同上 | #或换行 | 必须 | 请求地址: "http://api.gaoqingdianshi.com/api/v2/cash/withdrawal",
即提现请求地址 | - | DSJ_NOTIFY_CONTROL | 同上 | true/false | 可选 | 电视家通知开关 | + | DSJ_NOTIFY_CONTROL | 同上 | true/false | 可选 | 电视家通知开关
默认不推送 | | | | | - | | | WB_TOKEN | **新浪微博** weibo.yml | #或换行 | 必须 | 请求地址: "https://api.weibo.cn/xxx?gsid=",
签到token: gsid=xxx | | WB_PAY | 同上 | #或换行 | 必须 | 请求地址: "https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do",
提现请求头 | diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 3e6aedc995..31ce10c1a1 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -24,6 +24,12 @@ let TG_USER_ID = ''; let DD_BOT_TOKEN = ''; //密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串 let DD_BOT_SECRET = ''; +//以下为脚本运行通知开关,true为不推送,false为推送通知 +let txnewsNotifyControl = false;//(默认腾讯新闻脚本推送通知) + +let youthNotifyControl = false;//(默认中青脚本推送通知) + +let dsjNotifyControl = true;//(默认电视家脚本推送不通知) if (process.env.PUSH_KEY) { SCKEY = process.env.PUSH_KEY; @@ -57,6 +63,16 @@ if (process.env.DD_BOT_TOKEN) { DD_BOT_SECRET = process.env.DD_BOT_SECRET; } } +if (process.env.YOUTH_NOTIFY_CONTROL && process.env.YOUTH_NOTIFY_CONTROL==false) { + youthNotifyControl = process.env.YOUTH_NOTIFY_CONTROL; +} +if (process.env.TXNEWS_NOTIFY_CONTROL && process.env.TXNEWS_NOTIFY_CONTROL==false) { + txnewsNotifyControl = process.env.TXNEWS_NOTIFY_CONTROL; +} +if (process.env.DSJ_NOTIFY_CONTROL && process.env.DSJ_NOTIFY_CONTROL==false) { + dsjNotifyControl = process.env.DSJ_NOTIFY_CONTROL; +} + async function sendNotify(text, desp) { //提供三种通知 await serverNotify(text, desp); diff --git a/Task/txnews.js b/Task/txnews.js index 87b71e31ab..b1f2267d5b 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -130,6 +130,8 @@ if (isGetCookie) { }; await getTotal(); await showmsg(); + if ($.isNode()&&readnum%notifyInterval==0&&Total_Earn.data.wealth[1].title > 2){ + await notify.sendNotify($.name,subTile+'\n'+detail) } })() .catch((e) => $.logErr(e)) @@ -302,8 +304,8 @@ function getTotal() { if (error) { $.msg("获取收益信息失败‼️", "", error) } else { - const obj = JSON.parse(data) - subTile = '【收益总计】'+obj.data.wealth[0].title +'金币 '+"钱包: " +obj.data.wealth[1].title+'元' + const Total_Earn = JSON.parse(data) + subTile = '【收益总计】'+Total_Earn.data.wealth[0].title +'金币 '+"钱包: " +Total_Earn.data.wealth[1].title+'元' // $.log("钱包收益共计"+obj.data.wealth[1].title+"元") } resolve() diff --git a/Task/youth.js b/Task/youth.js index 5abaeb9d49..4a0496a729 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -13,8 +13,8 @@ ④ 在阅读文章最下面有个惊喜红包,点击获取惊喜红包请求 3.增加转盘抽奖通知间隔,为了照顾新用户,前三次会有通知,以后默认每50次转盘抽奖通知一次,可自行修改❗️ 转盘完成后通知会一直开启 4.非专业人士制作,欢迎各位大佬提出宝贵意见和指导 -5.注意: 阅读奖励和看视频得奖励一个请求只能运行三次‼️,请不要询问为什么,次日可以继续,增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共4条Cookie,请全部获取,获取请注释 -6. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️ +5.增加每日打卡,打卡时间每日5:00-8:00❗️,请不要忘记设置运行时间,共4条Cookie,请全部获取,获取请注释 +6. 支持Github Actions多账号运行,填写'YOUTH_HEADER'值多账号时用'#'号隔开,其余值均用'&'分割 ‼️,当转盘次数为50或者100并且余额大于10元时推送通知 ~~~~~~~~~~~~~~~~ Surge 4.0 : @@ -71,11 +71,8 @@ let cookiesArr = [], signheaderVal = '', readArr = [], articlebodyVal ='', timeArr = [], timebodyVal = '', redpArr = [], redpbodyVal = ''; -let CookieYouth = [ - '',//账号一ck - '',//账号二ck,如有更多,依次类推 -] , - ARTBODYs = [], REDBODYs = [], READTIME = []; +let CookieYouth = [] ,ARTBODYs = [], + REDBODYs = [], READTIME = []; if ($.isNode()) { if (process.env.YOUTH_HEADER && process.env.YOUTH_HEADER.indexOf('#') > -1) { CookieYouth = process.env.YOUTH_HEADER.split('#'); @@ -178,6 +175,10 @@ else if ($.time('HH')>4&&$.time('HH')<8){ await rotaryCheck(); await earningsInfo(); await showmsg(); + if ($.isNode(){ + && rotaryres.data.remainTurn%50 == 0 &&cash >= 10){ + await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) + } } })() .catch((e) => $.logErr(e)) @@ -636,9 +637,6 @@ async function showmsg() { }else if (rotaryres.code == 10010 && notifyInterval != 0) { rotarynum = ` 转盘${rotaryres.msg}🎉` $.msg($.name+" "+nick+" "+rotarynum,subTitle,detail)//任务全部完成且通知间隔不为0时通知; - if ($.isNode()&&cash >= 10){ - await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) - } } else { console.log(`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n`+ detail) From a0ecf05a3f0cffc250ae1ca338ec68fcda3f2a60 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 15:23:00 +0800 Subject: [PATCH 131/266] --- Task/Youth_Read.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 9ae5db516b..54157ef15b 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -61,11 +61,11 @@ function AutoRead() { $.post(url, (error, response, data) => { let readres = JSON.parse(data); console.log(data) - if (readres.success == 'true' && typeof readres.items.read_score === 'number') { + if (readres.error_code == '0' && typeof readres.items.read_score === 'number') { console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) readscore += readres.items.read_score } - else if (readres.success == 'true' && typeof readres.items.score === 'number') { + else if (readres.error_code == '0' && typeof readres.items.score === 'number') { console.log(`\n本次阅读获得${readres.items.score}个青豆,即将开始下次阅读\n`) readscore += readres.items.score } From 3a4a6da34fc19fb9d33ef04d18c4205b303f03d1 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 15:33:20 +0800 Subject: [PATCH 132/266] --- .github/workflows/txnews.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index 52ce177044..d7b75802de 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -9,7 +9,7 @@ name: txnews on: workflow_dispatch: schedule: - - cron: '*/7 1-15 * * *' + - cron: '*/7 * * * *' watch: types: started From cfda8efe75f0241b3de515324675a6d32652b03e Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 15:36:59 +0800 Subject: [PATCH 133/266] --- Task/txnews.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/txnews.js b/Task/txnews.js index b1f2267d5b..073f1ea594 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -132,7 +132,8 @@ if (isGetCookie) { await showmsg(); if ($.isNode()&&readnum%notifyInterval==0&&Total_Earn.data.wealth[1].title > 2){ await notify.sendNotify($.name,subTile+'\n'+detail) - } + } + } })() .catch((e) => $.logErr(e)) .finally(() => $.done()) From 3b4c21be38b989234f62eb2325ecf30fe5e228fb Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 15:41:06 +0800 Subject: [PATCH 134/266] --- Task/txnews.js | 4 +++- Task/youth.js | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index 073f1ea594..97aa6f689e 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -130,8 +130,10 @@ if (isGetCookie) { }; await getTotal(); await showmsg(); - if ($.isNode()&&readnum%notifyInterval==0&&Total_Earn.data.wealth[1].title > 2){ + if ($.isNode()){ + if (readnum%notifyInterval==0&&Total_Earn.data.wealth[1].title > 2){ await notify.sendNotify($.name,subTile+'\n'+detail) + } } } })() diff --git a/Task/youth.js b/Task/youth.js index 4a0496a729..dd81394782 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -175,8 +175,8 @@ else if ($.time('HH')>4&&$.time('HH')<8){ await rotaryCheck(); await earningsInfo(); await showmsg(); - if ($.isNode(){ - && rotaryres.data.remainTurn%50 == 0 &&cash >= 10){ + if ($.isNode()) + if(rotaryres.data.remainTurn%50 == 0 && cash >= 10){ await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) } } From 9e2c9ba327b569a5a482e29d9f4ac287ed7dadd0 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 20:05:54 +0800 Subject: [PATCH 135/266] --- Task/txnews.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index 97aa6f689e..63dc1b103b 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-09-27 10:10 +更新时间: 2020-10-16 20:10 腾讯新闻签到修改版,可以自动阅读文章获取红包,该活动为瓜分百万现金挑战赛,针对幸运用户参与 @@ -188,13 +188,14 @@ function activity() { return new Promise((resolve, reject) => { setTimeout(()=>{ $.get({url:`${TX_HOST}user/activity/get?isJailbreak=0&${token}`, headers: {Cookie:cookieVal}}, (error,response, data) =>{ - if (error) { - $.msg("获取活动Id失败‼️", "", error) - } else { - let obj = JSON.parse(data) - actid = obj.data.activity.id - console.log(` 您的活动ID为: `+actid+"\n") - } + try{ + let obj = JSON.parse(data) + actid = obj.data.activity.id + console.log(` 您的活动ID为: `+actid+"\n") + } catch(error){ + $.msg("获取活动ID失败,详情请看日志","","") + console.log("活动ID日志:"+ data) + } resolve() }) },s) @@ -283,7 +284,7 @@ function Redpack() { redpackres = `【阅读红包】到账`+redpacks+`元 🌷\n` $.log("阅读红包到账"+redpacks+"元\n") } - else if (rcash.ret == 0&&redpacks>0){ + else if (rcash.ret == 0&& redpacks >0){ redpackres = `【视频红包】到账`+redpacks+`元 🌷\n` $.log("视频红包到账"+redpacks+"元\n") } From 549dc519c31c7d993f3eca739fbf4193739755f7 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 20:29:52 +0800 Subject: [PATCH 136/266] --- Task/sendNotify.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 31ce10c1a1..040fec63fb 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -259,6 +259,12 @@ module.exports = { TG_BOT_TOKEN, TG_USER_ID, DD_BOT_TOKEN, + dsjNotifyControl, + txnewsNotifyControl, + youthNotifyControl, + YOUTH_NOTIFY_CONTROL, + TXNEWS_NOTIFY_CONTROL, + DSJ_NOTIFY_CONTROL } // prettier-ignore function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From ce555dfe93ac88fb1264771181688d69fcaf4397 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 21:54:57 +0800 Subject: [PATCH 137/266] --- Task/sendNotify.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Task/sendNotify.js b/Task/sendNotify.js index 040fec63fb..c6b8e9d8ed 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -261,10 +261,7 @@ module.exports = { DD_BOT_TOKEN, dsjNotifyControl, txnewsNotifyControl, - youthNotifyControl, - YOUTH_NOTIFY_CONTROL, - TXNEWS_NOTIFY_CONTROL, - DSJ_NOTIFY_CONTROL + } // prettier-ignore function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;$.isMute||(this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o))),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} \ No newline at end of file From 34c4b6f50de1fd017f17f7bbe6c09e2b4372d59d Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 23:13:47 +0800 Subject: [PATCH 138/266] --- Task/midu_Read.js | 1 + Task/youth.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 84f63cdccd..0591df8f41 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -110,6 +110,7 @@ function readTime() { detail += '【阅读时长】失败' $.msg(cookieName, subTitle, detail) } + console.log(" 总计 resolve() } catch (e) { $.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) diff --git a/Task/youth.js b/Task/youth.js index dd81394782..4bfe1d7ede 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -176,7 +176,7 @@ else if ($.time('HH')>4&&$.time('HH')<8){ await earningsInfo(); await showmsg(); if ($.isNode()) - if(rotaryres.data.remainTurn%50 == 0 && cash >= 10){ + if( rotarytimes && rotarytimes%50 == 0 && cash >= 10){ await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) } } From c6feeb50569be82b2faccec5034fc24f2a12d991 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 23:19:04 +0800 Subject: [PATCH 139/266] --- Task/midu_Read.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 0591df8f41..0d75677156 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -110,7 +110,7 @@ function readTime() { detail += '【阅读时长】失败' $.msg(cookieName, subTitle, detail) } - console.log(" 总计 + console.log(" 总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner) resolve() } catch (e) { $.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) From 206e3e49a0d09cfc44f516aef62d339c18c22475 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 16 Oct 2020 23:46:11 +0800 Subject: [PATCH 140/266] --- Task/midu_Read.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 0d75677156..4364660a29 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -123,11 +123,10 @@ function readTime() { } function drawPrize() { return new Promise((resolve, reject) => { - const drawPrizeurlVal = 'https://apiwz.midukanshu.com/wz/task/drawPrize' + const drawPrizeurlVal = 'https://apiwz.midukanshu.com/wz/task/drawPrize?' + tokenVal const url = { url: drawPrizeurlVal, - headers: {}, - body: drawVal + headers: {} } url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' @@ -153,11 +152,10 @@ function drawPrize() { // 观看视频获取抽奖机会 function prizeTask() { return new Promise((resolve, reject) => { - const prizeTaskurlVal = 'https://apiwz.midukanshu.com/wz/task/prizeTask' + const prizeTaskurlVal = 'https://apiwz.midukanshu.com/wz/task/prizeTask?'+tokenVal const url = { url: prizeTaskurlVal, headers: {}, - body: drawVal } url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' From adc14efdbbe24b842a2e4c600b0024b82d4e3469 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 17 Oct 2020 01:31:09 +0800 Subject: [PATCH 141/266] --- Task/midu_Read.js | 85 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 72 insertions(+), 13 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 4364660a29..65cbc856ae 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -62,8 +62,10 @@ if ($.isNode()) { $.log(`🔔 ${cookieName}`) await readTime(); await drawPrize(); + await addDraw(); + await taskTime(); await prizeTask(); - await prizeInfo(); + //await prizeInfo(); await dice_roll(); await dice_double(); await signDay(); @@ -80,8 +82,7 @@ function readTime() { let request = { url: "https://apiwz.midukanshu.com/user/readTimeBase/readTime", headers: {'token' : tokenVal,'User-Agent' : `MRSpeedNovel/0918.1649 CFNetwork/1128.0.1 Darwin/19.6.0`,'mobile-brand': 'iPhone','Content-Type': 'application/x-www-form-urlencoded' - }, - body: bodyVal, + }, } $.post(request, (error, response, data) => { try { @@ -94,8 +95,11 @@ function readTime() { const readTotalMinute = readtime.data.readTotalMinute const total_coin = readtime.data.total_coin coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰` - if (readTotalMinute % 20 == 0) { + console.log("总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner) + if (readTotalMinute) { + console.log("总计阅读时长"+readTotalMinute / 2+"分钟") readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` + $.msg(cookieName, subTitle, detail) } else if ($.getdata('debug') == 'true') { readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` @@ -110,7 +114,7 @@ function readTime() { detail += '【阅读时长】失败' $.msg(cookieName, subTitle, detail) } - console.log(" 总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner) + resolve() } catch (e) { $.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) @@ -123,15 +127,15 @@ function readTime() { } function drawPrize() { return new Promise((resolve, reject) => { - const drawPrizeurlVal = 'https://apiwz.midukanshu.com/wz/task/drawPrize?' + tokenVal const url = { - url: drawPrizeurlVal, - headers: {} + url: 'https://apiwz.midukanshu.com/wz/task/drawPrize?' + drawVal, + headers: {}, } url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + url.headers['tk'] =`ACI_Pcpc27lK8Y_z9rcY9IZJUOuwRFpono9tZHd6` $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) @@ -149,10 +153,67 @@ function drawPrize() { }) } +// 额外奖励 +function addDraw() { + return new Promise((resolve, reject) => { + url = { + url: 'https://apiwz.midukanshu.com/wz/task/weekReward', + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + $.post(url, (error, response, data) => { + try { + //$.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) + if (data) { + add_Draw = JSON.parse(data) + } + resolve() + } catch (e) { + // $.msg(cookieName, `额外奖励: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} addDraw - 额外奖励失败: ${e}`) + $.log(`❌ ${cookieName} addDraw - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + +function taskTime() { + return new Promise((resolve, reject) => { + const url = { + url: 'https://apiwz.midukanshu.com/wz/task/time' , + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} taskTime - response: ${JSON.stringify(response)}`) + if (data) { + drawprize = JSON.parse(data) + } + resolve() + } catch (e) { + $.log(`❌ ${cookieName} taskTime - 抽奖失败: ${e}`) + $.log(`❌ ${cookieName} taskTime - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + + + + // 观看视频获取抽奖机会 function prizeTask() { return new Promise((resolve, reject) => { - const prizeTaskurlVal = 'https://apiwz.midukanshu.com/wz/task/prizeTask?'+tokenVal + const prizeTaskurlVal = 'https://apiwz.midukanshu.com/wz/task/prizeTask?'+drawVal const url = { url: prizeTaskurlVal, headers: {}, @@ -193,7 +254,7 @@ function prizeInfo() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - // $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) if (data) { prizeinfo = JSON.parse(data) } @@ -270,11 +331,9 @@ function dice_double() { // 每日签到 function signDay() { return new Promise((resolve, reject) => { - const signurlVal = 'https://apiwz.midukanshu.com/wz/task/signInV2' const url = { - url: signurlVal, + url: "https://apiwz.midukanshu.com/wz/task/signInV2?"+ drawVal, headers: {}, - body: drawVal } url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' From 3c5b483a16695a1df8d2d3e4854241c671142ff0 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 17 Oct 2020 21:02:41 +0800 Subject: [PATCH 142/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=83=E6=97=A5?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E6=8A=BD=E5=A5=96=E9=9D=92=E8=B1=86=EF=BC=8C?= =?UTF-8?q?=E9=9C=80=E6=AF=8F=E7=AD=BE=E5=88=B0=E4=B8=83=E6=97=A5=E8=8E=B7?= =?UTF-8?q?=E5=BE=97=E4=B8=80=E6=AC=A1=E9=9D=92=E8=B1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/txnews2.js | 286 ------------------------------------------------ Task/youth.js | 39 +++++++ 2 files changed, 39 insertions(+), 286 deletions(-) delete mode 100644 Task/txnews2.js diff --git a/Task/txnews2.js b/Task/txnews2.js deleted file mode 100644 index b2bc627025..0000000000 --- a/Task/txnews2.js +++ /dev/null @@ -1,286 +0,0 @@ -/* -更新时间: 2020-09-10 13:30 - -腾讯新闻签到修改版,可以自动阅读文章获取红包,该活动为瓜分百万现金挑战赛,针对幸运用户参与 - -获取Cookie方法: -1.把以下配置复制到响应配置下 -2.打开腾讯新闻app,阅读几篇文章,倒计时结束后即可获取阅读Cookie; -3.看一次推荐视频获取视频地址 -4.可能腾讯有某些限制,有些号码无法领取红包,手动阅读几篇,能领取红包,一般情况下都是正常的, -5.此脚本根据阅读篇数开启通知,默认阅读50篇通知一次,此版本不支持Boxjs ‼️ -版本更新日志: -1.01 修复无法自动获取视频红包,修改通知为阅读篇数间隔,即阅读篇数除以间隔余0时通知,或者自定义常开或常关, -1.02 增加通知跳转链接https://news.qq.com/FERD/cjRedDown.htm,需手动领取此红包 ---------------------- -Surge 4.0 -[Script] -腾讯新闻 = type=cron,cronexp=0 8 0 * * *,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/txnews2.js,script-update-interval=0 - -腾讯新闻 = type=http-request,pattern=https:\/\/api\.inews\.qq\.com\/event\/v1\/user\/event\/report\?,script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/txnews2.js, requires-body=true - -~~~~~~~~~~~~~~~~~~~~~ -Loon 2.1.0+ -[Script] -# 本地脚本 -cron "04 00 * * *" script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/txnews2.js, enabled=true, tag=腾讯新闻 - -http-request https:\/\/api\.inews\.qq\.com\/event\/v1\/user\/event\/report\? script-path=https://raw.githubusercontent.com/Sunert/Scripts/master/Task/txnews2.js, requires-body=true - ------------------ - -QX 1.0.7+ : - [task_local] -0 9 * * * https://raw.githubusercontent.com/Sunert/Scripts/master/Task/txnews2.js, tag=腾讯新闻 - [rewrite_local] -https:\/\/api\.inews\.qq\.com\/event\/v1\/user\/event\/report\? url script-request-body https://raw.githubusercontent.com/Sunert/Scripts/master/Task/txnews2.js - -~~~~~~~~~~~~~~~~~~ - [MITM] -hostname = api.inews.qq.com - ---------------------------- - -Cookie获取后,请注释掉Cookie地址。 - -*/ -const cookieName = '腾讯新闻'; -let s = 500 // 间隔延迟时间 -const $ = new Env(cookieName); -let notifyInterval =$.getdata('notifynum')||50; //阅读篇数间隔通知开为1,常关为0; - -const signurlVal = $.getdata('sy_signurl_txnews2') -const cookieVal = $.getdata( 'sy_cookie_txnews2') -const videoVal = $.getdata( 'video_txnews2') - -let isGetCookie = typeof $request !== 'undefined' -if (isGetCookie) { - GetCookie() -} else { - -!(async () => { -{ -if(signurlVal){ - ID = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g) -} -$.log("\n开始获取您的活动ID") - await getsign(); - await activity(); - await toRead(); - await lookVideo(); - await StepsTotal(); -if(getreadred > 0){ - redbody = `redpack_type=article&activity_id=${actid}` - await Redpack() -}; -if(getvideored>0){ -redbody = `redpack_type=video&activity_id=${actid}` - await Redpack() -}; - await getTotal(); - await showmsg() - } -})() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) -} - -function GetCookie() { -if ($request &&$request.body.indexOf("article_read")> -1) { - const signurlVal = $request.url - const cookieVal = $request.headers['Cookie']; - $.log(`signurlVal:${signurlVal}`) - $.log(`cookieVal:${cookieVal}`) - if (signurlVal) $.setdata(signurlVal, 'sy_signurl_txnews2') - if (cookieVal) $.setdata(cookieVal, 'sy_cookie_txnews2') - $.msg(cookieName, `获取Cookie: 成功🎉`, ``) - } -if ($request &&$request.body.indexOf("video_read")> -1) { - const videoVal = $request.url - $.log(`videoVal:${videoVal}`) - if (videoVal) $.setdata(videoVal, 'video_txnews2') - $.msg(cookieName, `获取视频地址: 成功🎉`, ``) - } - } - - -//签到 -function getsign() { - return new Promise((resolve, reject) => { - const llUrl = { - url: `https://api.inews.qq.com/task/v1/user/signin/add?`,headers:{Cookie: cookieVal} - }; - $.post(llUrl, (error, response, data) => { - const obj = JSON.parse(data) - if (obj.info=="success"){ - next = obj.data.next_points - tip = obj.data.tip_soup||obj.data.share_tip - imgurl= obj.data.share_img - Dictum = tip.replace(/[\<|\.|\>|br]/g,"")+""+obj.data.author.replace(/[\<|\.|\>|br|图|腾讯网友]/g,"") - signinfo = '【签到信息】连续签到' + obj.data.signin_days+'天 '+'明日+'+ next +'金币 成功🎉\n'} - else { - $.msg('签到失败,🉐登录腾讯新闻app获取cookie', "", "") - console.log('签到失败,🉐登录腾讯新闻app获取cookie'+data) - return - } - resolve() - }) - }) -} - -function activity() { - return new Promise((resolve, reject) => { - setTimeout(()=>{ - const actUrl = { - url: `https://api.inews.qq.com/activity/v1/user/activity/get?isJailbreak=0&${ID}`, - headers: {Cookie: cookieVal}}; - $.get(actUrl, function(error,response, data) { - if (error) { - $.msg("获取活动Id失败‼️", "", error) - } else { - const obj = JSON.parse(data) - actid = obj.data.activity.id - console.log(` 您的活动ID为: `+actid+"\n") - } - resolve() - }) - },s) - }) - } - -//阅读阶梯 -function toRead() { - return new Promise((resolve, reject) => { - setTimeout(()=>{ - $.post({url: signurlVal, headers: {Cookie:cookieVal},body: 'event=article_read'},(error, resp, data)=> { - $.log("正在阅读文章\n") - }) - resolve() - },s) - }) -} -function lookVideo() { - return new Promise((resolve, reject) => { - setTimeout(()=>{ - $.post({url: videoVal, headers: {Cookie:cookieVal},body: 'event=video_read'},(error, response, data) =>{ - if (error){ - $.msg(cookieName, '观看视频:'+ error) - }else{ - $.log("正在浏览视频\n") - tolookresult = JSON.parse(data) - } - resolve() - }) - },s*2) - }) -} - -//阅读文章统计 -function StepsTotal() { -return new Promise((resolve, reject) => { - setTimeout(()=>{ - const StepsUrl = { - url: `https://api.inews.qq.com/activity/v1/activity/info/get?activity_id=${actid}&${ID}`, - headers: {Cookie: cookieVal} - } - $.get(StepsUrl, (error, response, data) => { - totalred = JSON.parse(data) - $.log("正在统计阅读数据:") - totalcion = totalred.data.extends.today_total_coin - if (totalred.ret == 0){ - for (i=0;i { - setTimeout(()=>{ - const cashUrl = { - url: `https://api.inews.qq.com/activity/v1/activity/redpack/get?isJailbreak=0&${ID}`, - headers: {Cookie: cookieVal}, - body: redbody - } - $.post(cashUrl, (error, response, data) => { - let rcash = JSON.parse(data) - try{ - redpacks = rcash.data.award.num/100 - if (rcash.ret == 0&&readredpack!=0&&getreadred>0){ - redpackres = `【阅读红包】到账`+readredpack+`元 🌷\n` - $.log("阅读红包到账"+readredpack+"元\n") - } - else if (rcash.ret == 0&&videoredpack!=0&&getvideored>0){ - redpackres = `【视频红包】到账`+videoredpack+`元 🌷\n` - $.log("视频红包到账"+videoredpack+"元\n") - } - } - catch(err){ - $.log("打开红包失败,响应数据: "+ data+"\n错误代码:"+err) - } - - resolve() - }) - },s) - }) -} - - -//收益总计 -function getTotal() { -return new Promise((resolve, reject) => { - const totalUrl = { - url: `https://api.inews.qq.com/activity/v1/usercenter/activity/list?isJailbreak`, - headers: {Cookie: cookieVal}}; - $.post(totalUrl, function(error,response, data) { - if (error) { - $.msg("获取收益信息失败‼️", "", error) - } else { - const obj = JSON.parse(data) - subTile = '【收益总计】'+obj.data.wealth[0].title +'金币 '+"钱包: " +obj.data.wealth[1].title+'元' - $.log("钱包收益共计"+obj.data.wealth[1].title+"元") - } - resolve() - }) - }) - } - -function showmsg() { - return new Promise((resolve, reject) => { - if(readnum||videonum){ - detail = signinfo + `【文章阅读】已读/再读: `+ readnum +`/`+readtitle+` 篇\n`+`【阅读红包】已开/总计: `+openreadred+`/`+readredtotal+` 个🧧\n`+ `【观看视频】已看/再看: `+ videonum +`/`+videotitle+` 分钟\n`+`【视频红包】已开/总计: `+openvideored+`/`+videoredtotal+` 个🧧\n【每日一句】`+Dictum - } - if -(readnum%notifyInterval==0){ - $.msg(cookieName,subTile,detail,{ 'open-url': "https://news.qq.com/FERD/cjRedDown.htm", 'media-url': imgurl } ) - } - else if (openreadred==readredtotal&&openvideored==videoredtotal){ - $.msg(cookieName+` 今日任务已完成✅`,subTile,detail,{ 'open-url': "https://news.qq.com/FERD/cjRedDown.htm", 'media-url': imgurl } ) - } - resolve() - }) -} - -// prettier-ignore -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t||!this.isLoon()&&this.isSurge())return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} diff --git a/Task/youth.js b/Task/youth.js index 4bfe1d7ede..b88098a1e9 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -165,6 +165,8 @@ if ($.isNode()&& $.time('HH')>20&&$.time('HH')<22){ else if ($.time('HH')>4&&$.time('HH')<8){ await endCard(); } + await SevCont(); + await ArticleShare(); await openbox(); await getAdVideo(); await gameVideo(); @@ -345,6 +347,43 @@ function Cardshare() { }) } +function SevCont() { + return new Promise((resolve, reject) => { + setTimeout(() => { + $.post({url: `${YOUTH_HOST}PunchCard/luckdraw?`, + headers: JSON.parse(signheaderVal), + }, async(error, response, data) => { + sevres = JSON.parse(data) + if (sevres.code == 1) { + + detail += `【七日签到】+${sevres.data.score}青豆 \n` + + }else if (sevres.code == 0){ + //detail += `【七日签到】${sevres.msg}\n` + // $.log(`${boxres.msg}`) + } + resolve() + }) + },s) + }) +} + +function ArticleShare() { + return new Promise((resolve, reject) => { + setTimeout(() => { + const url = { + url: `https://focu.youth.cn/article/s?&uid=46308484&signature=0Z3Jgv96wqmVPeM7obRdNpHXgAmRhxNPJ6y4jpGDnANbo8KXQr`, + headers: JSON.parse(signheaderVal), + } + $.post(url, async(error, response, data) => { + //boxres = JSON.parse(data) + resolve() + }) + },s) + }) +} + + //开启时段宝箱 function openbox() { return new Promise((resolve, reject) => { From 9de71b65ea0e876fbe14667666c1890ec33a1a5b Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 17 Oct 2020 22:02:41 +0800 Subject: [PATCH 143/266] =?UTF-8?q?fix=20=E8=85=BE=E8=AE=AF=E6=96=B0?= =?UTF-8?q?=E9=97=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/txnews.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/txnews.js b/Task/txnews.js index 63dc1b103b..f88f494014 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -290,8 +290,9 @@ function Redpack() { } } catch(error){ - $.log("打开红包失败,响应数据: "+ data+"\n错误代码:"+error) }; + console.log("打开红包失败,响应数据: "+ data) $.msg($.name, "开红包失败,详情请看日志 ❌", error) + }; resolve() }) },s) From 893400539f700b6f756b550fa5513d949c1bebec Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 17 Oct 2020 22:17:00 +0800 Subject: [PATCH 144/266] =?UTF-8?q?fix=E4=B8=AD=E9=9D=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/youth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/youth.js b/Task/youth.js index b88098a1e9..6cc6a1fa07 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -177,7 +177,7 @@ else if ($.time('HH')>4&&$.time('HH')<8){ await rotaryCheck(); await earningsInfo(); await showmsg(); - if ($.isNode()) + if ($.isNode()&&rotaryres.code !== 10010) if( rotarytimes && rotarytimes%50 == 0 && cash >= 10){ await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) } @@ -372,7 +372,7 @@ function ArticleShare() { return new Promise((resolve, reject) => { setTimeout(() => { const url = { - url: `https://focu.youth.cn/article/s?&uid=46308484&signature=0Z3Jgv96wqmVPeM7obRdNpHXgAmRhxNPJ6y4jpGDnANbo8KXQr`, + url: `https://focu.youth.cn/article/s?signature=0Z3Jgv96wqmVPeM7obRdNpHXgAmRhxNPJ6y4jpGDnANbo8KXQr`, headers: JSON.parse(signheaderVal), } $.post(url, async(error, response, data) => { From 59b6f691b090c6f4386bdacc90b8cce2a7f351cf Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 00:49:17 +0800 Subject: [PATCH 145/266] =?UTF-8?q?=E8=85=BE=E8=AE=AF=E6=96=B0=E9=97=BB?= =?UTF-8?q?=E6=89=93=E5=BC=80=E9=93=BE=E6=8E=A5=E6=B5=8B=E8=AF=95=EF=BC=8C?= =?UTF-8?q?=E5=A4=A7=E6=A6=82=E7=8E=87=E4=B8=8D=E9=80=9A=E8=BF=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/txnews.js | 92 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 74 insertions(+), 18 deletions(-) diff --git a/Task/txnews.js b/Task/txnews.js index f88f494014..8b82aef69e 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-10-16 20:10 +更新时间: 2020-10-18 00:50 腾讯新闻签到修改版,可以自动阅读文章获取红包,该活动为瓜分百万现金挑战赛,针对幸运用户参与 @@ -52,7 +52,7 @@ let notifyInterval =$.getdata('notifynum')||50; //阅读篇数间隔通知开为 const TX_HOST = 'https://api.inews.qq.com/activity/v1/' let SignArr = [],SignUrl = ""; cookiesArr = [],CookieTxnews = ""; - VideoArr = [],SignUrl = ""; + VideoArr = [],SignUrl = "",order = ""; if ($.isNode()) { @@ -114,11 +114,16 @@ if (isGetCookie) { $.index = i + 1; console.log(`-------------------------\n\n开始【腾讯新闻账号${$.index}】`) } - token = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0] + ID = signurlVal.match(/devid=[a-zA-Z0-9_-]+/g)[0] + token = signurlVal.split("&mac")[1] await getsign(); await activity(); await toRead(); await lookVideo(); + await OrderID(); + if(order) { + await Pending(); + }; await StepsTotal(); if(getreadred > 0){ redbody = `redpack_type=article&activity_id=${actid}` @@ -187,11 +192,11 @@ function getsign() { function activity() { return new Promise((resolve, reject) => { setTimeout(()=>{ - $.get({url:`${TX_HOST}user/activity/get?isJailbreak=0&${token}`, headers: {Cookie:cookieVal}}, (error,response, data) =>{ + $.get({url:`${TX_HOST}user/activity/get?isJailbreak=0&${ID}`, headers: {Cookie:cookieVal}}, (error,response, data) =>{ try{ let obj = JSON.parse(data) actid = obj.data.activity.id - console.log(` 您的活动ID为: `+actid+"\n") + console.log(`\n您的活动ID为: `+actid+"\n") } catch(error){ $.msg("获取活动ID失败,详情请看日志","","") console.log("活动ID日志:"+ data) @@ -207,9 +212,16 @@ function toRead() { return new Promise((resolve, reject) => { setTimeout(()=>{ $.post({url: signurlVal, headers: {Cookie:cookieVal}, body: 'event=article_read'},(error, resp, data)=> { - $.log("正在浏览文章"+data) - }) - resolve() + try{ + let obj = JSON.parse(data) + if(obj.ret == 0){ + console.log("本次阅读领取" +obj.data.countdown_timer.countdown_tips+"\n") + } + } catch(error){ + console.log("本次阅读失败"+data+"\n") + } + resolve() + }) },s) }) } @@ -217,24 +229,68 @@ function lookVideo() { return new Promise((resolve, reject) => { setTimeout(()=>{ $.post({url: videoVal, headers: {Cookie:cookieVal},body: 'event=video_read'},(error, response, data) =>{ - if (error){ - $.msg($.name, '观看视频:'+ error) - }else{ - $.log("正在观看视频"+data) - tolookresult = JSON.parse(data) - } + try{ + let obj = JSON.parse(data) + if(obj.ret == 0){ + console.log("本次视频领取" +obj.data.countdown_timer.countdown_tips+"\n") + } + } catch(error){ + console.log("观看视频失败"+data+"\n") + } resolve() - }) + }) },s*2) }) } +function OrderID() { + return new Promise((resolve, reject) => { + $.post({url: `https://api.prize.qq.com/v1/newsapp/rp/common?isJailbreak=0&mac=${token}`, headers: {Cookie:cookieVal,"Content-Type": "application/x-www-form-urlencoded"},body: 'actFrom=wxplugin&actEname=newsapp_cj'},(error, response, data) =>{ + //console.log(data) + if(response.statusCode !== 403){ + try { + let openres = JSON.parse(data) + if (openres.code == 0 ){ + meney = openres.data.money/100 + order = openres.data.orderID + console.log(` 看新闻,领红包,到账: `+meney+'元\n') + } + } catch(error){ + console.log("打开看新闻,领红包失败:"+ data) } + } + resolve() + }) + }) +} + +function Pending() { + console.log(order) + return new Promise((resolve, reject) => { + $.post({url: `https://api.prize.qq.com/v1/newsapp/rp/get_pending?isJailbreak=0&mac=${token}`, + headers: {Cookie:cookieVal,"Content-Type": "application/x-www-form-urlencoded"}, + body: `orderID=${order}`},(error, response, data) =>{ + //console.log(data) + if (response.statusCode !== 403){ + try { + let res = JSON.parse(data) + if (res.code == 0 ){ + console.log( '看新闻,领红包领取成功\n') + } + } catch(error){ + console.log("看新闻,领红包失败:"+ data) + } + } + resolve() + }) + }) +} + //阅读文章统计 function StepsTotal() { return new Promise((resolve, reject) => { setTimeout(()=>{ const StepsUrl = { - url: `${TX_HOST}activity/info/get?activity_id=${actid}&${token}`, + url: `${TX_HOST}activity/info/get?activity_id=${actid}&${ID}`, headers: {Cookie: cookieVal} } $.get(StepsUrl, (error, response, data) => { @@ -272,7 +328,7 @@ function Redpack() { return new Promise((resolve, reject) => { setTimeout(()=>{ const cashUrl = { - url: `${TX_HOST}activity/redpack/get?isJailbreak=0&${token}`, + url: `${TX_HOST}activity/redpack/get?isJailbreak=0&${ID}`, headers: {Cookie: cookieVal}, body: redbody } @@ -335,4 +391,4 @@ function showmsg() { } // prettier-ignore -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 98cb32f9d5f9715cf8302ea85fa59319a376c16a Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 00:53:40 +0800 Subject: [PATCH 146/266] --- Task/youth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/youth.js b/Task/youth.js index 6cc6a1fa07..131bc63c44 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -372,7 +372,7 @@ function ArticleShare() { return new Promise((resolve, reject) => { setTimeout(() => { const url = { - url: `https://focu.youth.cn/article/s?signature=0Z3Jgv96wqmVPeM7obRdNpHXgAmRhxNPJ6y4jpGDnANbo8KXQr`, + url: `https://focu.youth.cn/article/s?signature=0Z3Jgv96wqmVPeM7obRdNpHXgAmRhxNPJ6y4jpGDnANbo8KXQr&uid=46308484&phone_code=26170a068d9b9563e7028f197c8a4a2b&scid=33007686&time=1602937887&app_version=1.7.8&sign=d21dd80d0c6563f6f810dd76d7e0aef2`, headers: JSON.parse(signheaderVal), } $.post(url, async(error, response, data) => { From 3a58b715dc035abf9d7cfd8e04137e0136e2ea2e Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 01:14:26 +0800 Subject: [PATCH 147/266] --- .github/workflows/dianshijia.yml | 4 ++-- .github/workflows/jingxi.yml | 4 ++-- .github/workflows/midu_read.yml | 4 ++-- .github/workflows/txnews.yml | 4 ++-- .github/workflows/weibo.yml | 4 ++-- .github/workflows/youth.yml | 4 ++-- .github/workflows/youth_read.yml | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index 3811697c12..22e2a29853 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -16,10 +16,10 @@ jobs: DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - name: npm install run: | npm install diff --git a/.github/workflows/jingxi.yml b/.github/workflows/jingxi.yml index 6baff88bfa..2c3b5b521a 100644 --- a/.github/workflows/jingxi.yml +++ b/.github/workflows/jingxi.yml @@ -15,10 +15,10 @@ jobs: JD_COOKIE: ${{ secrets.JD_COOKIE }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - name: npm install run: | npm install diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index eb2d4c9932..a05b186e84 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -17,10 +17,10 @@ jobs: MIDU_SIGN: ${{ secrets.MIDU_SIGN }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - name: npm install run: | npm install diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index d7b75802de..8705933cee 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -23,10 +23,10 @@ jobs: TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - name: npm install run: | npm install diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml index afeaabbfd7..f9f24e7a70 100644 --- a/.github/workflows/weibo.yml +++ b/.github/workflows/weibo.yml @@ -16,10 +16,10 @@ jobs: WB_PAY: ${{ secrets.WB_PAY }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - name: npm install if: env.WB_TOKEN run: | diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index f9e765a189..afad4ea1db 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -21,10 +21,10 @@ jobs: YOUTH_TIME: ${{ secrets.YOUTH_TIME }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - name: npm install if: env.YOUTH_HEADER run: | diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index df3dfc7ef7..c6ddde2278 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -20,10 +20,10 @@ jobs: YOUTH_READ4: ${{ secrets.YOUTH_READ4 }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 14.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 14.x - name: npm install run: | npm install From d1c19748e5072e9587730a5148defb678b68e799 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 16:09:00 +0800 Subject: [PATCH 148/266] fix midu --- Task/midu_Read.js | 146 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 118 insertions(+), 28 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 65cbc856ae..3da0b20a02 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -2,7 +2,7 @@ const cookieName = '米读阅读时长' const $ = new Env(cookieName) let tokenArr = [], TimeArr = [],SignArr= []; - + const bind = true; if ($.isNode()) { if (process.env.MIDU_TOKEN && process.env.MIDU_TOKEN.indexOf('#') > -1) { miduToken = process.env.MIDU_TOKEN.split('#'); @@ -60,14 +60,25 @@ if ($.isNode()) { $.index = i + 1; console.log(`-------------------------\n\n开始【米读账号${$.index}】`) $.log(`🔔 ${cookieName}`) + tkVal = drawVal.match(/tk=(\w+)/)[1] + for (i=0;i<10;i++){ await readTime(); - await drawPrize(); +} + await prizeInfo(); + if (prizeinfo && prizeinfo.data && prizeinfo.data.total_num) { + await prizeTask() + await drawPrize() + } await addDraw(); await taskTime(); - await prizeTask(); - //await prizeInfo(); + await OthersAd(); await dice_roll(); await dice_double(); + await userInfo(); + bind ? '' : $.setdata('', 'bind'); + if (bind) { + await Bind() + } await signDay(); await signVideo() } @@ -79,14 +90,22 @@ if ($.isNode()) { // 阅读时长 function readTime() { return new Promise((resolve, reject) => { + setTimeout(()=> { let request = { url: "https://apiwz.midukanshu.com/user/readTimeBase/readTime", - headers: {'token' : tokenVal,'User-Agent' : `MRSpeedNovel/0918.1649 CFNetwork/1128.0.1 Darwin/19.6.0`,'mobile-brand': 'iPhone','Content-Type': 'application/x-www-form-urlencoded' - }, + headers: { + 'host': 'apiwz.midukanshu.com', + 'versionName': '1.24.0.0918.1649', + "User-Agent": "MRSpeedNovel/0918.1649 CFNetwork/1128.0.1 Darwin/19.6.0", + "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", + 'token': tokenVal, + 'tk': tkVal + }, + body: bodyVal } $.post(request, (error, response, data) => { try { - $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}`) + $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}\n`) readtime = JSON.parse(data) let subTitle = '' let detail = '' @@ -103,7 +122,7 @@ function readTime() { $.msg(cookieName, subTitle, detail) } else if ($.getdata('debug') == 'true') { readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` - $.msg(cookieName, subTitle, detail) + // $.msg(cookieName, subTitle, detail) } @@ -119,10 +138,11 @@ function readTime() { } catch (e) { $.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} readTime - 签到失败: ${e}`) - $.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}\n`) resolve() } }) + },30000) }) } function drawPrize() { @@ -135,10 +155,10 @@ function drawPrize() { url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' - url.headers['tk'] =`ACI_Pcpc27lK8Y_z9rcY9IZJUOuwRFpono9tZHd6` + url.headers['tk'] = tkVal $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) if (data) { drawprize = JSON.parse(data) } @@ -146,12 +166,55 @@ function drawPrize() { } catch (e) { // $.msg(cookieName, `抽奖: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} drawPrize - 抽奖失败: ${e}`) - $.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) resolve() } }) }) } +// 用户信息 +function userInfo() { + return new Promise((resolve, reject) => { + const userInfourlVal = 'https://apiwz.midukanshu.com/wz/user/getInfo?' + bodyVal + const url = { + url: userInfourlVal, + headers: {} + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + try { + // $.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) + userInfo = JSON.parse(data) + resolve() + } catch (e) { + $.msg(cookieName, `获取用户信息: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} userInfo - 获取用户信息失败: ${e}`) + $.log(`❌ ${cookieName} userInfo - response: ${JSON.stringify(response)}`) + resolve() + } + }) + }) +} + +function Bind() { + return new Promise((resolve, reject) => { + const url = { + url: 'http://fisson.1sapp.com/nlx/shareLink/tmpBind', + headers: {}, + body: 'app_id=7&act_type=1&act_name=grad_pupil&invite_code=A1051999596&telephone=' + userInfo.data.mobile + } + url.headers['Host'] = 'fisson.1sapp.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + $.post(url, (error, response, data) => { + $.setdata('', 'bind') + resolve() + }) + }) +} + // 额外奖励 function addDraw() { @@ -166,7 +229,7 @@ function addDraw() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - //$.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) if (data) { add_Draw = JSON.parse(data) } @@ -174,7 +237,7 @@ function addDraw() { } catch (e) { // $.msg(cookieName, `额外奖励: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} addDraw - 额外奖励失败: ${e}`) - $.log(`❌ ${cookieName} addDraw - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} addDraw - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -193,14 +256,14 @@ function taskTime() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} taskTime - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} taskTime - response: ${JSON.stringify(response)}\n`) if (data) { drawprize = JSON.parse(data) } resolve() } catch (e) { $.log(`❌ ${cookieName} taskTime - 抽奖失败: ${e}`) - $.log(`❌ ${cookieName} taskTime - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} taskTime - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -224,7 +287,7 @@ function prizeTask() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}\n`) if (data) { prizetask = JSON.parse(data) } @@ -232,7 +295,7 @@ function prizeTask() { } catch (e) { // $.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} prizeTask - 观看视频抽奖失败: ${e}`) - $.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -254,7 +317,7 @@ function prizeInfo() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) + // $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}\n`) if (data) { prizeinfo = JSON.parse(data) } @@ -262,7 +325,7 @@ function prizeInfo() { } catch (e) { // $.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} prizeInfo - 抽奖信息失败: ${e}`) - $.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -283,7 +346,7 @@ function dice_roll() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}\n`) if (JSON.parse(data).code == 0) { rollList=JSON.parse(data) } @@ -291,7 +354,7 @@ function dice_roll() { } catch (e) { $.msg(cookieName, `掷骰子: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} dice_roll - 掷骰子失败: ${e}`) - $.log(`❌ ${cookieName} dice_roll - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} dice_roll - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -313,7 +376,7 @@ function dice_double() { url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}\n`) if (JSON.parse(data).code == 0) { doubleList=JSON.parse(data) } @@ -321,7 +384,7 @@ function dice_double() { } catch (e) { $.msg(cookieName, `骰子双倍奖励: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} dice_double - 骰子双倍奖励失败: ${e}`) - $.log(`❌ ${cookieName} dice_double - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} dice_double - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -341,13 +404,13 @@ function signDay() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}\n`) _signDay = JSON.parse(data) resolve() } catch (e) { $.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} signDay - 签到失败: ${e}`) - $.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -369,13 +432,13 @@ function signVideo() { url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}\n`) _signVideo = JSON.parse(data) resolve() } catch (e) { $.msg(cookieName, `签到视频: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} signVideo - 签到视频失败: ${e}`) - $.log(`❌ ${cookieName} signVideo - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} signVideo - response: ${JSON.stringify(response)}\n`) resolve() } }) @@ -383,5 +446,32 @@ function signVideo() { } +function OthersAd() { + return new Promise((resolve, reject) => { + const otherVal = 'https://apiwz.midukanshu.com/activity/dividend/videoAdReward' + const url = { + url: otherVal, + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + url.headers['token'] = tokenVal + $.post(url, (error, response, data) => { + try { + $.log(`🐍🐢 ${cookieName} OthersAd - response: ${JSON.stringify(response)}\n`) + _signVideo = JSON.parse(data) + resolve() + } catch (e) { + $.msg(cookieName, `额外奖励: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} OthersAd - 额外奖励失败: ${e}`) + $.log(`❌ ${cookieName} OthersAd - response: ${JSON.stringify(response)}\n`) + resolve() + } + }) + }) +} + function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 51f429263fc8413894444089bf27459ab6cd976d Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 16:10:52 +0800 Subject: [PATCH 149/266] --- Task/package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Task/package.json b/Task/package.json index e8a427d084..60bc42f1ce 100644 --- a/Task/package.json +++ b/Task/package.json @@ -21,10 +21,6 @@ "crypto-js": "^4.0.0", "got": "^11.5.1", "http-server": "^0.12.3", - "node-schedule": "^1.3.2", - "tough-cookie": "^4.0.0", - "download": "^8.0.0", - "request": "^2.88.2", - "request-promise": "^4.2.5" + "tough-cookie": "^4.0.0" } } From 0bd9127808b1f1460e089f3a9edeb18bf11897bc Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 16:16:30 +0800 Subject: [PATCH 150/266] --- .github/workflows/midu_read.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index a05b186e84..6819bef976 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -6,7 +6,7 @@ name: midu_read on: workflow_dispatch: schedule: - - cron: '*/30 1-18/2 * * *' + - cron: '*/1 1-16/2 * * *' jobs: build: From 2f4df1a6ea6c9e3dde13def16c979f7fec393dd6 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 16:19:40 +0800 Subject: [PATCH 151/266] --- Task/midu_Read.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 3da0b20a02..e7183c191a 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -119,7 +119,7 @@ function readTime() { console.log("总计阅读时长"+readTotalMinute / 2+"分钟") readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` - $.msg(cookieName, subTitle, detail) + //$.msg(cookieName, subTitle, detail) } else if ($.getdata('debug') == 'true') { readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` // $.msg(cookieName, subTitle, detail) From 813c1cbdd1bb228719ee49c13b69bcaeeadc09c8 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 16:21:10 +0800 Subject: [PATCH 152/266] --- .github/workflows/midu_read.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 6819bef976..954ffaefa9 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -6,7 +6,7 @@ name: midu_read on: workflow_dispatch: schedule: - - cron: '*/1 1-16/2 * * *' + - cron: '*/29 1-16/2 * * *' jobs: build: From bbc7bf2e16b0bdf9a43c87a8abdbeb86e28c558d Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 16:36:53 +0800 Subject: [PATCH 153/266] --- .github/workflows/midu_read.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 954ffaefa9..d0256da7f1 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -6,7 +6,7 @@ name: midu_read on: workflow_dispatch: schedule: - - cron: '*/29 1-16/2 * * *' + - cron: '*/3 1-18 * * *' jobs: build: From 6f26a4685b9e93aeff839e5e53e4585ca13af602 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 16:39:05 +0800 Subject: [PATCH 154/266] --- .github/workflows/midu_read.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index d0256da7f1..6ba0fd7c52 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -6,7 +6,7 @@ name: midu_read on: workflow_dispatch: schedule: - - cron: '*/3 1-18 * * *' + - cron: '*/7 1-18 * * *' jobs: build: From 7a8e9bcec15600c1843582476e61384c81fd080b Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 17:06:33 +0800 Subject: [PATCH 155/266] --- Task/midu_Read.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index e7183c191a..3aba094c99 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -1,11 +1,16 @@ - +/* +MIDU_TOKEN 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链接请求头内的token; +MIDU_TIME 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链接请求体,格式为 "dataEncStr=XXX; +MIDU_SIGN 为 "https://apiwz.midukanshu.com/wz/task/" 请求体,格式为 "fullVersion=XXX" +以上全部值不许换行,多账号用#分隔 +*/ const cookieName = '米读阅读时长' const $ = new Env(cookieName) let tokenArr = [], TimeArr = [],SignArr= []; const bind = true; if ($.isNode()) { if (process.env.MIDU_TOKEN && process.env.MIDU_TOKEN.indexOf('#') > -1) { - miduToken = process.env.MIDU_TOKEN.split('#'); + miduToken = process.env.MIDU_TOKEN.split('#'); } else { miduToken = process.env.MIDU_TOKEN.split() }; From 5e409072e0473b7f3e43d2217a68d58650c0db8f Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 17:35:59 +0800 Subject: [PATCH 156/266] --- Task/midu_Read.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 3aba094c99..825db30f09 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -3,6 +3,7 @@ MIDU_TOKEN 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链 MIDU_TIME 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链接请求体,格式为 "dataEncStr=XXX; MIDU_SIGN 为 "https://apiwz.midukanshu.com/wz/task/" 请求体,格式为 "fullVersion=XXX" 以上全部值不许换行,多账号用#分隔 +由于运行时间较长,则只在Actions运行 */ const cookieName = '米读阅读时长' const $ = new Env(cookieName) @@ -52,7 +53,7 @@ if ($.isNode()) { return; } if ($.isNode()){ - console.log(`\n============ 脚本执行来自 Github Action ==============\n`) + console.log(`============ 共${tokenArr.length}个米读账号 =============\n`) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) }; From 746f0b101a85492863e4cec1fc6513464dcd7f2b Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 17:42:12 +0800 Subject: [PATCH 157/266] --- Task/midu_Read.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 825db30f09..a4096c9f05 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -120,7 +120,7 @@ function readTime() { const readTotalMinute = readtime.data.readTotalMinute const total_coin = readtime.data.total_coin coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰` - console.log("总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner) + console.log("总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner+`\n本次获得${coin}`) if (readTotalMinute) { console.log("总计阅读时长"+readTotalMinute / 2+"分钟") readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` From 1e3f091c269029d73b78625e3083a5025498ba44 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 19:46:04 +0800 Subject: [PATCH 158/266] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B1=B3=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/midu_Read.js | 66 ++++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index a4096c9f05..1fcaa60a4d 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -29,17 +29,17 @@ if ($.isNode()) { if (miduToken[item]) { tokenArr.push(miduToken[item]) } - }) + }); Object.keys(ReadBodys).forEach((item) => { if (ReadBodys[item]) { TimeArr.push(ReadBodys[item]) } - }) + }); Object.keys(SignBodys).forEach((item) => { if (SignBodys[item]) { SignArr.push(SignBodys[item]) } - }) + }); } else { tokenArr.push($.getdata('tokenMidu_read')); TimeArr.push($.getdata('senku_readTimebody_midu')); @@ -53,44 +53,45 @@ if ($.isNode()) { return; } if ($.isNode()){ - console.log(`============ 共${tokenArr.length}个米读账号 =============\n`) console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) + console.log(`============ 共${tokenArr.length}个米读账号 =============\n`) }; for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { tokenVal = tokenArr[i]; bodyVal = TimeArr[i]; drawVal = SignArr[i]; - //console.log(bodyVal) $.index = i + 1; console.log(`-------------------------\n\n开始【米读账号${$.index}】`) - $.log(`🔔 ${cookieName}`) - tkVal = drawVal.match(/tk=(\w+)/)[1] + tkVal = drawVal.match(/tk=(\w+)/)[1] + console.log(TimeArr) for (i=0;i<10;i++){ - await readTime(); -} - await prizeInfo(); + await readTime() + }; + await prizeInfo(); if (prizeinfo && prizeinfo.data && prizeinfo.data.total_num) { - await prizeTask() - await drawPrize() - } - await addDraw(); - await taskTime(); - await OthersAd(); - await dice_roll(); - await dice_double(); - await userInfo(); - bind ? '' : $.setdata('', 'bind'); - if (bind) { - await Bind() - } - await signDay(); - await signVideo() - } - } + await prizeTask(), + await drawPrize() + }; + await addDraw(); + await taskTime(); + await OthersAd(); + await dice_roll(); + await dice_double(); + await userInfo(); + bind ? '' : $.setdata('', 'bind'); + if (bind) { + await Bind(); + } + await signDay(); + await signVideo() + } + } })() - .catch((e) => $.log(`❌ ${cookieName} 签到失败: ${e}`)) + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + // 阅读时长 @@ -120,9 +121,9 @@ function readTime() { const readTotalMinute = readtime.data.readTotalMinute const total_coin = readtime.data.total_coin coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰` - console.log("总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner+`\n本次获得${coin}`) + console.log("总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner) if (readTotalMinute) { - console.log("总计阅读时长"+readTotalMinute / 2+"分钟") + console.log("总计阅读时长"+readTotalMinute / 2+"分钟,本次获得+"+`${coin}金币\n`) readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` //$.msg(cookieName, subTitle, detail) @@ -147,10 +148,11 @@ function readTime() { $.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}\n`) resolve() } - }) + }) },30000) }) } + function drawPrize() { return new Promise((resolve, reject) => { const url = { @@ -216,7 +218,7 @@ function Bind() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { $.setdata('', 'bind') - resolve() + resolve() }) }) } From a00bece2d069a09d392c06629f4e6e54ccb241d5 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 19:53:21 +0800 Subject: [PATCH 159/266] --- Task/midu_Read.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 1fcaa60a4d..7bfe0ce8fa 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -65,7 +65,7 @@ if ($.isNode()) { $.index = i + 1; console.log(`-------------------------\n\n开始【米读账号${$.index}】`) tkVal = drawVal.match(/tk=(\w+)/)[1] - console.log(TimeArr) + //console.log(TimeArr) for (i=0;i<10;i++){ await readTime() }; @@ -80,7 +80,6 @@ if ($.isNode()) { await dice_roll(); await dice_double(); await userInfo(); - bind ? '' : $.setdata('', 'bind'); if (bind) { await Bind(); } @@ -217,7 +216,6 @@ function Bind() { url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { - $.setdata('', 'bind') resolve() }) }) From ee22f3fffdf502aef631b33963ec5dad689e3b90 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 20:48:26 +0800 Subject: [PATCH 160/266] --- Task/midu_Read.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 7bfe0ce8fa..1b5c84b6d4 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -66,7 +66,7 @@ if ($.isNode()) { console.log(`-------------------------\n\n开始【米读账号${$.index}】`) tkVal = drawVal.match(/tk=(\w+)/)[1] //console.log(TimeArr) - for (i=0;i<10;i++){ + for (j=0;j<10;j++){ await readTime() }; await prizeInfo(); From 0ce892c8a0365dbfa23eaeb5ab49ba0775334575 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 22:08:05 +0800 Subject: [PATCH 161/266] --- Task/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/package.json b/Task/package.json index 60bc42f1ce..64ae633998 100644 --- a/Task/package.json +++ b/Task/package.json @@ -19,7 +19,7 @@ "homepage": "https://github.com/Sunert/Scripts#readme", "dependencies": { "crypto-js": "^4.0.0", - "got": "^11.5.1", + "got": "^11.7.0", "http-server": "^0.12.3", "tough-cookie": "^4.0.0" } From 3e784f123587ae3d8b8a1945050a53f6a7f66b11 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 18 Oct 2020 22:23:21 +0800 Subject: [PATCH 162/266] --- Task/youth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/youth.js b/Task/youth.js index 131bc63c44..b778db011b 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -177,7 +177,7 @@ else if ($.time('HH')>4&&$.time('HH')<8){ await rotaryCheck(); await earningsInfo(); await showmsg(); - if ($.isNode()&&rotaryres.code !== 10010) + if ($.isNode()&&rotaryres.code !== '10010') if( rotarytimes && rotarytimes%50 == 0 && cash >= 10){ await notify.sendNotify($.name + " " + nick, "您的余额约为"+cash+"元,已可以提现"+'\n'+`【收益总计】${signinfo.data.user.score}青豆 现金约${cash}元\n${detail}`) } From 7a2109cb316c29d989f3f1cd93b68ad91d35b3da Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 19 Oct 2020 01:10:16 +0800 Subject: [PATCH 163/266] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=B1=B3=E8=AF=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/midu_Read.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 1b5c84b6d4..d75d2cb359 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -65,7 +65,6 @@ if ($.isNode()) { $.index = i + 1; console.log(`-------------------------\n\n开始【米读账号${$.index}】`) tkVal = drawVal.match(/tk=(\w+)/)[1] - //console.log(TimeArr) for (j=0;j<10;j++){ await readTime() }; @@ -77,6 +76,7 @@ if ($.isNode()) { await addDraw(); await taskTime(); await OthersAd(); + await ReadDay(); await dice_roll(); await dice_double(); await userInfo(); @@ -221,6 +221,22 @@ function Bind() { }) } +function ReadDay() { + return new Promise((resolve, reject) => { + const url = { + url: 'https://apiwz.midukanshu.com/wz/task/readDays', + headers: {}, + body: drawVal + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + $.post(url, (error, response, data) => { + resolve() + }) + }) +} + // 额外奖励 function addDraw() { @@ -290,7 +306,7 @@ function prizeTask() { url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}\n`) @@ -320,7 +336,7 @@ function prizeInfo() { url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { // $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}\n`) @@ -349,7 +365,7 @@ function dice_roll() { } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}\n`) From c4841f686d91e6d995ca465ba4e23e8013ce1bbe Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 19 Oct 2020 01:24:28 +0800 Subject: [PATCH 164/266] --- Task/midu_Read.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index d75d2cb359..469eaef148 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -129,8 +129,7 @@ function readTime() { } else if ($.getdata('debug') == 'true') { readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` // $.msg(cookieName, subTitle, detail) - - + } } else if (readTime.code != 0) { detail += `【阅读时长】错误代码${readtime.code},错误信息${readtime.message}` @@ -192,7 +191,7 @@ function userInfo() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - // $.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) + //$.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) userInfo = JSON.parse(data) resolve() } catch (e) { @@ -293,8 +292,6 @@ function taskTime() { } - - // 观看视频获取抽奖机会 function prizeTask() { return new Promise((resolve, reject) => { @@ -327,11 +324,9 @@ function prizeTask() { // 抽奖信息 function prizeInfo() { return new Promise((resolve, reject) => { - const prizeInfourlVal = 'https://apiwz.midukanshu.com/wz/task/prizeList' const url = { - url: prizeInfourlVal, - headers: {}, - body: drawVal + url: 'https://apiwz.midukanshu.com/wz/task/prizeList?'+drawVal, + headers:{} } url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' From 5289a1a32009e5cb3aa3dfbab4e2ea7439395353 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 19 Oct 2020 21:51:33 +0800 Subject: [PATCH 165/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=A5=BF=E7=93=9C?= =?UTF-8?q?=E8=A7=86=E9=A2=91=E5=8E=BB=E5=B9=BF=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Script/xigua_ad.js | 14 ++++++++++++++ Task/txnews.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 Script/xigua_ad.js diff --git a/Script/xigua_ad.js b/Script/xigua_ad.js new file mode 100644 index 0000000000..8131ab9b79 --- /dev/null +++ b/Script/xigua_ad.js @@ -0,0 +1,14 @@ +/* + 西瓜视频去除内容页广告 +[rewrite_local] +https:\/\/api3-normal-c-hl\.ixigua\.com\/video\/app\/stream\/ url script-response-body xigua_ad.js +[mitm] +hostname = api*-normal-c-hl.ixigua.com +*/ + var obj = JSON.parse($response.body); + for (i=0; i< obj.data.length;i++){ + if(obj.data[i].content.indexOf("ad_label") > -1) { + delete obj.data[i].content + } + } +$done(JSON.stringify(obj)) diff --git a/Task/txnews.js b/Task/txnews.js index 8b82aef69e..67aef58ea4 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -366,7 +366,7 @@ function getTotal() { $.msg("获取收益信息失败‼️", "", error) } else { const Total_Earn = JSON.parse(data) - subTile = '【收益总计】'+Total_Earn.data.wealth[0].title +'金币 '+"钱包: " +Total_Earn.data.wealth[1].title+'元' + subTile = '【收益总计】'+ Total_Earn.data.wealth[0].title +'金币 '+"钱包: " + Total_Earn.data.wealth[1].title+'元' // $.log("钱包收益共计"+obj.data.wealth[1].title+"元") } resolve() From a747df81f0833eadacfc17b3ff4d0136d8797451 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 22 Oct 2020 12:11:28 +0800 Subject: [PATCH 166/266] =?UTF-8?q?=E6=89=93=E5=BC=80=E7=B1=B3=E8=AF=BB?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- Task/midu_Read.js | 3 ++- package.json | 30 ------------------------------ 3 files changed, 3 insertions(+), 32 deletions(-) delete mode 100644 package.json diff --git a/README.md b/README.md index 6978379365..f038fbca02 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## 免责声明: -* 本仓库发布的Script项目中涉及的任何解锁和解密分析脚本,仅用于测试和学习研究,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断. +* 本仓库发布的Script项目中涉及的任何解锁和解密分析脚本,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断. * Sunert对任何脚本问题概不负责,包括但不限于由任何脚本错误导致的任何损失或损害. diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 469eaef148..1f6563c81d 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -100,7 +100,7 @@ function readTime() { let request = { url: "https://apiwz.midukanshu.com/user/readTimeBase/readTime", headers: { - 'host': 'apiwz.midukanshu.com', + 'Host': 'apiwz.midukanshu.com', 'versionName': '1.24.0.0918.1649', "User-Agent": "MRSpeedNovel/0918.1649 CFNetwork/1128.0.1 Darwin/19.6.0", "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", @@ -109,6 +109,7 @@ function readTime() { }, body: bodyVal } + console.log("您的:"+tokenVal+'\n'+tkVal+'\n'+bodyVal) $.post(request, (error, response, data) => { try { $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}\n`) diff --git a/package.json b/package.json deleted file mode 100644 index e8a427d084..0000000000 --- a/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "Sunert", - "version": "1.0.0", - "description": "", - "main": "jingxi.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/Sunert/Scripts.git" - }, - "keywords": [], - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/Sunert/Scripts/issues" - }, - "homepage": "https://github.com/Sunert/Scripts#readme", - "dependencies": { - "crypto-js": "^4.0.0", - "got": "^11.5.1", - "http-server": "^0.12.3", - "node-schedule": "^1.3.2", - "tough-cookie": "^4.0.0", - "download": "^8.0.0", - "request": "^2.88.2", - "request-promise": "^4.2.5" - } -} From aa87a71705956396634e3724b0fb37582753916e Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 22 Oct 2020 15:46:17 +0800 Subject: [PATCH 167/266] --- package.json | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000000..64ae633998 --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "Sunert", + "version": "1.0.0", + "description": "", + "main": "jingxi.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Sunert/Scripts.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/Sunert/Scripts/issues" + }, + "homepage": "https://github.com/Sunert/Scripts#readme", + "dependencies": { + "crypto-js": "^4.0.0", + "got": "^11.7.0", + "http-server": "^0.12.3", + "tough-cookie": "^4.0.0" + } +} From 9476771cae407c4c4822cb5070292c9261754bd7 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 22 Oct 2020 21:29:59 +0800 Subject: [PATCH 168/266] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=B1=B3=E8=AF=BBMID?= =?UTF-8?q?U=5FTOKEN=E4=B8=BA=E5=AE=8C=E6=95=B4=E8=AF=B7=E6=B1=82=E5=A4=B4?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96=E6=96=B9=E6=B3=95=E8=AF=B7=E8=A7=81?= =?UTF-8?q?=E7=94=B5=E6=8A=A5=E7=BE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/midu_Read.js | 106 +++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 67 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 1f6563c81d..84630e994b 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -1,8 +1,9 @@ /* -MIDU_TOKEN 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链接请求头内的token; +MIDU_TOKEN 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链接完整请求头; MIDU_TIME 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链接请求体,格式为 "dataEncStr=XXX; -MIDU_SIGN 为 "https://apiwz.midukanshu.com/wz/task/" 请求体,格式为 "fullVersion=XXX" -以上全部值不许换行,多账号用#分隔 +MIDU_SIGN 为 "https://apiwz.midukanshu.com/wz/task/" 完整请求体,格式为 "fullVersion=XXX" +以上全部值不许换行,多账号用#分隔; +多账号退出一账号可能某些任务会提示失效,每运行一次,会自动阅读5分钟,即10次阅读 由于运行时间较长,则只在Actions运行 */ const cookieName = '米读阅读时长' @@ -57,17 +58,19 @@ if ($.isNode()) { console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) console.log(`============ 共${tokenArr.length}个米读账号 =============\n`) }; + for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { - tokenVal = tokenArr[i]; + headerVal = tokenArr[i]; bodyVal = TimeArr[i]; drawVal = SignArr[i]; $.index = i + 1; + //console.log(tokenArr) console.log(`-------------------------\n\n开始【米读账号${$.index}】`) tkVal = drawVal.match(/tk=(\w+)/)[1] - for (j=0;j<10;j++){ + for (j=0;j<10;j++){ await readTime() - }; + }; await prizeInfo(); if (prizeinfo && prizeinfo.data && prizeinfo.data.total_num) { await prizeTask(), @@ -76,7 +79,6 @@ if ($.isNode()) { await addDraw(); await taskTime(); await OthersAd(); - await ReadDay(); await dice_roll(); await dice_double(); await userInfo(); @@ -99,17 +101,9 @@ function readTime() { setTimeout(()=> { let request = { url: "https://apiwz.midukanshu.com/user/readTimeBase/readTime", - headers: { - 'Host': 'apiwz.midukanshu.com', - 'versionName': '1.24.0.0918.1649', - "User-Agent": "MRSpeedNovel/0918.1649 CFNetwork/1128.0.1 Darwin/19.6.0", - "Content-Type": "application/x-www-form-urlencoded; charset=utf-8", - 'token': tokenVal, - 'tk': tkVal - }, + headers: JSON.parse(headerVal), body: bodyVal } - console.log("您的:"+tokenVal+'\n'+tkVal+'\n'+bodyVal) $.post(request, (error, response, data) => { try { $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}\n`) @@ -130,7 +124,8 @@ function readTime() { } else if ($.getdata('debug') == 'true') { readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` // $.msg(cookieName, subTitle, detail) - + + } } else if (readTime.code != 0) { detail += `【阅读时长】错误代码${readtime.code},错误信息${readtime.message}` @@ -156,13 +151,8 @@ function drawPrize() { return new Promise((resolve, reject) => { const url = { url: 'https://apiwz.midukanshu.com/wz/task/drawPrize?' + drawVal, - headers: {}, + headers: JSON.parse(headerVal), } - url.headers['token'] = tokenVal - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' - url.headers['tk'] = tkVal $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) @@ -182,17 +172,13 @@ function drawPrize() { // 用户信息 function userInfo() { return new Promise((resolve, reject) => { - const userInfourlVal = 'https://apiwz.midukanshu.com/wz/user/getInfo?' + bodyVal const url = { - url: userInfourlVal, - headers: {} + url: 'https://apiwz.midukanshu.com/wz/user/getInfo?' + bodyVal, + headers: JSON.parse(headerVal), } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - //$.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) + $.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) userInfo = JSON.parse(data) resolve() } catch (e) { @@ -209,28 +195,10 @@ function Bind() { return new Promise((resolve, reject) => { const url = { url: 'http://fisson.1sapp.com/nlx/shareLink/tmpBind', - headers: {}, + headers: JSON.parse(headerVal), body: 'app_id=7&act_type=1&act_name=grad_pupil&invite_code=A1051999596&telephone=' + userInfo.data.mobile } url.headers['Host'] = 'fisson.1sapp.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - $.post(url, (error, response, data) => { - resolve() - }) - }) -} - -function ReadDay() { - return new Promise((resolve, reject) => { - const url = { - url: 'https://apiwz.midukanshu.com/wz/task/readDays', - headers: {}, - body: drawVal - } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { resolve() }) @@ -248,7 +216,7 @@ function addDraw() { } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) @@ -275,7 +243,7 @@ function taskTime() { } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 13_7 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} taskTime - response: ${JSON.stringify(response)}\n`) @@ -293,6 +261,8 @@ function taskTime() { } + + // 观看视频获取抽奖机会 function prizeTask() { return new Promise((resolve, reject) => { @@ -301,10 +271,10 @@ function prizeTask() { url: prizeTaskurlVal, headers: {}, } - url.headers['token'] = tokenVal + //url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}\n`) @@ -325,17 +295,19 @@ function prizeTask() { // 抽奖信息 function prizeInfo() { return new Promise((resolve, reject) => { + const prizeInfourlVal = 'https://apiwz.midukanshu.com/wz/task/prizeList' const url = { - url: 'https://apiwz.midukanshu.com/wz/task/prizeList?'+drawVal, - headers:{} + url: prizeInfourlVal, + headers: {}, + body: drawVal } - url.headers['token'] = tokenVal + //url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - // $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}\n`) + $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}\n`) if (data) { prizeinfo = JSON.parse(data) } @@ -361,7 +333,7 @@ function dice_roll() { } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}\n`) @@ -390,8 +362,8 @@ function dice_double() { } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - url.headers['token'] = tokenVal + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + //url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}\n`) @@ -416,10 +388,10 @@ function signDay() { url: "https://apiwz.midukanshu.com/wz/task/signInV2?"+ drawVal, headers: {}, } - url.headers['token'] = tokenVal + //url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}\n`) @@ -446,8 +418,8 @@ function signVideo() { } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - url.headers['token'] = tokenVal + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + //url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}\n`) @@ -474,8 +446,8 @@ function OthersAd() { } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 12_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' - url.headers['token'] = tokenVal + url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' + //url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { $.log(`🐍🐢 ${cookieName} OthersAd - response: ${JSON.stringify(response)}\n`) From 189fc6871a73c1e52d9b8001f1c5f0c905eb3298 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 24 Oct 2020 21:01:39 +0800 Subject: [PATCH 169/266] updata --- .github/workflows/midu_read.yml | 2 +- Task/Youth_Read.js | 15 ++- Task/dianshijia.js | 8 +- Task/midu_Read.js | 209 +++++++++++++++++++------------- Task/txnews.js | 4 +- Task/youth.js | 5 +- 6 files changed, 139 insertions(+), 104 deletions(-) diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 6ba0fd7c52..4889afdd9d 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -6,7 +6,7 @@ name: midu_read on: workflow_dispatch: schedule: - - cron: '*/7 1-18 * * *' + - cron: '*/15 1-14 * * *' jobs: build: diff --git a/Task/Youth_Read.js b/Task/Youth_Read.js index 54157ef15b..1fb9c3c951 100644 --- a/Task/Youth_Read.js +++ b/Task/Youth_Read.js @@ -8,7 +8,7 @@ Github Actions使用方法见[@lxk0301](https://raw.githubusercontent.com/lxk030 */ -let s = 30000 //等待延迟30s +//let s = 30000 //等待延迟30s const $ = new Env("中青看点") //const notify = $.isNode() ? require('./sendNotify') : ''; let ReadArr = [], YouthBody = "",readscore = 0; @@ -40,7 +40,7 @@ let ReadArr = [], YouthBody = "",readscore = 0; $.index = i + 1; console.log(`-------------------------\n\n开始中青看点第${$.index}次阅读`) } - await AutoRead(); + await AutoRead(); } console.log(`-------------------------\n\n中青看点共完成${$.index}次阅读,共计获得${readscore}个青豆,阅读请求全部结束`) })() @@ -50,7 +50,6 @@ let ReadArr = [], YouthBody = "",readscore = 0; function AutoRead() { return new Promise((resolve, reject) => { - setTimeout(()=> { let url = { url: `https://ios.baertt.com/v5/article/complete.json`, headers: { @@ -58,12 +57,13 @@ function AutoRead() { }, body: articlebody }; - $.post(url, (error, response, data) => { + $.post(url, async(error, response, data) => { let readres = JSON.parse(data); - console.log(data) + //console.log(data) if (readres.error_code == '0' && typeof readres.items.read_score === 'number') { - console.log(`\n本次阅读获得${readres.items.read_score}个青豆,即将开始下次阅读\n`) - readscore += readres.items.read_score + console.log(`\n本次阅读获得${readres.items.read_score}个青豆,请等待30s后执行下一次阅读\n`); + readscore += readres.items.read_score; + await $.wait(30000); } else if (readres.error_code == '0' && typeof readres.items.score === 'number') { console.log(`\n本次阅读获得${readres.items.score}个青豆,即将开始下次阅读\n`) @@ -77,7 +77,6 @@ function AutoRead() { } resolve() }) - },s) }) } diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 3ebf16ea2a..de6428dbdb 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -44,7 +44,7 @@ const gametimes = "1999"; //游戏时长 const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; - let sleeping = ""; +let sleeping = "",detail=``,subTitle=``; const dianshijia_API = 'http://api.gaoqingdianshi.com/api' let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal; if ($.isNode()) { @@ -206,7 +206,7 @@ function signinfo() { $.get({ url: `${dianshijia_API}/v4/sign/get`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`${$.name}, 签到信息: ${data}\n`) - const result = JSON.parse(data) + let result = JSON.parse(data) if (result.errCode == 0) { var d = `${result.data.currentDay}` @@ -226,7 +226,7 @@ function total() { return new Promise((resolve, reject) => { $.get({url: `${dianshijia_API}/coin/info`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`${$.name}, 总计: ${data}\n`) - const result = JSON.parse(data) + let result = JSON.parse(data) subTitle = `待兑换金币: ${result.data.coin} ` try{ if(result.data.tempCoin){ @@ -247,7 +247,7 @@ function cash() { $.get({ url: `${dianshijia_API}/cash/info`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`现金: ${data}\n`) - const cashresult = JSON.parse(data) + let cashresult = JSON.parse(data) subTitle += '现金:'+ cashresult.data.amount/100+'元 额度:'+cashresult.data.withdrawalQuota/100+'元' cashtotal = cashresult.data.totalWithdrawn/100 resolve() diff --git a/Task/midu_Read.js b/Task/midu_Read.js index 84630e994b..feb24d3776 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -3,7 +3,7 @@ MIDU_TOKEN 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链 MIDU_TIME 为 "https://apiwz.midukanshu.com/user/readTimeBase/readTime"此链接请求体,格式为 "dataEncStr=XXX; MIDU_SIGN 为 "https://apiwz.midukanshu.com/wz/task/" 完整请求体,格式为 "fullVersion=XXX" 以上全部值不许换行,多账号用#分隔; -多账号退出一账号可能某些任务会提示失效,每运行一次,会自动阅读5分钟,即10次阅读 +多账号退出一账号可能某些任务会提示失效 由于运行时间较长,则只在Actions运行 */ const cookieName = '米读阅读时长' @@ -55,7 +55,7 @@ if ($.isNode()) { } if ($.isNode()){ console.log(`============ 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =============\n`) - console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=============\n`) + console.log(`============ 脚本执行-北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =============\n`) console.log(`============ 共${tokenArr.length}个米读账号 =============\n`) }; @@ -68,6 +68,7 @@ if ($.isNode()) { //console.log(tokenArr) console.log(`-------------------------\n\n开始【米读账号${$.index}】`) tkVal = drawVal.match(/tk=(\w+)/)[1] + await userInfo(); for (j=0;j<10;j++){ await readTime() }; @@ -79,9 +80,9 @@ if ($.isNode()) { await addDraw(); await taskTime(); await OthersAd(); + await dice_addnum(); await dice_roll(); await dice_double(); - await userInfo(); if (bind) { await Bind(); } @@ -98,15 +99,14 @@ if ($.isNode()) { // 阅读时长 function readTime() { return new Promise((resolve, reject) => { - setTimeout(()=> { let request = { url: "https://apiwz.midukanshu.com/user/readTimeBase/readTime", headers: JSON.parse(headerVal), body: bodyVal } - $.post(request, (error, response, data) => { + $.post(request, async(error, response, data) => { try { - $.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(response)}\n`) + //$.log(`❕ ${cookieName} readTime - response: ${JSON.stringify(data)}\n`) readtime = JSON.parse(data) let subTitle = '' let detail = '' @@ -115,35 +115,24 @@ function readTime() { const readTotalMinute = readtime.data.readTotalMinute const total_coin = readtime.data.total_coin coin == 0 ? detail += `` : detail += `【阅读时长】获得${coin}💰` - console.log("总计金币:"+total_coin+" 现金收益"+readtime.data.popup.corner) - if (readTotalMinute) { - console.log("总计阅读时长"+readTotalMinute / 2+"分钟,本次获得+"+`${coin}金币\n`) + console.log("总计阅读时长"+readTotalMinute / 2+"分钟,本次获得+"+`${coin}金币,请等待30s后执行下一次阅读\n`) readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` + await $.wait(30000); //$.msg(cookieName, subTitle, detail) - } else if ($.getdata('debug') == 'true') { - readTotalMinute ? detail += ` 阅读时长${readTotalMinute / 2}分钟,该账户:${total_coin}💰` : detail += `该账户:${total_coin}💰` - // $.msg(cookieName, subTitle, detail) - - } } else if (readTime.code != 0) { detail += `【阅读时长】错误代码${readtime.code},错误信息${readtime.message}` $.msg(cookieName, subTitle, detail) - } else { - detail += '【阅读时长】失败' - $.msg(cookieName, subTitle, detail) - } + } - resolve() } catch (e) { $.msg(cookieName, `阅读时长: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} readTime - 签到失败: ${e}`) - $.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(response)}\n`) - resolve() + $.log(`❌ ${cookieName} readTime - response: ${JSON.stringify(data)}\n`) } + resolve() }) - },30000) }) } @@ -155,17 +144,19 @@ function drawPrize() { } $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) - if (data) { - drawprize = JSON.parse(data) - } - resolve() + $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(data)}\n`) + drawprize = JSON.parse(data) + if(drawprize.code==0){ + console.log("转盘抽奖任务:"+drawprize.data.title) + } + } catch (e) { // $.msg(cookieName, `抽奖: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} drawPrize - 抽奖失败: ${e}`) - $.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) - resolve() + $.log(`❌ ${cookieName} drawPrize - response: ${JSON.stringify(data)}\n`) + } + resolve() }) }) } @@ -173,18 +164,27 @@ function drawPrize() { function userInfo() { return new Promise((resolve, reject) => { const url = { - url: 'https://apiwz.midukanshu.com/wz/user/getInfo?' + bodyVal, + url: 'https://apiwz.midukanshu.com/wz/user/getInfo', headers: JSON.parse(headerVal), + body: bodyVal } $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(response)}`) - userInfo = JSON.parse(data) + //$.log(`🐍🐢 ${cookieName} userInfo - response: ${JSON.stringify(data)}`) + userinfo = JSON.parse(data) + if (userinfo.code==0){ + nick = userinfo.data.nickname + total_coin = userinfo.data.goldCoin + corner = userinfo.data.goldCoinMoney + invite_code = userinfo.data.invite_code + today_coin = userinfo.data.todayGoldCoin + console.log("总计金币:"+total_coin+" 现金收益"+corner+'\n您今日所得总金币为'+ today_coin+' 您的邀请码为'+ invite_code+'\n') + } resolve() } catch (e) { $.msg(cookieName, `获取用户信息: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} userInfo - 获取用户信息失败: ${e}`) - $.log(`❌ ${cookieName} userInfo - response: ${JSON.stringify(response)}`) + $.log(`❌ ${cookieName} userInfo - data: ${JSON.stringify(data)}`) resolve() } }) @@ -196,7 +196,7 @@ function Bind() { const url = { url: 'http://fisson.1sapp.com/nlx/shareLink/tmpBind', headers: JSON.parse(headerVal), - body: 'app_id=7&act_type=1&act_name=grad_pupil&invite_code=A1051999596&telephone=' + userInfo.data.mobile + body: 'app_id=7&act_type=1&act_name=grad_pupil&invite_code=A1051999596&telephone=' + userinfo.data.mobile } url.headers['Host'] = 'fisson.1sapp.com' $.post(url, (error, response, data) => { @@ -219,15 +219,16 @@ function addDraw() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} drawPrize - response: ${JSON.stringify(response)}\n`) - if (data) { + // $.log(`🐍🐢 ${cookieName} addDraw - response: ${JSON.stringify(data)}\n`) add_Draw = JSON.parse(data) - } + if(add_Draw.code==0){ + console.log("额外奖励:"+add_Draw.data.msg) + } resolve() } catch (e) { // $.msg(cookieName, `额外奖励: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} addDraw - 额外奖励失败: ${e}`) - $.log(`❌ ${cookieName} addDraw - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} addDraw - response: ${JSON.stringify(data)}\n`) resolve() } }) @@ -246,14 +247,15 @@ function taskTime() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} taskTime - response: ${JSON.stringify(response)}\n`) - if (data) { - drawprize = JSON.parse(data) - } + // $.log(`🐍🐢 ${cookieName} taskTime - response: ${JSON.stringify(data)}\n`) + _taskTime = JSON.parse(data) + if(_taskTime.code==0){ + console.log("定时任务:"+"+"+_taskTime.data.amount) + } resolve() } catch (e) { - $.log(`❌ ${cookieName} taskTime - 抽奖失败: ${e}`) - $.log(`❌ ${cookieName} taskTime - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} taskTime - 定时任务失败: ${e}`) + $.log(`❌ ${cookieName} taskTime - response: ${JSON.stringify(data)}\n`) resolve() } }) @@ -261,8 +263,6 @@ function taskTime() { } - - // 观看视频获取抽奖机会 function prizeTask() { return new Promise((resolve, reject) => { @@ -277,15 +277,16 @@ function prizeTask() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(response)}\n`) - if (data) { - prizetask = JSON.parse(data) - } + // $.log(`🐍🐢 ${cookieName} prizeTask - response: ${JSON.stringify(data)}\n`) + prizetask = JSON.parse(data) + if(prizetask.code==0){ + console.log("抽奖次数: "+prizetask.data.title) + } resolve() } catch (e) { // $.msg(cookieName, `观看视频抽奖: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} prizeTask - 观看视频抽奖失败: ${e}`) - $.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} prizeTask - response: ${JSON.stringify(data)}\n`) resolve() } }) @@ -295,27 +296,26 @@ function prizeTask() { // 抽奖信息 function prizeInfo() { return new Promise((resolve, reject) => { - const prizeInfourlVal = 'https://apiwz.midukanshu.com/wz/task/prizeList' const url = { - url: prizeInfourlVal, + url: 'https://apiwz.midukanshu.com/wz/task/prizeList', headers: {}, body: drawVal } - //url.headers['token'] = tokenVal url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(response)}\n`) + //$.log(`🐍🐢 ${cookieName} prizeInfo - response: ${JSON.stringify(data)}\n`) if (data) { prizeinfo = JSON.parse(data) + console.log("今日抽奖信息:"+prizeinfo.data.btnText) } resolve() } catch (e) { // $.msg(cookieName, `抽奖信息: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} prizeInfo - 抽奖信息失败: ${e}`) - $.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} prizeInfo - response: ${JSON.stringify(data)}\n`) resolve() } }) @@ -325,9 +325,8 @@ function prizeInfo() { // 掷骰子 function dice_roll() { return new Promise((resolve, reject) => { - const dice_roll_urlVal = 'https://apiwz.midukanshu.com/wz/dice/roll' const url = { - url: dice_roll_urlVal, + url: 'https://apiwz.midukanshu.com/wz/dice/roll', headers: {}, body: drawVal } @@ -336,15 +335,18 @@ function dice_roll() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(response)}\n`) - if (JSON.parse(data).code == 0) { - rollList=JSON.parse(data) + // $.log(`🐍🐢 ${cookieName} dice_roll - response: ${JSON.stringify(data)}\n`) + rollList=JSON.parse(data) + if (rollList.code == 0) { + console.log("掷骰子获得"+rollList.data.roll_coin+"金币") + } else if (rollList.code == '-10203'){ + console.log("掷骰子任务:"+rollList.message) } resolve() } catch (e) { $.msg(cookieName, `掷骰子: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} dice_roll - 掷骰子失败: ${e}`) - $.log(`❌ ${cookieName} dice_roll - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} dice_roll - response: ${JSON.stringify(data)}\n`) resolve() } }) @@ -354,9 +356,8 @@ function dice_roll() { // 骰子双倍奖励 function dice_double() { return new Promise((resolve, reject) => { - const dice_double_urlVal = 'https://apiwz.midukanshu.com/wz/dice/doubleReward' const url = { - url: dice_double_urlVal, + url: 'https://apiwz.midukanshu.com/wz/dice/doubleReward', headers: {}, body: drawVal } @@ -366,20 +367,52 @@ function dice_double() { //url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(response)}\n`) - if (JSON.parse(data).code == 0) { - doubleList=JSON.parse(data) + $.log(`🐍🐢 ${cookieName} dice_double - response: ${JSON.stringify(data)}\n`) + doubleList=JSON.parse(data) + if (doubleList.code == 0) { + console.log("骰子双倍奖励:"+doubleList.message) + } else if (doubleList.code == '-10205'){ + console.log("骰子双倍奖励:"+doubleList.message) } resolve() } catch (e) { $.msg(cookieName, `骰子双倍奖励: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} dice_double - 骰子双倍奖励失败: ${e}`) - $.log(`❌ ${cookieName} dice_double - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} dice_double - response: ${JSON.stringify(data)}\n`) + resolve() + } + }) + }) +} +//获取骰子次数: +function dice_addnum() { + return new Promise((resolve, reject) => { + const dice_addnum_urlVal = 'https://apiwz.midukanshu.com/wz/dice/addChangeNumByRewardVideo?' + drawVal + const url = { + url: dice_addnum_urlVal, + headers: {} + } + url.headers['Host'] = 'apiwz.midukanshu.com' + url.headers['Content-Type'] = 'application/x-www-form-urlencoded' + url.headers['User-Agent'] = 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 miduapp qapp' + $.post(url, (error, response, data) => { + try { + // $.log(`🐍🐢 ${cookieName} dice_addnum - response: ${JSON.stringify(data)}`) + diceaddnum=JSON.parse(data) + if(diceaddnum.code=='-10208'){ + console.log("获取骰子次数:"+diceaddnum.message) + } + resolve() + } catch (e) { + $.msg(cookieName, `获取骰子次数: 失败`, `说明: ${e}`) + $.log(`❌ ${cookieName} dice_addnum - 获取骰子次数失败: ${e}`) + $.log(`❌ ${cookieName} dice_addnum - response: ${JSON.stringify(data)}`) resolve() } }) }) } + // 每日签到 function signDay() { @@ -394,13 +427,16 @@ function signDay() { url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(response)}\n`) + //$.log(`🐍🐢 ${cookieName} signDay - response: ${JSON.stringify(data)}\n`) _signDay = JSON.parse(data) + if(_signDay.code==0){ + console.log("每日签到:"+_signDay.data.amount+"金币") + } resolve() } catch (e) { $.msg(cookieName, `签到结果: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} signDay - 签到失败: ${e}`) - $.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} signDay - response: ${JSON.stringify(data)}\n`) resolve() } }) @@ -409,26 +445,26 @@ function signDay() { // 签到视频奖励 function signVideo() { - return new Promise((resolve, reject) => { - const signVideourlVal = 'https://apiwz.midukanshu.com/wz/task/signVideoReward' + return new Promise((resolve, reject) => { const url = { - url: signVideourlVal, + url: 'https://apiwz.midukanshu.com/wz/task/signVideoReward', headers: {}, body: drawVal } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' - //url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(response)}\n`) + // $.log(`🐍🐢 ${cookieName} signVideo - response: ${JSON.stringify(data)}\n`) _signVideo = JSON.parse(data) + if (_signVideo.code == 0) { + console.log("签到视频奖励得"+_signVideo.data.amount+"金币") + } else { + console.log(_signVideo.message) + } resolve() } catch (e) { $.msg(cookieName, `签到视频: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} signVideo - 签到视频失败: ${e}`) - $.log(`❌ ${cookieName} signVideo - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} signVideo - response: ${JSON.stringify(data)}\n`) resolve() } }) @@ -438,25 +474,24 @@ function signVideo() { function OthersAd() { return new Promise((resolve, reject) => { - const otherVal = 'https://apiwz.midukanshu.com/activity/dividend/videoAdReward' + const otherVal = 'https://apiwz.midukanshu.com/activity/dividend/videoAdReward' const url = { url: otherVal, headers: {}, body: drawVal } - url.headers['Host'] = 'apiwz.midukanshu.com' - url.headers['Content-Type'] = 'application/x-www-form-urlencoded' - url.headers['User-Agent'] = 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 qapp miduapp' - //url.headers['token'] = tokenVal $.post(url, (error, response, data) => { try { - $.log(`🐍🐢 ${cookieName} OthersAd - response: ${JSON.stringify(response)}\n`) - _signVideo = JSON.parse(data) + // $.log(`🐍🐢 ${cookieName} OthersAd - response: ${JSON.stringify(data)}\n`) + _OthersAd = JSON.parse(data) + if(_OthersAd.code==0){ + console.log("额外奖励: "+_OthersAd.data.msg) + } resolve() } catch (e) { $.msg(cookieName, `额外奖励: 失败`, `说明: ${e}`) $.log(`❌ ${cookieName} OthersAd - 额外奖励失败: ${e}`) - $.log(`❌ ${cookieName} OthersAd - response: ${JSON.stringify(response)}\n`) + $.log(`❌ ${cookieName} OthersAd - response: ${JSON.stringify(data)}\n`) resolve() } }) diff --git a/Task/txnews.js b/Task/txnews.js index 67aef58ea4..2bcfcb9232 100644 --- a/Task/txnews.js +++ b/Task/txnews.js @@ -52,8 +52,8 @@ let notifyInterval =$.getdata('notifynum')||50; //阅读篇数间隔通知开为 const TX_HOST = 'https://api.inews.qq.com/activity/v1/' let SignArr = [],SignUrl = ""; cookiesArr = [],CookieTxnews = ""; - VideoArr = [],SignUrl = "",order = ""; - + VideoArr = [],SignUrl = "",order = "", + detail = ``, subTitle = ``; if ($.isNode()) { if (process.env.TXNEWS_COOKIE && process.env.TXNEWS_COOKIE.indexOf('&') > -1) { diff --git a/Task/youth.js b/Task/youth.js index b778db011b..b6d5983c79 100644 --- a/Task/youth.js +++ b/Task/youth.js @@ -70,8 +70,9 @@ let logs = $.getdata('zqlogs')||false, signresult; let cookiesArr = [], signheaderVal = '', readArr = [], articlebodyVal ='', timeArr = [], timebodyVal = '', - redpArr = [], redpbodyVal = ''; -let CookieYouth = [] ,ARTBODYs = [], + redpArr = [], redpbodyVal = '', + detail = ``, subTitle = ``; +let CookieYouth = [], ARTBODYs = [], REDBODYs = [], READTIME = []; if ($.isNode()) { if (process.env.YOUTH_HEADER && process.env.YOUTH_HEADER.indexOf('#') > -1) { From ad227b55b1f3ccb6f92a35d39185bd8c061d4039 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 27 Oct 2020 20:01:15 +0800 Subject: [PATCH 170/266] --- Task/jdCookie.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Task/jdCookie.js b/Task/jdCookie.js index 3063efcefa..929040fec3 100644 --- a/Task/jdCookie.js +++ b/Task/jdCookie.js @@ -18,9 +18,10 @@ if (process.env.JD_COOKIE) { } else { CookieJDs = process.env.JD_COOKIE.split(); } - console.log(`\n==================脚本执行来自 github action=====================\n`) - console.log(`==================脚本执行-国际标准时间(UTC):${new Date().toLocaleString()}=====================\n`) - console.log(`==================脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()}=====================\n`) + console.log(`\n==================== 共有${CookieJDs.length}个京东账号Cookie =========`); + console.log(`\n================== 脚本执行来自 github action =====================\n`) + console.log(`================== 脚本执行-国际标准时间(UTC):${new Date().toLocaleString()} =====================\n`) + console.log(`================== 脚本执行- 北京时间(UTC+8):${new Date(new Date().getTime() + 8 * 60 * 60 * 1000).toLocaleString()} =====================\n`) } for (let i = 0; i < CookieJDs.length; i++) { const index = (i + 1 === 1) ? '' : (i + 1); From 4646570a9b0678effa094c90f0ac93da04741326 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 28 Oct 2020 00:16:57 +0800 Subject: [PATCH 171/266] --- Task/sunert.boxjs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/sunert.boxjs.json b/Task/sunert.boxjs.json index 3054d95b53..f47570e871 100644 --- a/Task/sunert.boxjs.json +++ b/Task/sunert.boxjs.json @@ -105,7 +105,7 @@ "desc": "请填写小写英文台标,示例: 北京: btv1 | 湖南: hunan | 浙江: zhejiang 河南: henan| 江苏: jiangsu|广东: guangdong 更多电视台请参加电视家网络列表" }], "author": "@sunert", "repo": "https://gitee.com/Sunert/Scripts/blob/master/Task/tvpreview.js", - "icons": ["https://raw.githubusercontent.com/Sunert/Quantumult-X/master/Rules/Images/ICON/tvpreview.png", "https://raw.githubusercontent.com/Sunert/Quantumult-X/master/Rules/Images/ICON/tvpreview.png"], + "icons": ["https://gitee.com/Sunert/ProxyConfig/raw/master/QuantumultX/Rules/Images/ICON/tvpreview.png", "https://gitee.com/Sunert/ProxyConfig/raw/master/QuantumultX/Rules/Images/ICON/tvpreview.png"], "script": "https://gitee.com/Sunert/Scripts/raw/master/Task/tvpreview.js" }, { From fe86ee317f0bcbefe8b8098dc67f7de2464735de Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 28 Oct 2020 00:26:28 +0800 Subject: [PATCH 172/266] --- Task/sunert.boxjs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/sunert.boxjs.json b/Task/sunert.boxjs.json index f47570e871..c0893ed4bb 100644 --- a/Task/sunert.boxjs.json +++ b/Task/sunert.boxjs.json @@ -105,7 +105,7 @@ "desc": "请填写小写英文台标,示例: 北京: btv1 | 湖南: hunan | 浙江: zhejiang 河南: henan| 江苏: jiangsu|广东: guangdong 更多电视台请参加电视家网络列表" }], "author": "@sunert", "repo": "https://gitee.com/Sunert/Scripts/blob/master/Task/tvpreview.js", - "icons": ["https://gitee.com/Sunert/ProxyConfig/raw/master/QuantumultX/Rules/Images/ICON/tvpreview.png", "https://gitee.com/Sunert/ProxyConfig/raw/master/QuantumultX/Rules/Images/ICON/tvpreview.png"], + "icons": ["https://gitee.com/Sunert/ProxyConfig/raw/master/QuantumultX/Rules/Images/ICON/tvpreview_mini.png", "https://gitee.com/Sunert/ProxyConfig/raw/master/QuantumultX/Rules/Images/ICON/tvpreview.png"], "script": "https://gitee.com/Sunert/Scripts/raw/master/Task/tvpreview.js" }, { From b1688fc5e91c55d8141307a261836fa955460ff5 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 30 Oct 2020 21:27:39 +0800 Subject: [PATCH 173/266] --- Task/Env.js | 18 +++++++++++------- Task/Env.min.js | 2 +- Task/dianshijia.js | 18 ++++++++++++++++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/Task/Env.js b/Task/Env.js index ee7e7d8197..b23d708ca3 100644 --- a/Task/Env.js +++ b/Task/Env.js @@ -292,7 +292,9 @@ function Env(name, opts) { try { if (resp.headers['set-cookie']) { const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString() - this.ckjar.setCookieSync(ck, null) + if (ck) { + this.ckjar.setCookieSync(ck, null) + } nextOpts.cookieJar = this.ckjar } } catch (e) { @@ -433,12 +435,14 @@ function Env(name, opts) { $notify(title, subt, desc, toEnvOpts(opts)) } } - let logs = ['', '==============📣系统通知📣=============='] - logs.push(title) - subt ? logs.push(subt) : '' - desc ? logs.push(desc) : '' - console.log(logs.join('\n')) - this.logs = this.logs.concat(logs) + if (!this.isMuteLog) { + let logs = ['', '==============📣系统通知📣=============='] + logs.push(title) + subt ? logs.push(subt) : '' + desc ? logs.push(desc) : '' + console.log(logs.join('\n')) + this.logs = this.logs.concat(logs) + } } log(...logs) { diff --git a/Task/Env.min.js b/Task/Env.min.js index 5ddd120b1f..21673d2cd5 100644 --- a/Task/Env.min.js +++ b/Task/Env.min.js @@ -1 +1 @@ -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/dianshijia.js b/Task/dianshijia.js index de6428dbdb..15777e0258 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -103,6 +103,7 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`开始【电视家${$.index}】`) await signin(); // 签到 await signinfo(); // 签到信息 + await Addsign(); // 额外奖励,默认额度 if (drawalVal != undefined){ await Withdrawal() } else { @@ -121,7 +122,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } } })() - .catch((e) => $.logErr(e)) + .catch((error) => $.logErr(error)) .finally(() => $.done()) function GetCookie() { @@ -483,4 +484,17 @@ function getGametime() { resolve() }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} +function Addsign() { + return new Promise((resolve, reject) => { + let url = { + url: `${dianshijia_API}/sign/chooseAdditionalReward?rewardId=55`, + headers: JSON.parse(signheaderVal), + } + $.get(url, (error, response, data) => { + if(logs)$.log(`额外签到: ${data}\n`) + }) +resolve() + }) +} + +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From 0fff5f36bdf5ff017857d7f4b27ac5a7a4b7f36a Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 15:02:26 +0800 Subject: [PATCH 174/266] --- Task/weibo.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index c7853188de..c264a5c238 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -104,12 +104,12 @@ if ($.isNode()) { payheaderVal = payArr[i]; $.index = i + 1; console.log(`\n开始【微博签到${$.index}】`) - await getsign(); - await doCard(); - if (payheaderVal !== undefined){ - await paysign() + await getsign(); + await doCard(); + if (payheaderVal !== undefined){ + await paysign() } else { - paybag = `【钱包签到】❌ 未获取Cooiekie` + paybag = `【钱包签到】❌ 未获取Cooiekie` }; $.msg($.name, nickname, wbsign+paybag+docard) if ($.isNode()) { @@ -193,6 +193,7 @@ function paysign() { }, (error, response, data) => { try{ let result = JSON.parse(data) + console.log(data) if (result.status == 1){ paybag = `【微博钱包】 ✅ +`+ result.score+' 分\n' } From eb5507dba32178b6f2df608c1da7fb3c92009dd6 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 15:43:06 +0800 Subject: [PATCH 175/266] --- Task/weibo.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index c264a5c238..40bbcedb77 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -194,10 +194,11 @@ function paysign() { try{ let result = JSON.parse(data) console.log(data) - if (result.status == 1){ + + if (result.code == 0 && result.status == 1){ paybag = `【微博钱包】 ✅ +`+ result.score+' 分\n' } - else if (result.code == 100000){ + else if (result.code == '100000'){ paybag = `【微博钱包】 🔁\n` } } From c6b0862d45ba11e594e7ae88b278e9e64d26c553 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 15:43:48 +0800 Subject: [PATCH 176/266] --- Task/weibo.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/weibo.js b/Task/weibo.js index 40bbcedb77..00671942ab 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -201,11 +201,12 @@ function paysign() { else if (result.code == '100000'){ paybag = `【微博钱包】 🔁\n` } + resolve() } catch(error){ paybag = `【钱包签到】❌ Cookie失效`+'\n' + resolve() } - resolve() }) }) } From 47a39392454c1b4317d89723aeac081bf2a78103 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 15:52:55 +0800 Subject: [PATCH 177/266] --- Task/weibo.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index 00671942ab..2d9d984dd0 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -111,10 +111,7 @@ if ($.isNode()) { } else { paybag = `【钱包签到】❌ 未获取Cooiekie` }; - $.msg($.name, nickname, wbsign+paybag+docard) - if ($.isNode()) { - await notify.sendNotify($.name, nickname+'\n'+ wbsign+paybag+docard) - } + await showmsg() } } })() @@ -210,5 +207,15 @@ function paysign() { }) }) } +async function showmsg() { + if (paybag) { + $.msg($.name, nickname, wbsign+paybag+docard); + if ($.isNode()) { + await notify.sendNotify($.name, nickname+'\n'+ wbsign+paybag+docard) + } + } +} + + function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From b14b0a361e799b0368c04e7464b9c967f2c6978e Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 15:56:20 +0800 Subject: [PATCH 178/266] --- Task/weibo.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/weibo.js b/Task/weibo.js index 2d9d984dd0..e2df028743 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -50,7 +50,7 @@ hostname = api.weibo.cn, pay.sc.weibo.com const $ = new Env('新浪微博') const notify = $.isNode() ? require('./sendNotify') : ''; -let tokenArr = [],payArr = []; +let tokenArr = [],payArr = [],paybag; if (isGetCookie = typeof $request !==`undefined`) { GetCookie(); From 5ab112405353edf680402cf17d9d345047dbd923 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 16:00:08 +0800 Subject: [PATCH 179/266] --- Task/weibo.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Task/weibo.js b/Task/weibo.js index e2df028743..a90268366c 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -188,20 +188,17 @@ function paysign() { return new Promise((resolve, reject) =>{ $.post({url: `https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do?_=${$.startTime+10}`,headers: JSON.parse(payheaderVal) }, (error, response, data) => { - try{ let result = JSON.parse(data) console.log(data) - - if (result.code == 0 && result.status == 1){ + if (result.status == 1){ paybag = `【微博钱包】 ✅ +`+ result.score+' 分\n' } - else if (result.code == '100000'){ + else if (result.status == '2'){ paybag = `【微博钱包】 🔁\n` } - resolve() - } - catch(error){ - paybag = `【钱包签到】❌ Cookie失效`+'\n' + else { + paybag = `【钱包签到】❌ Cookie失效`+'\n' + } resolve() } }) From 26280e18356dacba915b30636c6e227bfc1ae4f2 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 16:01:52 +0800 Subject: [PATCH 180/266] --- Task/weibo.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Task/weibo.js b/Task/weibo.js index a90268366c..d9ff5be0fb 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -200,7 +200,6 @@ function paysign() { paybag = `【钱包签到】❌ Cookie失效`+'\n' } resolve() - } }) }) } From 3a777b2fa70ea362e171ed5a295b7ea2b97f9057 Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 2 Nov 2020 16:14:44 +0800 Subject: [PATCH 181/266] =?UTF-8?q?fix=20=E5=BE=AE=E5=8D=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/weibo.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Task/weibo.js b/Task/weibo.js index d9ff5be0fb..6004d19ef8 100644 --- a/Task/weibo.js +++ b/Task/weibo.js @@ -189,7 +189,6 @@ function paysign() { $.post({url: `https://pay.sc.weibo.com/aj/mobile/home/welfare/signin/do?_=${$.startTime+10}`,headers: JSON.parse(payheaderVal) }, (error, response, data) => { let result = JSON.parse(data) - console.log(data) if (result.status == 1){ paybag = `【微博钱包】 ✅ +`+ result.score+' 分\n' } From f4e69d05482f4b8353527a11f6dfff02987c4a9a Mon Sep 17 00:00:00 2001 From: Flydreams <543676667@163.com> Date: Mon, 2 Nov 2020 22:18:16 +0800 Subject: [PATCH 182/266] add test.yml for Gitee Go created_at: 2020-11-02 22:18:16 --- .workflow/test.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .workflow/test.yml diff --git a/.workflow/test.yml b/.workflow/test.yml new file mode 100644 index 0000000000..8fbd35db80 --- /dev/null +++ b/.workflow/test.yml @@ -0,0 +1,23 @@ +# ======================================================== +# npm 构建参考流水线样例 +# 功能:输出当前 npm 构建环境的环境信息 +# ======================================================== +name: gitee-go-npm-example # 定义一个唯一 ID 标识为 gitee-go-npm-example,名称为 “npm-流水线示例” 的流水线 +displayName: 'npm-流水线示例' +triggers: # 流水线触发器配置 + push: # 设置 master 分支 在产生代码 push 时精确触发(PRECISE)构建 + - matchType: PRECISE + branch: master +commitMessage: '' # 通过匹配当前提交的 CommitMessage 决定是否执行流水线 +stages: # 构建阶段配置 + - stage: # 定义一个 ID 标识为 npm-build-stage ,名为 “npm Stage” 的阶段 + name: npm-build-stage + displayName: 'npm Stage' + failFast: false # 允许快速失败,即当 Stage 中有任务失败时,直接结束整个 Stage + steps: # 构建步骤配置 + - step: npmbuild@1 # 采用 npm 编译环境 + name: npm-build # 定义一个 ID 标识为 npm-build ,名为 “npm Step” 的阶段 + displayName: 'npm Step' + inputs: # 构建输入参数设定 + nodeVersion: 10.1 # 指定 node 环境版本为 10.1 + goals: "node -v && npm -v" # 输出 构建环境 Node 和 npm 信息 \ No newline at end of file From 5bdaa02c962e2bee2ade23e15019a61948a24d16 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 12:21:17 +0800 Subject: [PATCH 183/266] test --- Task/dianshijia.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 15777e0258..f871ebb71e 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -116,7 +116,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false) { + if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false&&sleepres.errCode==0) { await notify.sendNotify($.name, subTitle+'\n'+ detail) } } @@ -335,16 +335,16 @@ function sleep() { $.get(url, (error, response, data) => { try { if(logs)$.log(`睡觉任务: ${data}\n`) - const result = JSON.parse(data) - if (result.errCode==0){ - sleeping = result.data.name+'报名成功 🛌' + const sleepres = JSON.parse(data) + if (sleepres.errCode==0){ + sleeping = sleepres.data.name+'报名成功 🛌' } -else if (result.errCode==4006){ +else if (sleepres.errCode==4006){ sleeping = '睡觉中😴' } else { sleeping = '' - } + } } catch (e) { $.msg($.name, `睡觉结果: 失败`, `说明: ${e}`)} @@ -493,7 +493,7 @@ function Addsign() { $.get(url, (error, response, data) => { if(logs)$.log(`额外签到: ${data}\n`) }) -resolve() + resolve() }) } From 9a5a12da78fa834a3950375475e29fbb419afa66 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 12:43:36 +0800 Subject: [PATCH 184/266] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=B5=E8=A7=86?= =?UTF-8?q?=E5=AE=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/dianshijia.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index f871ebb71e..8e532050b6 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -116,7 +116,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false&&sleepres.errCode==0) { + if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false && CountMax == CompCount ) { await notify.sendNotify($.name, subTitle+'\n'+ detail) } } @@ -298,10 +298,13 @@ function dotask(code) { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { taskres = JSON.parse(data) + if (taskres.errCode==0){ - console.log('任务代码:'+code+',获得金币:'+taskres.data.getCoin) + CompCount = taskres.data.dayCompCount + CountMax = taskres.data.dayDoCountMax + console.log('任务代码:'+code+',获得金币:'+taskres.data.getCoin) if (code== 'playTask'&&taskres.data.doneStatus == 3) { - detail += `【播放任务】🔕 完成/共计 `+taskres.data.dayCompCount+`/`+taskres.data.dayDoCountMax+` 次\n` + detail += `【播放任务】🔕 完成/共计 `+CompCount+`/`+CountMax+` 次\n` } } if (taskres.errCode==4000){ From f59086a621dabf6c3cba5f937a42fcee70493a9c Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 12:48:55 +0800 Subject: [PATCH 185/266] test --- Task/dianshijia.js | 479 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 478 insertions(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 8e532050b6..1307557ca7 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -500,4 +500,481 @@ function Addsign() { }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(name, opts) { + class Http { + constructor(env) { + this.env = env + } + + send(opts, method = 'GET') { + opts = typeof opts === 'string' ? { url: opts } : opts + let sender = this.get + if (method === 'POST') { + sender = this.post + } + return new Promise((resolve, reject) => { + sender.call(this, opts, (err, resp, body) => { + if (err) reject(err) + else resolve(resp) + }) + }) + } + + get(opts) { + return this.send.call(this.env, opts) + } + + post(opts) { + return this.send.call(this.env, opts, 'POST') + } + } + + return new (class { + constructor(name, opts) { + this.name = name + this.http = new Http(this) + this.data = null + this.dataFile = 'box.dat' + this.logs = [] + this.isMute = false + this.isNeedRewrite = false + this.logSeparator = '\n' + this.startTime = new Date().getTime() + Object.assign(this, opts) + 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(str, defaultValue = null) { + try { + return JSON.parse(str) + } catch { + return defaultValue + } + } + + toStr(obj, defaultValue = null) { + try { + return JSON.stringify(obj) + } catch { + return defaultValue + } + } + + getjson(key, defaultValue) { + let json = defaultValue + const val = this.getdata(key) + if (val) { + try { + json = JSON.parse(this.getdata(key)) + } catch {} + } + return json + } + + setjson(val, key) { + try { + return this.setdata(JSON.stringify(val), key) + } catch { + return false + } + } + + getScript(url) { + return new Promise((resolve) => { + this.get({ url }, (err, resp, body) => resolve(body)) + }) + } + + runScript(script, runOpts) { + return new Promise((resolve) => { + let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi') + httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi + let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout') + httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20 + httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout + const [key, addr] = httpapi.split('@') + const opts = { + url: `http://${addr}/v1/scripting/evaluate`, + body: { script_text: script, mock_type: 'cron', timeout: httpapi_timeout }, + headers: { 'X-Key': key, 'Accept': '*/*' } + } + this.post(opts, (err, resp, body) => resolve(body)) + }).catch((e) => this.logErr(e)) + } + + loaddata() { + if (this.isNode()) { + this.fs = this.fs ? this.fs : require('fs') + this.path = this.path ? this.path : require('path') + const curDirDataFilePath = this.path.resolve(this.dataFile) + const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) + const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) + const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) + if (isCurDirDataFile || isRootDirDataFile) { + const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath + try { + return JSON.parse(this.fs.readFileSync(datPath)) + } catch (e) { + return {} + } + } else return {} + } else return {} + } + + writedata() { + if (this.isNode()) { + this.fs = this.fs ? this.fs : require('fs') + this.path = this.path ? this.path : require('path') + const curDirDataFilePath = this.path.resolve(this.dataFile) + const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) + const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) + const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) + const jsondata = JSON.stringify(this.data) + if (isCurDirDataFile) { + this.fs.writeFileSync(curDirDataFilePath, jsondata) + } else if (isRootDirDataFile) { + this.fs.writeFileSync(rootDirDataFilePath, jsondata) + } else { + this.fs.writeFileSync(curDirDataFilePath, jsondata) + } + } + } + + lodash_get(source, path, defaultValue = undefined) { + const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') + let result = source + for (const p of paths) { + result = Object(result)[p] + if (result === undefined) { + return defaultValue + } + } + return result + } + + lodash_set(obj, path, value) { + if (Object(obj) !== obj) return obj + if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [] + path + .slice(0, -1) + .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ + path[path.length - 1] + ] = value + return obj + } + + getdata(key) { + let val = this.getval(key) + // 如果以 @ + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objval = objkey ? this.getval(objkey) : '' + if (objval) { + try { + const objedval = JSON.parse(objval) + val = objedval ? this.lodash_get(objedval, paths, '') : val + } catch (e) { + val = '' + } + } + } + return val + } + + setdata(val, key) { + let issuc = false + if (/^@/.test(key)) { + const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) + const objdat = this.getval(objkey) + const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}' + try { + const objedval = JSON.parse(objval) + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + } catch (e) { + const objedval = {} + this.lodash_set(objedval, paths, val) + issuc = this.setval(JSON.stringify(objedval), objkey) + } + } else { + issuc = this.setval(val, key) + } + return issuc + } + + getval(key) { + if (this.isSurge() || this.isLoon()) { + return $persistentStore.read(key) + } else if (this.isQuanX()) { + return $prefs.valueForKey(key) + } else if (this.isNode()) { + this.data = this.loaddata() + return this.data[key] + } else { + return (this.data && this.data[key]) || null + } + } + + setval(val, key) { + if (this.isSurge() || this.isLoon()) { + return $persistentStore.write(val, key) + } else if (this.isQuanX()) { + return $prefs.setValueForKey(val, key) + } else if (this.isNode()) { + this.data = this.loaddata() + this.data[key] = val + this.writedata() + return true + } else { + return (this.data && this.data[key]) || null + } + } + + initGotEnv(opts) { + 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() + if (opts) { + opts.headers = opts.headers ? opts.headers : {} + if (undefined === opts.headers.Cookie && undefined === opts.cookieJar) { + opts.cookieJar = this.ckjar + } + } + } + + get(opts, callback = () => {}) { + if (opts.headers) { + delete opts.headers['Content-Type'] + delete opts.headers['Content-Length'] + } + if (this.isSurge() || this.isLoon()) { + if (this.isSurge() && this.isNeedRewrite) { + opts.headers = opts.headers || {} + Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) + } + $httpClient.get(opts, (err, resp, body) => { + if (!err && resp) { + resp.body = body + resp.statusCode = resp.status + } + callback(err, resp, body) + }) + } else if (this.isQuanX()) { + if (this.isNeedRewrite) { + opts.opts = opts.opts || {} + Object.assign(opts.opts, { hints: false }) + } + $task.fetch(opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => callback(err) + ) + } else if (this.isNode()) { + this.initGotEnv(opts) + this.got(opts) + .on('redirect', (resp, nextOpts) => { + try { + if (resp.headers['set-cookie']) { + const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString() + if (ck) { + this.ckjar.setCookieSync(ck, null) + } + nextOpts.cookieJar = this.ckjar + } + } catch (e) { + this.logErr(e) + } + // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString()) + }) + .then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => { + const { message: error, response: resp } = err + callback(error, resp, resp && resp.body) + } + ) + } + } + + post(opts, callback = () => {}) { + // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成 + if (opts.body && opts.headers && !opts.headers['Content-Type']) { + opts.headers['Content-Type'] = 'application/x-www-form-urlencoded' + } + if (opts.headers) delete opts.headers['Content-Length'] + if (this.isSurge() || this.isLoon()) { + if (this.isSurge() && this.isNeedRewrite) { + opts.headers = opts.headers || {} + Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) + } + $httpClient.post(opts, (err, resp, body) => { + if (!err && resp) { + resp.body = body + resp.statusCode = resp.status + } + callback(err, resp, body) + }) + } else if (this.isQuanX()) { + opts.method = 'POST' + if (this.isNeedRewrite) { + opts.opts = opts.opts || {} + Object.assign(opts.opts, { hints: false }) + } + $task.fetch(opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => callback(err) + ) + } else if (this.isNode()) { + this.initGotEnv(opts) + const { url, ..._opts } = opts + this.got.post(url, _opts).then( + (resp) => { + const { statusCode: status, statusCode, headers, body } = resp + callback(null, { status, statusCode, headers, body }, body) + }, + (err) => { + const { message: error, response: resp } = err + callback(error, resp, resp && resp.body) + } + ) + } + } + /** + * + * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S') + * :$.time('yyyyMMddHHmmssS') + * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒 + * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符 + * @param {*} fmt 格式化参数 + * + */ + time(fmt) { + let o = { + 'M+': new Date().getMonth() + 1, + 'd+': new Date().getDate(), + 'H+': new Date().getHours(), + 'm+': new Date().getMinutes(), + 's+': new Date().getSeconds(), + 'q+': Math.floor((new Date().getMonth() + 3) / 3), + 'S': new Date().getMilliseconds() + } + if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length)) + for (let k in o) + if (new RegExp('(' + k + ')').test(fmt)) + fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) + return fmt + } + + /** + * 系统通知 + * + * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知 + * + * 示例: + * $.msg(title, subt, desc, 'twitter://') + * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) + * + * @param {*} title 标题 + * @param {*} subt 副标题 + * @param {*} desc 通知详情 + * @param {*} opts 通知参数 + * + */ + msg(title = name, subt = '', desc = '', opts) { + const toEnvOpts = (rawopts) => { + if (!rawopts) return rawopts + if (typeof rawopts === 'string') { + if (this.isLoon()) return rawopts + else if (this.isQuanX()) return { 'open-url': rawopts } + else if (this.isSurge()) return { url: rawopts } + else return undefined + } else if (typeof rawopts === 'object') { + if (this.isLoon()) { + let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url'] + let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] + return { openUrl, mediaUrl } + } else if (this.isQuanX()) { + let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl + let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl + return { 'open-url': openUrl, 'media-url': mediaUrl } + } else if (this.isSurge()) { + let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url'] + return { url: openUrl } + } + } else { + return undefined + } + } + if (!this.isMute) { + if (this.isSurge() || this.isLoon()) { + $notification.post(title, subt, desc, toEnvOpts(opts)) + } else if (this.isQuanX()) { + $notify(title, subt, desc, toEnvOpts(opts)) + } + } + if (!this.isMuteLog) { + let logs = ['', '==============📣系统通知📣=============='] + logs.push(title) + subt ? logs.push(subt) : '' + desc ? logs.push(desc) : '' + console.log(logs.join('\n')) + this.logs = this.logs.concat(logs) + } + } + + log(...logs) { + if (logs.length > 0) { + this.logs = [...this.logs, ...logs] + } + console.log(logs.join(this.logSeparator)) + } + + logErr(err, msg) { + const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon() + if (!isPrintSack) { + this.log('', `❗️${this.name}, 错误!`, err) + } else { + this.log('', `❗️${this.name}, 错误!`, err.stack) + } + } + + wait(time) { + return new Promise((resolve) => setTimeout(resolve, time)) + } + + done(val = {}) { + const endTime = new Date().getTime() + const costTime = (endTime - this.startTime) / 1000 + this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`) + this.log() + if (this.isSurge() || this.isQuanX() || this.isLoon()) { + $done(val) + } + } + })(name, opts) +} From e2cb888a311d62aa50cba864138f051bbcfb78d0 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 12:56:52 +0800 Subject: [PATCH 186/266] --- Task/dianshijia.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 1307557ca7..75d99e794f 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -217,8 +217,8 @@ function signinfo() { {detail += ` 连续签到${d}天\n` } } - resolve() } + resolve() }) }) } @@ -236,10 +236,10 @@ function total() { $.get({ url: `http://api.gaoqingdianshi.com/api/coin/temp/exchange?id=`+coinid, headers: JSON.parse(signheaderVal)}, (error, response, data)) } } - } - catch(err){ - console.log(err) } - resolve() + resolve() + } catch(error){ + console.log(error) } + resolve() }) }) } @@ -277,11 +277,12 @@ function cashlist() { detail += `【提现结果】今日未提现 共计提现:`+cashtotal+`元\n` } } + resolve() } catch (error){ console.log(`提现列表失败,可忽略: ${data}`) + resolve() } - resolve() }) }) } @@ -310,8 +311,8 @@ function dotask(code) { if (taskres.errCode==4000){ //console.log('任务代码:'+code+','+taskres.msg) } + resolve() }) - resolve() }) } @@ -327,7 +328,7 @@ function walk() { { }) } - resolve() + resolve() }) }) } @@ -348,6 +349,7 @@ else if (sleepres.errCode==4006){ else { sleeping = '' } + resolve() } catch (e) { $.msg($.name, `睡觉结果: 失败`, `说明: ${e}`)} @@ -362,8 +364,8 @@ function wakeup() { headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { if(logs)$.log(`睡觉打卡: ${data}\n`) + resolve() }) -resolve() }) } @@ -451,16 +453,16 @@ function CarveUp() { if (result.errCode == 0) { detail += `【金币瓜分】✅ 报名成功\n` } + resolve() }) -resolve() }) } function getCUpcoin() { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/taskext/getCoin?code=carveUp&coin=0&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs) $.log(`瓜分百万金币: ${data}`) - }) resolve() + }) }) } function Withdrawal() { @@ -483,8 +485,8 @@ function getGametime() { } $.get(url, (error, response, data) => { if(logs)$.log(`游戏时长: ${data}\n`) + resolve() }) -resolve() }) } function Addsign() { @@ -495,8 +497,8 @@ function Addsign() { } $.get(url, (error, response, data) => { if(logs)$.log(`额外签到: ${data}\n`) + resolve() }) - resolve() }) } From 6387f2be0f7a5eb418a6acdf0ff09166fc067ab0 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 13:00:04 +0800 Subject: [PATCH 187/266] --- .github/workflows/dianshijia.yml | 4 ++-- Task/dianshijia.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index 22e2a29853..e0d1117820 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -16,10 +16,10 @@ jobs: DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 14.x + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 12.x - name: npm install run: | npm install diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 75d99e794f..86dafd9fb3 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -259,7 +259,7 @@ function cashlist() { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/cash/detail`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - const result = JSON.parse(data) + let result = JSON.parse(data) let totalcash = Number(),cashres = "" var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 try{ @@ -322,7 +322,7 @@ function walk() { $.get(url, (error, response, data) => { if(logs)$.log(`走路任务: ${data}\n`) - const result = JSON.parse(data) + let result = JSON.parse(data) if (result.data.unGetCoin>10){ $.get({ url: `${dianshijia_API}/taskext/getCoin?code=walk&coin=${result.data.unGetCoin}&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { @@ -339,7 +339,7 @@ function sleep() { $.get(url, (error, response, data) => { try { if(logs)$.log(`睡觉任务: ${data}\n`) - const sleepres = JSON.parse(data) + let sleepres = JSON.parse(data) if (sleepres.errCode==0){ sleeping = sleepres.data.name+'报名成功 🛌' } From 99b56da445aff7b0d438f074235ef9673c12c86a Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 13:08:16 +0800 Subject: [PATCH 188/266] --- Task/dianshijia.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 86dafd9fb3..325b4732a7 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -122,7 +122,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } } })() - .catch((error) => $.logErr(error)) + .catch((e) => $.logErr(e)) .finally(() => $.done()) function GetCookie() { @@ -237,8 +237,8 @@ function total() { } } resolve() - } catch(error){ - console.log(error) } + } catch(e){ + console.log(e) } resolve() }) }) @@ -279,7 +279,7 @@ function cashlist() { } resolve() } - catch (error){ + catch (e){ console.log(`提现列表失败,可忽略: ${data}`) resolve() } @@ -431,8 +431,8 @@ function coinlist() { } $.msg($.name+` `+sleeping, subTitle, detail) resolve() - } catch(error) { - console.log(`获取任务金币列表失败,错误代码${error}+ \n响应数据:${data}`) + } catch(e) { + console.log(`获取任务金币列表失败,错误代码${e}+ \n响应数据:${data}`) $.msg($.name+` `+sleeping, subTitle, detail) resolve() } From 9abf52654315f7f2ea24e4402a27bcc85bee2b83 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 13:41:40 +0800 Subject: [PATCH 189/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 325b4732a7..c73ddcab14 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -46,7 +46,7 @@ const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; const dianshijia_API = 'http://api.gaoqingdianshi.com/api' -let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal; +let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal,CountMax,CompCount; if ($.isNode()) { if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.indexOf('#') > -1) { Dsjheaders = process.env.DSJ_HEADERS.split('#'); From a003094e389e53161782ac6aff06a56550b710b5 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 14:50:46 +0800 Subject: [PATCH 190/266] --- Task/dianshijia.js | 483 +-------------------------------------------- 1 file changed, 3 insertions(+), 480 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index c73ddcab14..283ea2bf87 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -298,8 +298,8 @@ function tasks(tkcode) { function dotask(code) { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - taskres = JSON.parse(data) - + let taskres = JSON.parse(data) + console.log(data) if (taskres.errCode==0){ CompCount = taskres.data.dayCompCount CountMax = taskres.data.dayDoCountMax @@ -502,481 +502,4 @@ function Addsign() { }) } -function Env(name, opts) { - class Http { - constructor(env) { - this.env = env - } - - send(opts, method = 'GET') { - opts = typeof opts === 'string' ? { url: opts } : opts - let sender = this.get - if (method === 'POST') { - sender = this.post - } - return new Promise((resolve, reject) => { - sender.call(this, opts, (err, resp, body) => { - if (err) reject(err) - else resolve(resp) - }) - }) - } - - get(opts) { - return this.send.call(this.env, opts) - } - - post(opts) { - return this.send.call(this.env, opts, 'POST') - } - } - - return new (class { - constructor(name, opts) { - this.name = name - this.http = new Http(this) - this.data = null - this.dataFile = 'box.dat' - this.logs = [] - this.isMute = false - this.isNeedRewrite = false - this.logSeparator = '\n' - this.startTime = new Date().getTime() - Object.assign(this, opts) - 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(str, defaultValue = null) { - try { - return JSON.parse(str) - } catch { - return defaultValue - } - } - - toStr(obj, defaultValue = null) { - try { - return JSON.stringify(obj) - } catch { - return defaultValue - } - } - - getjson(key, defaultValue) { - let json = defaultValue - const val = this.getdata(key) - if (val) { - try { - json = JSON.parse(this.getdata(key)) - } catch {} - } - return json - } - - setjson(val, key) { - try { - return this.setdata(JSON.stringify(val), key) - } catch { - return false - } - } - - getScript(url) { - return new Promise((resolve) => { - this.get({ url }, (err, resp, body) => resolve(body)) - }) - } - - runScript(script, runOpts) { - return new Promise((resolve) => { - let httpapi = this.getdata('@chavy_boxjs_userCfgs.httpapi') - httpapi = httpapi ? httpapi.replace(/\n/g, '').trim() : httpapi - let httpapi_timeout = this.getdata('@chavy_boxjs_userCfgs.httpapi_timeout') - httpapi_timeout = httpapi_timeout ? httpapi_timeout * 1 : 20 - httpapi_timeout = runOpts && runOpts.timeout ? runOpts.timeout : httpapi_timeout - const [key, addr] = httpapi.split('@') - const opts = { - url: `http://${addr}/v1/scripting/evaluate`, - body: { script_text: script, mock_type: 'cron', timeout: httpapi_timeout }, - headers: { 'X-Key': key, 'Accept': '*/*' } - } - this.post(opts, (err, resp, body) => resolve(body)) - }).catch((e) => this.logErr(e)) - } - - loaddata() { - if (this.isNode()) { - this.fs = this.fs ? this.fs : require('fs') - this.path = this.path ? this.path : require('path') - const curDirDataFilePath = this.path.resolve(this.dataFile) - const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) - const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) - const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) - if (isCurDirDataFile || isRootDirDataFile) { - const datPath = isCurDirDataFile ? curDirDataFilePath : rootDirDataFilePath - try { - return JSON.parse(this.fs.readFileSync(datPath)) - } catch (e) { - return {} - } - } else return {} - } else return {} - } - - writedata() { - if (this.isNode()) { - this.fs = this.fs ? this.fs : require('fs') - this.path = this.path ? this.path : require('path') - const curDirDataFilePath = this.path.resolve(this.dataFile) - const rootDirDataFilePath = this.path.resolve(process.cwd(), this.dataFile) - const isCurDirDataFile = this.fs.existsSync(curDirDataFilePath) - const isRootDirDataFile = !isCurDirDataFile && this.fs.existsSync(rootDirDataFilePath) - const jsondata = JSON.stringify(this.data) - if (isCurDirDataFile) { - this.fs.writeFileSync(curDirDataFilePath, jsondata) - } else if (isRootDirDataFile) { - this.fs.writeFileSync(rootDirDataFilePath, jsondata) - } else { - this.fs.writeFileSync(curDirDataFilePath, jsondata) - } - } - } - - lodash_get(source, path, defaultValue = undefined) { - const paths = path.replace(/\[(\d+)\]/g, '.$1').split('.') - let result = source - for (const p of paths) { - result = Object(result)[p] - if (result === undefined) { - return defaultValue - } - } - return result - } - - lodash_set(obj, path, value) { - if (Object(obj) !== obj) return obj - if (!Array.isArray(path)) path = path.toString().match(/[^.[\]]+/g) || [] - path - .slice(0, -1) - .reduce((a, c, i) => (Object(a[c]) === a[c] ? a[c] : (a[c] = Math.abs(path[i + 1]) >> 0 === +path[i + 1] ? [] : {})), obj)[ - path[path.length - 1] - ] = value - return obj - } - - getdata(key) { - let val = this.getval(key) - // 如果以 @ - if (/^@/.test(key)) { - const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) - const objval = objkey ? this.getval(objkey) : '' - if (objval) { - try { - const objedval = JSON.parse(objval) - val = objedval ? this.lodash_get(objedval, paths, '') : val - } catch (e) { - val = '' - } - } - } - return val - } - - setdata(val, key) { - let issuc = false - if (/^@/.test(key)) { - const [, objkey, paths] = /^@(.*?)\.(.*?)$/.exec(key) - const objdat = this.getval(objkey) - const objval = objkey ? (objdat === 'null' ? null : objdat || '{}') : '{}' - try { - const objedval = JSON.parse(objval) - this.lodash_set(objedval, paths, val) - issuc = this.setval(JSON.stringify(objedval), objkey) - } catch (e) { - const objedval = {} - this.lodash_set(objedval, paths, val) - issuc = this.setval(JSON.stringify(objedval), objkey) - } - } else { - issuc = this.setval(val, key) - } - return issuc - } - - getval(key) { - if (this.isSurge() || this.isLoon()) { - return $persistentStore.read(key) - } else if (this.isQuanX()) { - return $prefs.valueForKey(key) - } else if (this.isNode()) { - this.data = this.loaddata() - return this.data[key] - } else { - return (this.data && this.data[key]) || null - } - } - - setval(val, key) { - if (this.isSurge() || this.isLoon()) { - return $persistentStore.write(val, key) - } else if (this.isQuanX()) { - return $prefs.setValueForKey(val, key) - } else if (this.isNode()) { - this.data = this.loaddata() - this.data[key] = val - this.writedata() - return true - } else { - return (this.data && this.data[key]) || null - } - } - - initGotEnv(opts) { - 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() - if (opts) { - opts.headers = opts.headers ? opts.headers : {} - if (undefined === opts.headers.Cookie && undefined === opts.cookieJar) { - opts.cookieJar = this.ckjar - } - } - } - - get(opts, callback = () => {}) { - if (opts.headers) { - delete opts.headers['Content-Type'] - delete opts.headers['Content-Length'] - } - if (this.isSurge() || this.isLoon()) { - if (this.isSurge() && this.isNeedRewrite) { - opts.headers = opts.headers || {} - Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) - } - $httpClient.get(opts, (err, resp, body) => { - if (!err && resp) { - resp.body = body - resp.statusCode = resp.status - } - callback(err, resp, body) - }) - } else if (this.isQuanX()) { - if (this.isNeedRewrite) { - opts.opts = opts.opts || {} - Object.assign(opts.opts, { hints: false }) - } - $task.fetch(opts).then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => callback(err) - ) - } else if (this.isNode()) { - this.initGotEnv(opts) - this.got(opts) - .on('redirect', (resp, nextOpts) => { - try { - if (resp.headers['set-cookie']) { - const ck = resp.headers['set-cookie'].map(this.cktough.Cookie.parse).toString() - if (ck) { - this.ckjar.setCookieSync(ck, null) - } - nextOpts.cookieJar = this.ckjar - } - } catch (e) { - this.logErr(e) - } - // this.ckjar.setCookieSync(resp.headers['set-cookie'].map(Cookie.parse).toString()) - }) - .then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => { - const { message: error, response: resp } = err - callback(error, resp, resp && resp.body) - } - ) - } - } - - post(opts, callback = () => {}) { - // 如果指定了请求体, 但没指定`Content-Type`, 则自动生成 - if (opts.body && opts.headers && !opts.headers['Content-Type']) { - opts.headers['Content-Type'] = 'application/x-www-form-urlencoded' - } - if (opts.headers) delete opts.headers['Content-Length'] - if (this.isSurge() || this.isLoon()) { - if (this.isSurge() && this.isNeedRewrite) { - opts.headers = opts.headers || {} - Object.assign(opts.headers, { 'X-Surge-Skip-Scripting': false }) - } - $httpClient.post(opts, (err, resp, body) => { - if (!err && resp) { - resp.body = body - resp.statusCode = resp.status - } - callback(err, resp, body) - }) - } else if (this.isQuanX()) { - opts.method = 'POST' - if (this.isNeedRewrite) { - opts.opts = opts.opts || {} - Object.assign(opts.opts, { hints: false }) - } - $task.fetch(opts).then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => callback(err) - ) - } else if (this.isNode()) { - this.initGotEnv(opts) - const { url, ..._opts } = opts - this.got.post(url, _opts).then( - (resp) => { - const { statusCode: status, statusCode, headers, body } = resp - callback(null, { status, statusCode, headers, body }, body) - }, - (err) => { - const { message: error, response: resp } = err - callback(error, resp, resp && resp.body) - } - ) - } - } - /** - * - * 示例:$.time('yyyy-MM-dd qq HH:mm:ss.S') - * :$.time('yyyyMMddHHmmssS') - * y:年 M:月 d:日 q:季 H:时 m:分 s:秒 S:毫秒 - * 其中y可选0-4位占位符、S可选0-1位占位符,其余可选0-2位占位符 - * @param {*} fmt 格式化参数 - * - */ - time(fmt) { - let o = { - 'M+': new Date().getMonth() + 1, - 'd+': new Date().getDate(), - 'H+': new Date().getHours(), - 'm+': new Date().getMinutes(), - 's+': new Date().getSeconds(), - 'q+': Math.floor((new Date().getMonth() + 3) / 3), - 'S': new Date().getMilliseconds() - } - if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (new Date().getFullYear() + '').substr(4 - RegExp.$1.length)) - for (let k in o) - if (new RegExp('(' + k + ')').test(fmt)) - fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ('00' + o[k]).substr(('' + o[k]).length)) - return fmt - } - - /** - * 系统通知 - * - * > 通知参数: 同时支持 QuanX 和 Loon 两种格式, EnvJs根据运行环境自动转换, Surge 环境不支持多媒体通知 - * - * 示例: - * $.msg(title, subt, desc, 'twitter://') - * $.msg(title, subt, desc, { 'open-url': 'twitter://', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) - * $.msg(title, subt, desc, { 'open-url': 'https://bing.com', 'media-url': 'https://github.githubassets.com/images/modules/open_graph/github-mark.png' }) - * - * @param {*} title 标题 - * @param {*} subt 副标题 - * @param {*} desc 通知详情 - * @param {*} opts 通知参数 - * - */ - msg(title = name, subt = '', desc = '', opts) { - const toEnvOpts = (rawopts) => { - if (!rawopts) return rawopts - if (typeof rawopts === 'string') { - if (this.isLoon()) return rawopts - else if (this.isQuanX()) return { 'open-url': rawopts } - else if (this.isSurge()) return { url: rawopts } - else return undefined - } else if (typeof rawopts === 'object') { - if (this.isLoon()) { - let openUrl = rawopts.openUrl || rawopts.url || rawopts['open-url'] - let mediaUrl = rawopts.mediaUrl || rawopts['media-url'] - return { openUrl, mediaUrl } - } else if (this.isQuanX()) { - let openUrl = rawopts['open-url'] || rawopts.url || rawopts.openUrl - let mediaUrl = rawopts['media-url'] || rawopts.mediaUrl - return { 'open-url': openUrl, 'media-url': mediaUrl } - } else if (this.isSurge()) { - let openUrl = rawopts.url || rawopts.openUrl || rawopts['open-url'] - return { url: openUrl } - } - } else { - return undefined - } - } - if (!this.isMute) { - if (this.isSurge() || this.isLoon()) { - $notification.post(title, subt, desc, toEnvOpts(opts)) - } else if (this.isQuanX()) { - $notify(title, subt, desc, toEnvOpts(opts)) - } - } - if (!this.isMuteLog) { - let logs = ['', '==============📣系统通知📣=============='] - logs.push(title) - subt ? logs.push(subt) : '' - desc ? logs.push(desc) : '' - console.log(logs.join('\n')) - this.logs = this.logs.concat(logs) - } - } - - log(...logs) { - if (logs.length > 0) { - this.logs = [...this.logs, ...logs] - } - console.log(logs.join(this.logSeparator)) - } - - logErr(err, msg) { - const isPrintSack = !this.isSurge() && !this.isQuanX() && !this.isLoon() - if (!isPrintSack) { - this.log('', `❗️${this.name}, 错误!`, err) - } else { - this.log('', `❗️${this.name}, 错误!`, err.stack) - } - } - - wait(time) { - return new Promise((resolve) => setTimeout(resolve, time)) - } - - done(val = {}) { - const endTime = new Date().getTime() - const costTime = (endTime - this.startTime) / 1000 - this.log('', `🔔${this.name}, 结束! 🕛 ${costTime} 秒`) - this.log() - if (this.isSurge() || this.isQuanX() || this.isLoon()) { - $done(val) - } - } - })(name, opts) -} +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From 78821f6451659d28a822d149ef73fb726cf9096c Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 14:54:00 +0800 Subject: [PATCH 191/266] =?UTF-8?q?fix=20=E7=94=B5=E8=A7=86=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/dianshijia.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 283ea2bf87..251cfc1534 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-10-13 21:21 +更新时间: 2020-11-03 14:21 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 本脚本仅适用于电视家签到,支持Actions多账号运行,请用'#'或者换行隔开‼️ 获取Cookie方法: @@ -116,7 +116,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false && CountMax == CompCount ) { + if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false && CountMax == CompCount && taskres.errCode == 0 ) { await notify.sendNotify($.name, subTitle+'\n'+ detail) } } @@ -299,7 +299,6 @@ function dotask(code) { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { let taskres = JSON.parse(data) - console.log(data) if (taskres.errCode==0){ CompCount = taskres.data.dayCompCount CountMax = taskres.data.dayDoCountMax From 86d9378d644e7f479e47104862b74015ce9c42c3 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 14:56:43 +0800 Subject: [PATCH 192/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 251cfc1534..2e3df9fd21 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -307,7 +307,7 @@ function dotask(code) { detail += `【播放任务】🔕 完成/共计 `+CompCount+`/`+CountMax+` 次\n` } } - if (taskres.errCode==4000){ + else if (taskres.errCode==4000){ //console.log('任务代码:'+code+','+taskres.msg) } resolve() From e7bedc64fc0ecfbbb510469fd6ee348f89ea1d95 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 20:28:00 +0800 Subject: [PATCH 193/266] --- Task/dianshijia.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 2e3df9fd21..db1896cd2c 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -44,7 +44,7 @@ const gametimes = "1999"; //游戏时长 const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; -let sleeping = "",detail=``,subTitle=``; +let sleeping = "",detail=``,subTitle=``,taskres = {}; const dianshijia_API = 'http://api.gaoqingdianshi.com/api' let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal,CountMax,CompCount; if ($.isNode()) { @@ -298,8 +298,8 @@ function tasks(tkcode) { function dotask(code) { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - let taskres = JSON.parse(data) - if (taskres.errCode==0){ + let taskres = JSON.parse(data) + if (taskres.errCode == 0){ CompCount = taskres.data.dayCompCount CountMax = taskres.data.dayDoCountMax console.log('任务代码:'+code+',获得金币:'+taskres.data.getCoin) From 410c387bd8a7ea22c76c7abe102ed3207d1bf7fa Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 20:40:01 +0800 Subject: [PATCH 194/266] --- Task/dianshijia.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index db1896cd2c..fb01ef5d3c 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-11-03 14:21 +更新时间: 2020-11-03 20:40 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 本脚本仅适用于电视家签到,支持Actions多账号运行,请用'#'或者换行隔开‼️ 获取Cookie方法: @@ -116,7 +116,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - if ($.isNode()&& process.env.DSJ_NOTIFY_CONTROL == false && CountMax == CompCount && taskres.errCode == 0 ) { + if ($.isNode() && code == 'playTask' && CountMax == CompCount && taskcode == 0 ) { await notify.sendNotify($.name, subTitle+'\n'+ detail) } } @@ -299,7 +299,8 @@ function dotask(code) { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { let taskres = JSON.parse(data) - if (taskres.errCode == 0){ + taskcode = taskres.errCode + if (taskcode == 0){ CompCount = taskres.data.dayCompCount CountMax = taskres.data.dayDoCountMax console.log('任务代码:'+code+',获得金币:'+taskres.data.getCoin) @@ -307,7 +308,7 @@ function dotask(code) { detail += `【播放任务】🔕 完成/共计 `+CompCount+`/`+CountMax+` 次\n` } } - else if (taskres.errCode==4000){ + else if (taskcode == '4000'){ //console.log('任务代码:'+code+','+taskres.msg) } resolve() From ec1810ec00c0ec1fe800e77fdf2d325a35bc7cf7 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 20:42:44 +0800 Subject: [PATCH 195/266] --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index fb01ef5d3c..e745cfd1d1 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -94,13 +94,13 @@ if (isGetCookie = typeof $request !== 'undefined') { $.msg($.name, '【提示】请先获取电视家一cookie') return; } - console.log(`------------- 共${tokenArr.length}个账号\n`) + console.log(`------------- 共${tokenArr.length}个账号`) for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { signheaderVal = tokenArr[i]; drawalVal = DrawalArr[i]; $.index = i + 1; - console.log(`开始【电视家${$.index}】`) + console.log(`\n\n开始【电视家${$.index}】`) await signin(); // 签到 await signinfo(); // 签到信息 await Addsign(); // 额外奖励,默认额度 From ee0fdc91485313765e076003d3f76f8c5501516b Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 20:54:14 +0800 Subject: [PATCH 196/266] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=B5=E8=A7=86?= =?UTF-8?q?=E5=AE=B6=E9=A2=9D=E5=A4=96=E7=AD=BE=E5=88=B0=E5=A5=96=E5=8A=B1?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=85=91=E6=8D=A2?= =?UTF-8?q?=E6=8F=90=E7=8E=B0=E9=A2=9D=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/dianshijia.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index e745cfd1d1..10d906f10f 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -44,7 +44,8 @@ const gametimes = "1999"; //游戏时长 const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; -let sleeping = "",detail=``,subTitle=``,taskres = {}; +let sleeping = "",detail=``,subTitle=``; +let RewardId = $.getdata('REWARD')||'55'; //额外签到奖励,默认55为兑换0.2元额度,44为兑换1天VIP,42为兑换1888金币 const dianshijia_API = 'http://api.gaoqingdianshi.com/api' let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal,CountMax,CompCount; if ($.isNode()) { @@ -492,7 +493,7 @@ function getGametime() { function Addsign() { return new Promise((resolve, reject) => { let url = { - url: `${dianshijia_API}/sign/chooseAdditionalReward?rewardId=55`, + url: `${dianshijia_API}/sign/chooseAdditionalReward?rewardId=${RewardId}`, headers: JSON.parse(signheaderVal), } $.get(url, (error, response, data) => { From 51f12dcf90d552c48522442a7b798d608aa098c9 Mon Sep 17 00:00:00 2001 From: Best Date: Tue, 3 Nov 2020 21:33:21 +0800 Subject: [PATCH 197/266] --- Task/sunert.boxjs.json | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Task/sunert.boxjs.json b/Task/sunert.boxjs.json index c0893ed4bb..81294dd6f2 100644 --- a/Task/sunert.boxjs.json +++ b/Task/sunert.boxjs.json @@ -44,6 +44,23 @@ "name": "电视家", "keys": ["sy_signheader_dsj", "drawal_dsj"], "author": "@sunert", + "settings": [{ + "id": "REWARD", + "name": "额外签到奖励", + "val": "55", + "type": "radios", + "desc": "", + "items": [{ + "key": "55", + "label": "提现额度" + }, { + "key": "44", + "label": "1天VIP" + }, { + "key": "42", + "label": "1888金币" + }] + }], "repo": "https://gitee.com/Sunert/Scripts/blob/master/Task/dianshijia.js", "icons": ["https://raw.githubusercontent.com/Orz-3/mini/master/dianshijia.png", "https://raw.githubusercontent.com/Orz-3/task/master/dianshijia.png"], "script": "https://gitee.com/Sunert/Scripts/raw/master/Task/dianshijia.js" From 472b92283c91d639f86d5d73f8c8e037ed2fe705 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 00:54:50 +0800 Subject: [PATCH 198/266] --- Task/jd_starStore.js | 308 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 Task/jd_starStore.js diff --git a/Task/jd_starStore.js b/Task/jd_starStore.js new file mode 100644 index 0000000000..7ddc023a96 --- /dev/null +++ b/Task/jd_starStore.js @@ -0,0 +1,308 @@ +/* +京东星店长 +更新时间:2020-11-03 16:51 +脚本说明: +第一次执行会循环 8--86号店铺,时间比较长,后面会判断,做完86的不再全部做,每天运行一次即可 +使用前请先看下活动介绍,可能会关注店铺,入会是假入会,入会任务可能不会完成 +此脚本仅做任务,需要拉人头才能参与瓜分,请按需使用 +活动进入方式:京东app搜索【星店长】 +5 9 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_starStore.js, tag=京东星店长, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true + +*/ +const $ = new Env('京东星店长'); +//Node.js用户请在jdCookie.js处填写京东ck; +const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; +//IOS等用户直接用NobyDa的jd cookie +let cookiesArr = [], cookie = ''; +if ($.isNode()) { + Object.keys(jdCookieNode).forEach((item) => { + cookiesArr.push(jdCookieNode[item]) + }) +} else { + cookiesArr.push($.getdata('CookieJD')); + cookiesArr.push($.getdata('CookieJD2')); +} +const JD_API_HOST = `https://api.m.jd.com/client.action?functionId=`; +!(async () => { + if (!cookiesArr[0]) { + $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + return; + } + for (let i = 0; i < cookiesArr.length; i++) { + cookie = cookiesArr[i]; + if (cookie) { + console.log('**********************分割线**********************') + initial(); + await QueryJDUserInfo(); + if (!merge.enabled) //cookie不可用 + { + $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。 + $.msg($.name, `【提示】京东账号${i + 1} cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + continue; + } + if (Date.now() > Date.parse('2020-11-12')){ + $.msg($.Name,"","活动已结束,请删除或禁用脚本!"); + return + } + let shopId = 0; + let now = new Date(); + await mcxhd_starmall_taskList(86); //做最后一个,看是否做完 + if (!merge.end) { + for (shopId = 8; shopId <86 ; shopId ++ ) { + console.log('\n开始店铺:' + shopId) + await mcxhd_starmall_taskList(shopId); + } + } + merge.end = false; + if (now.getDate() === 3) shopId = 2; + if (now.getDate() === 4) shopId = 2; + if (now.getDate() === 5) shopId = 3; + if (now.getDate() === 6) shopId = 3; + if (now.getDate() === 7) shopId = 4; + if (now.getDate() === 8) shopId = 4; + if (now.getDate() === 9) shopId = 5; + if (now.getDate() === 10) shopId = 6; + if (now.getDate() === 11) shopId = 7; + await mcxhd_starmall_taskList(shopId); + await msgShow(); + } + } +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + + +//获取昵称(直接用,勿删) +function QueryJDUserInfo(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, + headers : { + 'Referer' : `https://wqs.jd.com/my/iserinfo.html`, + 'Cookie' : cookie + } + } + $.get(url, (err, resp, data) => { + try { + data = JSON.parse(data); + if (data.retcode === 13) { + merge.enabled = false + return + } + merge.nickname = data.base.nickname; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//查询 +function mcxhd_starmall_taskList(shopId,timeout = 0){ + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}mcxhd_starmall_taskList&appid=jd_mp_h5&body=%7B%22shopId%22:%22${shopId}%22,%22token%22:%22jd6df03bd53f0f292f%22%7D&loginType=2`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/4DEZi5iUgrNLD9EWknrGZhCjNv7V/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + } + } + $.get(url, async (err, resp, data) => { + try { + data = JSON.parse(data); + if (data.retCode !== "200") { + console.log(data.retMessage) + return + } + console.log('\n星店长:'+data.result.starName) + for (let i in data.result.tasks) { + if (merge.end) return ; + //if (data.result.tasks[i].taskType !== "7"){ + // continue + //} else { + // console.log(data.result.tasks[i].subItem[0].itemId) + // return + //} + if (data.result.tasks[i].taskType !== "7") console.log('\n开始做任务:' + data.result.tasks[i].taskName) + if (data.result.tasks[i].status === 0 ) { + for (let j in data.result.tasks[i].subItem) { + await mcxhd_starmall_doTask(shopId,data.result.tasks[i].taskType,data.result.tasks[i].subItem[j].itemId) + } + } else { + if (shopId === 86) { + console.log('最后一个店铺已做完,不再执行所有店铺') + merge.end = true; + } + console.log('已完成') + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//做任务 +function mcxhd_starmall_doTask(shopId,taskType,itemId,timeout = 0){ + return new Promise((resolve) => { + setTimeout( ()=>{ + if (taskType === "7") itemId = shareCode[shopId];// '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8zYv7WVIxFMVj1lV2pKDjARLLbNU_JV-gpnPfE9HW-02KqFUKGtvxAhB0qpzIrZwdSu-yZTRWQMbBwd4k2XPmFHDqa'; + let url = { + url : `${JD_API_HOST}mcxhd_starmall_doTask&appid=jd_mp_h5&body=%7B%22itemId%22:%22${itemId}%22,%22taskType%22:%22${taskType}%22,%22shopId%22:%22${shopId}%22,%22token%22:%22jd6df03bd53f0f292f%22%7D&loginType=2`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `*/*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/4DEZi5iUgrNLD9EWknrGZhCjNv7V/index.html?shopId=${shopId}&inviteId=${shareCode[shopId]}&babelChannel=ttt1`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + } + } + $.get(url, async (err, resp, data) => { + try { + //console.log(url.url) + //console.log(data) + data = JSON.parse(data); + if (taskType !== "7") console.log(data.retMessage) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +var shareCode = [ + '', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwzfupaUAaCzThSWkJH-rWzkE1CiSqcKjixdbItXLI36wd2PRn53FF3Qd83QaH-eksFJaOtrv6OeY7ZPZxBlToRqbNRrw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8zYv7WVIxFMVj1lV2pKDjARLLbNU_JV-gpnPfE9HW-02KqFUKGtvxAhB0qpzIrZwdSu-yZTRWQMbBwd4k2XPmFHDqa', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4zzIuAP9ftTzuEao3sXWuGLLpFCZ5icB_-WvBMpD6Go5-HLIIV5iGRwTgj8stXlkisI8N_5JhwQsD7GQ4LGsgvJ_Wruw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkzagijopM6HP9i8jM8Hvo2CfFhtPmUIBcG2gmTDdvOg_bCvQS9LROdHNxp2CaqYwdqkm5goAePm-yVeRUMoYj_dRnugg', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgzSEllgoZFO2Qm8oFmt0Q4mow9dCzWpinng8olsX7EMifKAGeDMVk7_oaIVQPCbC9-VtlD_hzdK811DMzScm33McGt', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfszf6XfbSkVmvZ41eDovmsK1hM-13auIalW_2Mj5eLGaScrZA_euWAVL3G95wbuAV8viZaEFCcUPGUmCwe5VZd-mTzilw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfoza8K0IpL9mvWLveI1os5oJp2dTVcxqcNGK_we7REPVSOQHIRX47scO74cIkYQOB6T_S6RhuILYyMUbS4BPjRvYbO06g', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUzFOD-4F8YdcGyLhJdtLVbkV1zpvhNUdZVO_auO4PKrbCS3XQffPgTvdVQpelJiK3roby2J2TZV9EBDwmkaotEL7jQSQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfQzcjir8SeH7RnnwOFgXTwfTeoyrdK7ZaR-SBmLf3RsY--v7DpVA7H5rjSgRFZCgbfm-Z0M6nvxkVmWAzsU3B97Gcw7iA', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwhwhxjv9goOzjcVIHpVqBrcgAu1QDzjWRmis99vVsRXHAfdITKHZWgSKYP4rTiNmILf3hhGBKRt3nwWYelfcfx3tByzQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwg1GkpMYts8kEYMM2UgyMYF8s7hGmA3s9SGNYAns7xhs_og6O6QR7O-JtMWGMcG1iEPf-H9L85wein_wFn1mVM-sCA0V8', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwj5lnjD6wrhVGo0oN2nUU-aYNeqA-PDItHq9HQhFppDm8vvcs622gpz-0BVf5ftyaVigNkqZLf2veMaRgeGcEUXv7h8N0', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwiej9xjZP0LbnLloPCge1bsVtIH7k2tYk4mUw-ntWz2Cn46Iy1E4tOhSOL-Dyx-tfnhAPyy2adQ8Jln8-NlLp6iToiNTw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwlOWoIwiLSKbuDSbp6V-f6tZd5dZ7pHcl1Rmw5UYW8ugOuFtG1obW1eMGitMUo87QRUbPSKilOxYXXGTKDYSU-PU4KTg', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwkEyo_2Xqhtn8UM5huWU49Yu2ogT4bguZxlaguPeK5l2Qj88DZeTmPUVVHY0zW4ov2geKLvKHqO4wHoOFL7Oa1ruI59TQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwniukeK0jGMdPRHf7_w5TEv4yKLIq5ifuYOHX9Nv2wVUkOp2OnXrhrMdIuFpPuqY_wUgIgXbV7J1mOnQpHr2dd4SYldQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwmXvcUbGY9LbbkDifMWqHOdmpi9ks5VS1KiGauQZjnyuGH8S-1_GTd5IKrecfzbAE24D0QtfSGw8XVQDZv8alrDZ1iFA', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwpBn9H4cZ55ZHQXbHyK64A6XkWjfzxsJNIl7_cgBfmqDGnnQRs2FNDxi-gJ1m-LoBHAYDuaW47H_ON8aBYJDEZohEiLGY', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwoDFjEn_bARCtQnOAU-aQtTTdvLHbUeMcdncaUPqMVCCzAJekDdSDcoFvRdYfLvbGKvnqNfRT1Ra1EjKoNqVzxurhcCw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8hYAlTUnHWn0lIqm0wmbkyMT_ZiCBePGEwwqUOUokFoSk1PMMwmYHmkd_cq_0uWHy0tEwLkCwBSBRrqTaDDSp80h2aEKo', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8g-ERlkoyFzDfwGNc4ujzFPPpVPDav6KLvNJToaZyngBY1gX8i3LpYkFYTG7UsC0HsdBeHmy_xvECm84qlXHwIoGBV2rk', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8jg4H-3mtslFtHHj5odslZizbzquoy0KJPp_ZcaPJfmEWGakJGkXr0xuLh-5pzESdP7DZDDPuyx7TOk-Vr-GdD9d4MzQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8iaLgHXA9kP1Gab0-LjixH1XbYRSyvDh8U_Bz0U2Tjc5JpjuM3Zrub4EcS-nFbaObQiOKOCHIKZuBn1Q91hLblDfQtYx0', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8luvOmnSUBSuwwQV_84Z8bcEt3CRzSTz2RQS016aI8wuaCzgjpnxUxCOtD8lGIGSQfkERRzxW1T2t2qSaOjb4aPEJ-Jx0', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8kbKT3QJERdmecdKDkHSoMoXSniWOQsn-QIAxV6DdMFtaCVtSkaN8ZAbAYsq4ASWNiBuNGGR8kD2cmoSvmIdKnuhztNw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8nNTbJHovvbC-2gPbI5KOgt2zghQehOj9cRCiG4vCC7JoRTNqmIkjSLhRbbI-UhQQ4qV6VoZuc2opMo3DqGmVV5buJycQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8mQGt4VfZKRvRhI5ILdBLkxXar2g51KytOYsbHkHdExbreOWA54eVdlkiPEoaJJMG8LUBZ7iZ8-E5INsHrdA1ZG7deRh4', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8pLXJYHI-a8nHXvxfeGZ4Wx9xbU7BcN19iGczuIIrUqFOS38wC2KeBH1oChm-JIH0EhtlEmUnqzhVLRE-K4mMLWQh72w', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8okmHdcCdskP7LmeBLQiN9reOaSydRb1rl1SrM8gMHJTci93Pjvcls9dqlWalYLm8sBFzieqAVD6nCyBB2G2sPu-PiUmg', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4hOcHPA4zCjLnErqe9LD5c8E8gRs4rBf4KkPYCbKVvgF68nefvxa0BS5SFumwHJsT8wW6RdTd867QCewf4Udlp7-ygiA', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4gv7ktxxXawJyq73ZXSDDO3K3W4XdaPCHnm9Fhi2bH9kAj7wOd_FPpHhoLc9oEHW6JHBVkC15igau8ppEDn6b9PADFmgo', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4jSN_mDWvfNa5RrLTavB-U9YOF-6G0HyZa5RXdQ-QrNmVT9Oo0_SjPOtDWAeBC2hYdlAx-QmhHAXS4yB-3YEGDRJiwf54', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4i59rZPbyugO3dSl_y3r71j5kre0TVzA8Mn_ejcxaF9nszVzBmMcWNFJCv4qR9j9C6y-m4EOA27TJE6lIse8pIqPtiGzM', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4le55QaxXu2zOLDO53A0S5tDUVyoQjqihzMn43fMRajKaMeobc3_lYTJNWRbuufGpzZjbSJqODeeJSIOTkSm-NhFMnsL4', + '活动不存在或已结束,试试其他活动吧~', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4nVvBWxlihhrqqtJhrVGMzep75ykmRsh0RYafgHWA1DJhDcZn12n6L-82KG5NFY3gD7UI5IxliqAoKSj6vhJy7FAtSwA', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4mLJGS2hwyI05jqfoxqpX_fLOBWLhLJedkAZCNWZe_N7n5xIm5_K17KyNSTK2B5Xd-xVXC-vktUvxHJt8QbYDVcRL4OIY', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4pljzS2kzg32QlbdWIhIm4DcTeqsZ46Xehmm3-X5Nk5ZkAwXgLXY98IGZYKVqBmnqetu8iXtOcWKeA3BUeuyjwk2_TiKc', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4oEBZPcxERcmVGNMEUXy8y6E-cqbbfnR63aUrz5H7Yo6vc8L1E0SyHbI3d6N4b2CrQ_cLS8Voux-npXu8WbABWYfrUmQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkhDsSrdkcVGK3VTommsDKAvYw0l6HweWIWVOjHViJGyWGC38WVh963S5Ud1PAt4EQlV1MmI7jNTdQ5sk1iG8ZomoiZazQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkgy97snot-BF6Y0n9yUo6v0AN7ylo5Jbe0cB5T8A0783IPCGqMCm3yn-rOL395ebEQaM-nw6Da5Ap3Ias-VLHpIxeB8NE', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkjXCW2KTTC26wxgkilM-7gp6oP-EceBlbS7SH5xeHFkR4RmW3VotHe-F9kJFDZRbdGIPd5ATI38KQ6QHShR1zFb0Q3CQU', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkiBmW2WsEkjXxdxhQfNXDc8wfa-p9jwesxxnCOZZ0jBWF1gW5VespnUODpkyKDhz3g2LeKhup9EEdyp0kHoNe-Tm3bDyk', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfklnO45rRYZjmyo0tMWIEQIt2PjL0cEZWiUop4NmuzSvoMvQwamflWB2nR0HUzAq7JBA_lCgRGgpO7f-OSSu4y_bkZXZA', + '活动不存在或已结束,试试其他活动吧~', + '活动不存在或已结束,试试其他活动吧~', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkmCjT4RXQOEO1JuKHUbhTy4jTDchNxUn5-n5HNHX6Mqptvx2i8lOe_cfYziWW_KbwN5iZfGd0mEiOM2qrPkWFayz-VMaw', + '活动不存在或已结束,试试其他活动吧~', + '活动不存在或已结束,试试其他活动吧~', + '活动不存在或已结束,试试其他活动吧~', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfggMxZjZNCAb9v9v2mWjs7bl2RxHBJWrCEV4xjJ9NBSese836v2mfKFfc2tv9SrjmhycjvhTqXR3CBmCrWEVbw_fljmrQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgj6GYEtRUHqfbhnsvLlCTSV-jTYvQR_t8SCOOABo2vxzkDDCaRXDDv2MUrOps5NumniB5MDKkoU5BVCxEikisRgsnPYd0', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgitlDQvhA0gqfgXU0UfYkrTuOXJnst9JYdbW5yHLe41n6RtD_pMMp2zc1SBIloFjmNFaeaUP1clWcOGqtV4wbLTeGLAKY', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgl0vbXXC9JdSAWkC-vVrO9vmU82R3qkl1oBmb9pNdjxgiDaklmSNZzhKSfieRcJ-Mn8y0o01XmiLQ6lWg7Tj-RdDyrig', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgkvQ0bu6XWOuaKd5H28f-yXxgdhMmK5RyAW9TzjtIskHb4QHYhqNATons0UdM3YjqizMaOKb5o373TDItVq5gvTG8fat0', + '活动不存在或已结束,试试其他活动吧~', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgmVp8WCv8r_aeQECSQZLMnp4ZxgGpbkZazZQETws2UMPvcMJeYaXH6SBG3ax6bwcmDW73vzOd9Qqcea625puk_oTdAln8', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgpHAaEY1G-5u_B-Hh6N0ua6psMP8lmBLSikCLnYmc5RONZxeHqyruE7TPlV44cwrCYYlS2lakReHT9HZqJ9EZyRhBBN_w', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgozwf1YShpYwumLKrL2ds-Ag81fYt_1cAv52t7qDr42NdQFFaopeqjh6VRtU_aiNImgvJJ32UbedSst8YDL5JSEQ8Jl0Q', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfshzgVN_NDaq8FF1xcXks1Of81nzViBaivBA1KiwyeHh_cXdtE9jJbEpTStq8KmaT9B-LjEJNlR-7sBpUDHhZww7B6iCXM', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsgP4D0AfC15vH5HIIregOPLqDnr78boGgwDTgIynX7z-CPYc0V5w4G8zRgtIABHbj872nCBjsjr-wsWv1uUZCRMrBs-zk', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsj0X_ymCa6ASuH9tD9XzpcnvT70DQJ2uYV9vnfYD0eGFFvspksrWau9vCgvsqtg6MUpdoylM6iP27zWfi1Viout7gBv1Y', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsi-uUhG9sLfW9OhsLAFSwzLYKUWYRV6EzyrqbaOQqgc4gavlWUThHlBPJXBXYgV6Cq318pd01uwwnTdHCmuyePmFGp7w', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfslOA7UpZCFo6gy9F9tsvVD5GIjYRFPS4p9DUzpnlipH-R6Ov_GrQ7t1aUcr7aguuCVti_gXDboLJBrZkCDp_Ck1-zL04w', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfskmMFFOF1YzpVZ-2NGA0v5nDJ5DFdEf24JLCi9vi2RLagqxaIeOEf_cQdqCNyZI3EwfsStEvLuC8wd-bZWpWYDy6Fscr0', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsnd9UbKcTL-Uh4IvNj847UoVCCAysL3HRqrIqbgYVVuS0A1K9x3IZOfvtLSnjtzpGOMzzcu5XjTB4NT7BQGQx2hjOj9GQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsmTZ3cgqFDSKt8YjYAgC13jJqcd-rNZDUamX1Kpf6rTaQMnben4JpS7OaO0zwwBHmnVBWBnQrciL9uUjKy0G1Rc-Ii3ec', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfspw6HcZ5vYwG8WHB2lVJz-sxaAb05U7A05tsQpb_ni_ec-_W6W2xOjWDXlKXZtUrKvg9K62yVrUpDpZgi6v4wIBP3i_A', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfso47WwFIl3VWc_YDFC-othyiQJe6toaODA3bAzRj8R-2XS40j3HI90wvW4mFtodnVkiGY7CgFcg8Ery0q-Jrm2SzUno0g', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfohrXzwpKGQht1jOwZEQRhHVi2kxj_hzvgj9nEzYftgVXgYal5gjmwchuHxJVr4zOxHxfPvImrZniHDDXuJuATC1h4qQlc', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfoglaRdeBfYHV_Rqhy6V0OpX2pemE-YlxdpmRgy_3C8ZEVjwp6gyK-XfDFYmtXpJsLBE48CiflFoP2yAvXGUdlr0iZh0g', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfojhnbJMryxC2HOwz_Ek2tydOLzdQTvynbTfaR_N2vXRMfDnxQBppvnBjCW-DScTQKKUkytI6xOyqRBCk1Z4Z4eXL_owCk', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfoiYwCuF_2kpo674jSO7Qx5IpVjyd-_uJorWExZavT2jyrB8GS36erI2h9kFgYLwCInekTISNM9gykIZswvQ4SxPR9hAzw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfolX68uJtWXPwReKCDo6vOdfwaqN-UZs9FpX4SjCVgLqmiPUR4QzIvGNyLfPm-wrNwC2fpsWyjHcFcrAiXQqzgUCZzeVUk', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfokpv63ZoN0iHyfMZo1SVajHKX2otxF4ze0mmw9ssKUorC--5bMjSHBALhA8_D9UHGKj2OOYxT37CTzCZesDz5n2FzQW5U', + '活动不存在或已结束,试试其他活动吧~', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfomGcx4Npir_v8wdomXvxUIhXD-MeaCmqOkFaqPFcwbmTcV8FCVSBJg0gkVFrotgMRMOzJp-Gl10zmjugQGIIxalBb0HwA', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfopmj6UNaaQf1RH3-j34B_k37p3W_NWW_ll-iqiYn0HehoderoVHNUxSuwLceQWStwSWx2m27ix2Y8MkpHBQ5Lg0Jt3nQY', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfooaxiDKISznvTYePbE3lOzASLuXPP8XWysr1MAYZ0KVZ7_HKiPlCSOAmOC5Skxcti8s_5sFtRIORHkRAHrFjyTQNXpjAM', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUhzydZiUwrQA-YYMy56oIDc_oCnNI-N6oSpCbCu2qxRcRLqp6Kp1GEmoAWDwSpq_NZxhDsqZHsHlk0_8qL_yFlMFbrYCw', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUgZwLfqVLDdWMlTpUkB4of3IHJLvvSpytixo0m-Re4R396shpCtt8IbN3zXYy1pMMfbVZR7kPgi9BSK5ST8G_K0ZSrFZA', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUjoOIj6OgMFLBamYLJ3HW8ad1nqLoj1D6NmlFnkGuyAzY5HsOFhsraGonP2B1Tx2nuJPZuJAwapb43a0WxRkKA3HSsXA', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUiRpJ9C08JwP3F2pMpRSWrVmOFj-6wM3wvABiP3AxpYGI1tjr4XIYZkFeMeUstUeifdvNES7Sgx1XXsIVxcD8dlJ8FfqQ', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUlnpdQctIkBIPCE-KoLw6aLglNbHq1qUUBhiT_2BfEFqX0sCJOpxd2ucp_E6syRQ9mW8pSKuTNo7kInnVSO28uaC_LluE', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUkmXh_RTbFx8L_BcJVAtEU78aNcj1OdAsxsTxnDn5jpw72bkx064VI86qV0HpdCbeDo4qPptTDz1m5Ydxb7cxzmeZyWM4', + '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUnHohneTsnYM52nK570112qiiBTQKwEI-OLwFtqDgI2tM5zXpA_1AZDrYeFv4AczU53pMEPZBTWHeQMKWOqCrOrfM-AA' +] + + +//初始化 +function initial() { + merge = { + nickname: "", + enabled: true, + end: false + } + for (let i in merge) { + merge[i].success = 0; + merge[i].fail = 0; + merge[i].prizeCount = 0; + merge[i].notify = ""; + merge[i].show = true; + } +} +//通知 +function msgShow() { + let message = "京东账号:" +merge.nickname + "\n执行成功,请点击通知跳转APP查看!"; + let url ={ "open-url" : `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/4DEZi5iUgrNLD9EWknrGZhCjNv7V/index.html%22%20%7D`} + $.msg($.name, "", message, url); +} + + +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From 1587bfe36299529407611676286d136173e4ff0c Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 01:00:15 +0800 Subject: [PATCH 199/266] --- .github/workflows/jd_starStore.yml | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/jd_starStore.yml diff --git a/.github/workflows/jd_starStore.yml b/.github/workflows/jd_starStore.yml new file mode 100644 index 0000000000..fb28dd21ab --- /dev/null +++ b/.github/workflows/jd_starStore.yml @@ -0,0 +1,48 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: 京东星店长 + +on: + workflow_dispatch: + schedule: + - cron: '5 1 * * * ' + watch: + types: started + +jobs: + build: + + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + steps: + - uses: actions/checkout@v1 + - name: Use Node.js 10.x + uses: actions/setup-node@v1 + with: + node-version: 10.x + - name: npm install + run: | + npm install + npm install request + npm install --save got + npm install tough-cookie + - name: '京东星店长' + env: + COOKIE: ${{secrets.JD_COOKIE}} + TG_BOT_TOKEN : ${{secrets.TG_BOT_TOKEN}} + TG_USER_ID : ${{secrets.TG_USER_ID}} + REMOTE_URL: https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_starStore.js + MULT_CUSTOM_REPLACE: '[[{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-YTX'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-SR'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-LJ'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-ZGX'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-WJY'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-LJ2'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-RQ'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-WRX'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-GC'')"}], + [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-WSR'')"}] + ]' + run: | + node 'scripts/remote/runRemoteScripts.js' From d914f24ce988fb9fcc425d05db028eb7dd96fcb4 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 01:12:10 +0800 Subject: [PATCH 200/266] --- .github/workflows/jd_starStore.yml | 46 +++++++++++------------------- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/.github/workflows/jd_starStore.yml b/.github/workflows/jd_starStore.yml index fb28dd21ab..d722c15947 100644 --- a/.github/workflows/jd_starStore.yml +++ b/.github/workflows/jd_starStore.yml @@ -1,48 +1,36 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: 京东星店长 +name: 星店长 on: workflow_dispatch: schedule: - - cron: '5 1 * * * ' + - cron: '5 5 * * *' watch: types: started - jobs: build: - runs-on: ubuntu-latest if: github.event.repository.owner.id == github.event.sender.id + env: + JD_COOKIE: ${{ secrets.JD_COOKIE }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 10.x + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 10.x + node-version: 12.x - name: npm install run: | npm install - npm install request - npm install --save got - npm install tough-cookie - - name: '京东星店长' - env: - COOKIE: ${{secrets.JD_COOKIE}} - TG_BOT_TOKEN : ${{secrets.TG_BOT_TOKEN}} - TG_USER_ID : ${{secrets.TG_USER_ID}} - REMOTE_URL: https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_starStore.js - MULT_CUSTOM_REPLACE: '[[{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-YTX'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-SR'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-LJ'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-ZGX'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-WJY'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-LJ2'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-RQ'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-WRX'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-GC'')"}], - [{key : /const \$.+\(''(.+)''\);/,value : "const $ = new Env(''$1-WSR'')"}] - ]' + - name: '运行 【京东星店长】' + if: env.JD_COOKIE run: | - node 'scripts/remote/runRemoteScripts.js' + node Task/jd_starStore.js + env: + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file From 2a9d2cdfcaa07d6a949c95526831031c42ea1907 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 01:16:47 +0800 Subject: [PATCH 201/266] --- .github/workflows/jd_starStore.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jd_starStore.yml b/.github/workflows/jd_starStore.yml index d722c15947..76b3f16e5d 100644 --- a/.github/workflows/jd_starStore.yml +++ b/.github/workflows/jd_starStore.yml @@ -4,7 +4,7 @@ name: 星店长 on: workflow_dispatch: schedule: - - cron: '5 5 * * *' + - cron: '5 19 * * *' watch: types: started jobs: From 0addffc10cfe19f8d623a1ab7159421669dc86e1 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 16:12:15 +0800 Subject: [PATCH 202/266] --- .github/workflows/dianshijia.yml | 8 ++++++-- .github/workflows/jd_starStore.yml | 2 ++ .github/workflows/jingxi.yml | 14 +++++++++----- .github/workflows/midu_read.yml | 6 +++--- .github/workflows/txnews.yml | 6 +++--- .github/workflows/weibo.yml | 2 +- .github/workflows/youth.yml | 6 +++--- .github/workflows/youth_read.yml | 6 +++--- 8 files changed, 30 insertions(+), 20 deletions(-) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index e0d1117820..1693489c33 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -1,5 +1,5 @@ -name: dianshijia +name: 电视家 on: workflow_dispatch: @@ -15,17 +15,21 @@ jobs: DSJ_HEADERS: ${{ secrets.DSJ_HEADERS }} DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} steps: - - uses: actions/checkout@v1 + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts - name: Use Node.js 12.x uses: actions/setup-node@v1 with: node-version: 12.x - name: npm install run: | + cd ~/Scripts npm install - name: '运行 【电视家】' if: env.DSJ_HEADERS run: | + cd ~/Scripts node Task/dianshijia.js env: DSJ_NOTIFY_CONTROL: ${{ secrets.DSJ_NOTIFY_CONTROL }} diff --git a/.github/workflows/jd_starStore.yml b/.github/workflows/jd_starStore.yml index 76b3f16e5d..c6f932283c 100644 --- a/.github/workflows/jd_starStore.yml +++ b/.github/workflows/jd_starStore.yml @@ -21,10 +21,12 @@ jobs: node-version: 12.x - name: npm install run: | + cd ~/Scripts npm install - name: '运行 【京东星店长】' if: env.JD_COOKIE run: | + cd ~/Scripts node Task/jd_starStore.js env: PUSH_KEY: ${{ secrets.PUSH_KEY }} diff --git a/.github/workflows/jingxi.yml b/.github/workflows/jingxi.yml index 2c3b5b521a..8cbb06e88d 100644 --- a/.github/workflows/jingxi.yml +++ b/.github/workflows/jingxi.yml @@ -1,10 +1,10 @@ -name: jingxi +name: 京喜 on: workflow_dispatch: schedule: - - cron: '5 5 * * *' + - cron: '1 19 * * *' watch: types: started jobs: @@ -14,17 +14,21 @@ jobs: env: JD_COOKIE: ${{ secrets.JD_COOKIE }} steps: - - uses: actions/checkout@v1 - - name: Use Node.js 14.x + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 12.x - name: npm install run: | + cd ~/Scripts npm install - name: '运行 【京喜】' if: env.JD_COOKIE run: | + cd ~/Scripts node Task/jingxi.js env: PUSH_KEY: ${{ secrets.PUSH_KEY }} diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 4889afdd9d..589ce204c0 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -1,7 +1,7 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: midu_read +name: 米读 on: workflow_dispatch: @@ -17,10 +17,10 @@ jobs: MIDU_SIGN: ${{ secrets.MIDU_SIGN }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 14.x + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 12.x - name: npm install run: | npm install diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index 8705933cee..cf42dfb3d4 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -4,7 +4,7 @@ # branches: # - master -name: txnews +name: 腾讯新闻 on: workflow_dispatch: @@ -23,10 +23,10 @@ jobs: TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 14.x + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 12.x - name: npm install run: | npm install diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml index f9f24e7a70..a031e72a7c 100644 --- a/.github/workflows/weibo.yml +++ b/.github/workflows/weibo.yml @@ -1,5 +1,5 @@ -name: weibo +name: 微博每日签到打卡 on: workflow_dispatch: diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index afad4ea1db..53ea0e87a3 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -1,7 +1,7 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: youth +name: 中青看点 on: workflow_dispatch: @@ -21,10 +21,10 @@ jobs: YOUTH_TIME: ${{ secrets.YOUTH_TIME }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 14.x + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 12.x - name: npm install if: env.YOUTH_HEADER run: | diff --git a/.github/workflows/youth_read.yml b/.github/workflows/youth_read.yml index c6ddde2278..00d2678d9c 100644 --- a/.github/workflows/youth_read.yml +++ b/.github/workflows/youth_read.yml @@ -1,7 +1,7 @@ # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions -name: youth_read +name: 中青自动阅读 on: workflow_dispatch: @@ -20,10 +20,10 @@ jobs: YOUTH_READ4: ${{ secrets.YOUTH_READ4 }} steps: - uses: actions/checkout@v1 - - name: Use Node.js 14.x + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 12.x - name: npm install run: | npm install From 7b890d538b8d9c7c7ee2083fd5799abf2abc5261 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 16:28:20 +0800 Subject: [PATCH 203/266] --- .github/workflows/jd_starStore.yml | 4 +++- .github/workflows/midu_read.yml | 6 +++++- .github/workflows/txnews.yml | 6 +++++- .github/workflows/weibo.yml | 10 +++++++--- .github/workflows/youth.yml | 6 +++++- 5 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/jd_starStore.yml b/.github/workflows/jd_starStore.yml index c6f932283c..3d6f899011 100644 --- a/.github/workflows/jd_starStore.yml +++ b/.github/workflows/jd_starStore.yml @@ -14,7 +14,9 @@ jobs: env: JD_COOKIE: ${{ secrets.JD_COOKIE }} steps: - - uses: actions/checkout@v1 + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts - name: Use Node.js 12.x uses: actions/setup-node@v1 with: diff --git a/.github/workflows/midu_read.yml b/.github/workflows/midu_read.yml index 589ce204c0..0443355d7b 100644 --- a/.github/workflows/midu_read.yml +++ b/.github/workflows/midu_read.yml @@ -16,17 +16,21 @@ jobs: MIDU_TIME: ${{ secrets.MIDU_TIME }} MIDU_SIGN: ${{ secrets.MIDU_SIGN }} steps: - - uses: actions/checkout@v1 + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts - name: Use Node.js 12.x uses: actions/setup-node@v1 with: node-version: 12.x - name: npm install run: | + cd ~/Scripts npm install - name: '运行 【米读自动阅读】' if: env.MIDU_TOKEN run: | + cd ~/Scripts node Task/midu_Read.js env: PUSH_KEY: ${{ secrets.PUSH_KEY }} diff --git a/.github/workflows/txnews.yml b/.github/workflows/txnews.yml index cf42dfb3d4..c331ed5a9c 100644 --- a/.github/workflows/txnews.yml +++ b/.github/workflows/txnews.yml @@ -22,17 +22,21 @@ jobs: TXNEWS_COOKIE: ${{ secrets.TXNEWS_COOKIE }} TXNEWS_VIDEO: ${{ secrets.TXNEWS_VIDEO }} steps: - - uses: actions/checkout@v1 + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts - name: Use Node.js 12.x uses: actions/setup-node@v1 with: node-version: 12.x - name: npm install run: | + cd ~/Scripts npm install - name: '运行 【腾讯新闻】' if: env.TXNEWS_COOKIE run: | + cd ~/Scripts node Task/txnews.js env: PUSH_KEY: ${{ secrets.PUSH_KEY }} diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml index a031e72a7c..b43e809d0c 100644 --- a/.github/workflows/weibo.yml +++ b/.github/workflows/weibo.yml @@ -15,18 +15,22 @@ jobs: WB_TOKEN: ${{ secrets.WB_TOKEN }} WB_PAY: ${{ secrets.WB_PAY }} steps: - - uses: actions/checkout@v1 - - name: Use Node.js 14.x + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Script + - name: Use Node.js 12.x uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 12.x - name: npm install if: env.WB_TOKEN run: | + cd ~/Scripts npm install - name: '运行 【新浪微博】' if: env.WB_TOKEN run: | + cd ~/Scripts node Task/weibo.js env: PUSH_KEY: ${{ secrets.PUSH_KEY }} diff --git a/.github/workflows/youth.yml b/.github/workflows/youth.yml index 53ea0e87a3..02508da39a 100644 --- a/.github/workflows/youth.yml +++ b/.github/workflows/youth.yml @@ -20,7 +20,9 @@ jobs: YOUTH_REDBODY: ${{ secrets.YOUTH_REDBODY }} YOUTH_TIME: ${{ secrets.YOUTH_TIME }} steps: - - uses: actions/checkout@v1 + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts - name: Use Node.js 12.x uses: actions/setup-node@v1 with: @@ -28,10 +30,12 @@ jobs: - name: npm install if: env.YOUTH_HEADER run: | + cd ~/Scripts npm install - name: '运行 【中青看点】' if: env.YOUTH_HEADER run: | + cd ~/Scripts node Task/youth.js env: YOUTH_NOTIFY_CONTROL: ${{ secrets.YOUTH_NOTIFY_CONTROL }} From ece65f466f23657d414f36aae717495b0a9b6338 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 16:53:52 +0800 Subject: [PATCH 204/266] --- Task/jingxi.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Task/jingxi.js b/Task/jingxi.js index fae87ebc4d..3458ff1d1e 100644 --- a/Task/jingxi.js +++ b/Task/jingxi.js @@ -75,6 +75,10 @@ function getsign() { } } else if (signres.retCode == '30003') { $.msg($.name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + if($.isNode()){ + await notify.sendNotify($.name + " 账号" + $.index+ `\n【提示】京东cookie已失效,请重新登录获取`) + } + return } resolve() }) From 8891d18e2a302c6e5dcd6871fbf417f4f89e7ab0 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 16:55:38 +0800 Subject: [PATCH 205/266] --- Task/jingxi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/jingxi.js b/Task/jingxi.js index 3458ff1d1e..85485f3b1d 100644 --- a/Task/jingxi.js +++ b/Task/jingxi.js @@ -60,7 +60,7 @@ function getsign() { Referer: "https://wqsh.jd.com/pingou/taskcenter/index.html" }, } - $.get(signurl, (err, resp, data) => { + $.get(signurl, async(err, resp, data) => { signres = JSON.parse(data) if (signres.retCode == '0') { nickname = signres.data.nickname From a4d8b773b51be192ddf0307749ecac4918fe57a7 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 17:01:32 +0800 Subject: [PATCH 206/266] --- Task/jingxi.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/jingxi.js b/Task/jingxi.js index 85485f3b1d..3b5efa85e1 100644 --- a/Task/jingxi.js +++ b/Task/jingxi.js @@ -76,7 +76,7 @@ function getsign() { } else if (signres.retCode == '30003') { $.msg($.name, '【提示】京东cookie已失效,请重新登录获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); if($.isNode()){ - await notify.sendNotify($.name + " 账号" + $.index+ `\n【提示】京东cookie已失效,请重新登录获取`) + await notify.sendNotify($.name + " 账号" + $.index, `【提示】京东cookie已失效,请重新登录获取`) } return } From 56418383394487219dc484930ba451dcfc43ccf2 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 17:21:50 +0800 Subject: [PATCH 207/266] --- Task/sendNotify.js | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Task/sendNotify.js b/Task/sendNotify.js index c6b8e9d8ed..fa5f091c2b 100644 --- a/Task/sendNotify.js +++ b/Task/sendNotify.js @@ -96,13 +96,13 @@ function serverNotify(text, desp) { $.post(options, (err, resp, data) => { try { if (err) { - console.log('\n发送通知调用API失败!!\n') + console.log('\n发送通知调用API失败!!') } else { data = JSON.parse(data); if (data.errno === 0) { - console.log('\nserver酱发送通知消息成功\n') + console.log('\nserver酱发送通知消息成功') } else if (data.errno === 1024) { - console.log('\nPUSH_KEY 错误\n') + console.log('\nPUSH_KEY 错误') } } } catch (e) { @@ -112,7 +112,7 @@ function serverNotify(text, desp) { } }) } else { - console.log('\n您未提供server酱的SCKEY,取消微信推送消息通知\n'); + console.log('\n您未提供server酱的SCKEY,取消微信推送消息通知'); resolve() } }) @@ -127,13 +127,13 @@ function BarkNotify(text, desp) { $.get(options, (err, resp, data) => { try { if (err) { - console.log('\nBark APP发送通知调用API失败!!\n') + console.log('\nBark APP发送通知调用API失败!!') } else { data = JSON.parse(data); if (data.code === 200) { - console.log('\nBark APP发送通知消息成功\n') + console.log('\nBark APP发送通知消息成功') } else { - console.log(`\n${data.message}\n`); + console.log(`\n${data.message}`); } } } catch (e) { @@ -143,7 +143,7 @@ function BarkNotify(text, desp) { } }) } else { - console.log('\n您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知\n'); + console.log('\n您未提供Bark的APP推送BARK_PUSH,取消Bark推送消息通知'); resolve() } }) @@ -162,15 +162,15 @@ function tgBotNotify(text, desp) { $.post(options, (err, resp, data) => { try { if (err) { - console.log('\ntelegram发送通知消息失败!!\n') + console.log('\ntelegram发送通知消息失败!!') } else { data = JSON.parse(data); if (data.ok) { - console.log('\nTelegram发送通知消息完成。\n') + console.log('\nTelegram发送通知消息完成。') } else if (data.error_code === 400) { - console.log('\n请主动给bot发送一条消息并检查接收用户ID是否正确。\n') + console.log('\n请主动给bot发送一条消息并检查接收用户ID是否正确。') } else if (data.error_code === 401){ - console.log('\nTelegram bot token 填写错误。\n') + console.log('\nTelegram bot token 填写错误。') } } } catch (e) { @@ -180,7 +180,7 @@ function tgBotNotify(text, desp) { } }) } else { - console.log('\n您未提供telegram机器人推送所需的TG_BOT_TOKEN和TG_USER_ID,取消telegram推送消息通知\n'); + console.log('\n您未提供telegram机器人推送所需的TG_BOT_TOKEN和TG_USER_ID,取消telegram推送消息通知'); resolve() } }) @@ -209,14 +209,14 @@ function ddBotNotify(text, desp) { $.post(options, (err, resp, data) => { try { if (err) { - console.log('\n钉钉发送通知消息失败!!\n') + console.log('\n钉钉发送通知消息失败!!') console.log(err); } else { data = JSON.parse(data); if (data.errcode === 0) { - console.log('\n钉钉发送通知消息完成。\n') + console.log('\n钉钉发送通知消息完成。') } else { - console.log(`\n${data.errmsg}\n`) + console.log(`\n${data.errmsg}`) } } } catch (e) { @@ -229,14 +229,14 @@ function ddBotNotify(text, desp) { $.post(options, (err, resp, data) => { try { if (err) { - console.log('\n钉钉发送通知消息失败!!\n') + console.log('\n钉钉发送通知消息失败!!') console.log(err); } else { data = JSON.parse(data); if (data.errcode === 0) { - console.log('\n钉钉发送通知消息完成。\n') + console.log('\n钉钉发送通知消息完成。') } else { - console.log(`\n${data.errmsg}\n`) + console.log(`\n${data.errmsg}`) } } } catch (e) { @@ -246,7 +246,7 @@ function ddBotNotify(text, desp) { } }) } else { - console.log('\n您未提供钉钉机器人推送所需的DD_BOT_TOKEN或者DD_BOT_SECRET,取消钉钉推送消息通知\n'); + console.log('\n您未提供钉钉机器人推送所需的DD_BOT_TOKEN或者DD_BOT_SECRET,取消钉钉推送消息通知'); resolve() } }) From 88225934c111d43c3d0fcc6508382ab55b17a175 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:08:49 +0800 Subject: [PATCH 208/266] --- Task/dianshijia.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 10d906f10f..f3717b4ddd 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -47,7 +47,7 @@ const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; let RewardId = $.getdata('REWARD')||'55'; //额外签到奖励,默认55为兑换0.2元额度,44为兑换1天VIP,42为兑换1888金币 const dianshijia_API = 'http://api.gaoqingdianshi.com/api' -let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalVal,CountMax,CompCount; +let tokenArr = [], DsjurlArr = [], DrawalArr = [],CountMax,CompCount; if ($.isNode()) { if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.indexOf('#') > -1) { Dsjheaders = process.env.DSJ_HEADERS.split('#'); @@ -106,7 +106,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await signinfo(); // 签到信息 await Addsign(); // 额外奖励,默认额度 if (drawalVal != undefined){ - await Withdrawal() + await Withdrawal() } else { detail += `【金额提现】❌ 请获取提现地址 \n` };// 金额提现 @@ -305,15 +305,15 @@ function dotask(code) { CompCount = taskres.data.dayCompCount CountMax = taskres.data.dayDoCountMax console.log('任务代码:'+code+',获得金币:'+taskres.data.getCoin) - if (code== 'playTask'&&taskres.data.doneStatus == 3) { + if ( code == 'playTask'&&taskres.data.doneStatus == 3) { detail += `【播放任务】🔕 完成/共计 `+CompCount+`/`+CountMax+` 次\n` } } else if (taskcode == '4000'){ //console.log('任务代码:'+code+','+taskres.msg) } - resolve() }) + resolve() }) } @@ -486,8 +486,8 @@ function getGametime() { } $.get(url, (error, response, data) => { if(logs)$.log(`游戏时长: ${data}\n`) - resolve() }) + resolve() }) } function Addsign() { @@ -498,8 +498,8 @@ function Addsign() { } $.get(url, (error, response, data) => { if(logs)$.log(`额外签到: ${data}\n`) - resolve() }) + resolve() }) } From b6577cc47c6a4c63387fe0b0d7b94313fea37d4a Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:23:20 +0800 Subject: [PATCH 209/266] --- Task/dianshijia.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index f3717b4ddd..c3bd575a41 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-11-03 20:40 +更新时间: 2020-11-04 21:20 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 本脚本仅适用于电视家签到,支持Actions多账号运行,请用'#'或者换行隔开‼️ 获取Cookie方法: @@ -250,8 +250,10 @@ function cash() { { if(logs)$.log(`现金: ${data}\n`) let cashresult = JSON.parse(data) - subTitle += '现金:'+ cashresult.data.amount/100+'元 额度:'+cashresult.data.withdrawalQuota/100+'元' - cashtotal = cashresult.data.totalWithdrawn/100 + if(cashresult.errCode=="0"){ + subTitle += '现金:'+ cashresult.data.amount/100+'元 额度:'+cashresult.data.withdrawalQuota/100+'元' + cashtotal = cashresult.data.totalWithdrawn/100 + } resolve() }) }) @@ -274,7 +276,7 @@ function cashlist() { if(cashres&&cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` } - else if(cashtotal){ + else if(!cashres&&cashtotal){ detail += `【提现结果】今日未提现 共计提现:`+cashtotal+`元\n` } } @@ -282,8 +284,7 @@ function cashlist() { } catch (e){ console.log(`提现列表失败,可忽略: ${data}`) - resolve() - } + } }) }) } @@ -462,15 +463,15 @@ function getCUpcoin() { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/taskext/getCoin?code=carveUp&coin=0&ext=1`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs) $.log(`瓜分百万金币: ${data}`) - resolve() }) + resolve() }) } function Withdrawal() { return new Promise((resolve, reject) => { $.get({url: drawalVal, headers: JSON.parse(signheaderVal)}, (error, response, data) => { if(logs)$.log(`金币随机兑换 : ${data}\n`) - const result = JSON.parse(data) + let result = JSON.parse(data) if (result.errCode == 0) { detail += `【金额提现】✅ 到账`+result.data.price/100+`元 🌷\n` } From e7c84a594a040bac1f170667160b8b3ceed38a6c Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:27:14 +0800 Subject: [PATCH 210/266] --- Task/dianshijia.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index c3bd575a41..2582a53c5c 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -273,7 +273,8 @@ function cashlist() { cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } } - if(cashres&&cashtotal){ + console.log(cashtotal+cashres) + if(cashres && cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` } else if(!cashres&&cashtotal){ From b2de4ba868f3a373552bfe39139bf9f5b60cdb69 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:30:32 +0800 Subject: [PATCH 211/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 2582a53c5c..39b76d9ba7 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -272,8 +272,8 @@ function cashlist() { (result.data[i].type==2&&result.data[i].ctime>=time){ cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } + console.log(cashres) } - console.log(cashtotal+cashres) if(cashres && cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` } From 4eb3f447985f7b210481ab3e9f69ed1eae1d6f21 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:32:41 +0800 Subject: [PATCH 212/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 39b76d9ba7..ac4d35b833 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -270,9 +270,9 @@ function cashlist() { for (i=0;i=time){ + console.log(result.data[i].amount) cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } - console.log(cashres) } if(cashres && cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` From 023f02b3dc81efee13000ad7f1de39f7d47255c3 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:35:04 +0800 Subject: [PATCH 213/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index ac4d35b833..9e9fe3b56f 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -268,9 +268,9 @@ function cashlist() { try{ if (result.errCode == 0) { for (i=0;i=time){ - console.log(result.data[i].amount) cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } } From 5af0e384c7c46dca955fc13c4552d76552a08c74 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:39:47 +0800 Subject: [PATCH 214/266] --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 9e9fe3b56f..5bea9b0f7a 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -268,9 +268,9 @@ function cashlist() { try{ if (result.errCode == 0) { for (i=0;i=time){ +(result.data[i].type == 2 && result.data[i].ctime >= time){ cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } } From d7628a2c0cf2a730085a25b15603678c51627462 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:42:47 +0800 Subject: [PATCH 215/266] --- Task/dianshijia.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 5bea9b0f7a..b8ae6e98c9 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -263,14 +263,15 @@ function cashlist() { $.get({ url: `${dianshijia_API}/cash/detail`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { let result = JSON.parse(data) - let totalcash = Number(),cashres = "" - var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + let totalcash = Number(),cashres = ""; + var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 try{ if (result.errCode == 0) { for (i=0;i= time){ +(result.data[i].type == '2' && result.data[i].ctime >= time ){ + console.log(result.data[i].amount) cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } } From 17bd8d58758bb55cd5672e0224281029ed4f3de2 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:46:00 +0800 Subject: [PATCH 216/266] --- Task/dianshijia.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index b8ae6e98c9..d24dfebdb0 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -268,7 +268,9 @@ function cashlist() { try{ if (result.errCode == 0) { for (i=0;i= time && result.data[i].type == '2'){ + console.log(result.data[i].ctime) + } if (result.data[i].type == '2' && result.data[i].ctime >= time ){ console.log(result.data[i].amount) From 13d02b4fc211bebf442ec590b014ffeb59b79180 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:46:37 +0800 Subject: [PATCH 217/266] --- Task/dianshijia.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index d24dfebdb0..05fd9afc3d 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -270,13 +270,13 @@ function cashlist() { for (i=0;i= time && result.data[i].type == '2'){ console.log(result.data[i].ctime) - } + }; if (result.data[i].type == '2' && result.data[i].ctime >= time ){ console.log(result.data[i].amount) cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` - } - } + }, + }; if(cashres && cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` } From 108c63a80f1c2dfcc3627970ba1e6e918cb17fc4 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 21:48:23 +0800 Subject: [PATCH 218/266] --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 05fd9afc3d..43af87a92b 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -273,9 +273,9 @@ function cashlist() { }; if (result.data[i].type == '2' && result.data[i].ctime >= time ){ - console.log(result.data[i].amount) + console.log(result.data[i].amount); cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` - }, + } }; if(cashres && cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` From 2ddb6f03d118f40378704b4e2496c36194744423 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 22:03:59 +0800 Subject: [PATCH 219/266] --- Task/dianshijia.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 43af87a92b..67251fbe30 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -96,6 +96,11 @@ if (isGetCookie = typeof $request !== 'undefined') { return; } console.log(`------------- 共${tokenArr.length}个账号`) + if($.isNode()){ + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-28800 + } else { + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + } for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { signheaderVal = tokenArr[i]; @@ -264,17 +269,12 @@ function cashlist() { headers: JSON.parse(signheaderVal)}, (error, response, data) => { let result = JSON.parse(data) let totalcash = Number(),cashres = ""; - var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 try{ if (result.errCode == 0) { for (i=0;i= time && result.data[i].type == '2'){ - console.log(result.data[i].ctime) - }; if (result.data[i].type == '2' && result.data[i].ctime >= time ){ - console.log(result.data[i].amount); - cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` + cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } }; if(cashres && cashtotal){ @@ -386,7 +386,6 @@ function coinlist() { let result = JSON.parse(data) let onlamount = 0, vdamount = 0, gamestime = 0, todaysign = 0; - var time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 try { for (i=0;i= time;i++){ if (result.data[i].from=="领取走路金币"){ From 203e5950d2419a3efbf5a3f8992f66ed68375d43 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 22:22:29 +0800 Subject: [PATCH 220/266] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=94=B5=E8=A7=86?= =?UTF-8?q?=E5=AE=B6=E6=97=B6=E5=8C=BA=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Task/dianshijia.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 67251fbe30..ba622f024f 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-11-04 21:20 +更新时间: 2020-11-04 22:20 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 本脚本仅适用于电视家签到,支持Actions多账号运行,请用'#'或者换行隔开‼️ 获取Cookie方法: @@ -96,8 +96,8 @@ if (isGetCookie = typeof $request !== 'undefined') { return; } console.log(`------------- 共${tokenArr.length}个账号`) - if($.isNode()){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-28800 + if(new Date().getTimezoneOffset()/60 != `-8`){ + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-(0-new Date().getTimezoneOffset()*60) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From 5e21a499d7d18eeb2d80e6e41041df5d2d249c15 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 22:31:38 +0800 Subject: [PATCH 221/266] --- Task/dianshijia.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index ba622f024f..b32fd7079a 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -98,6 +98,8 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != `-8`){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-(0-new Date().getTimezoneOffset()*60) + + console.log(time) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From dc8b545f1b6873ee76db54414eb866830408e022 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 22:32:24 +0800 Subject: [PATCH 222/266] --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index b32fd7079a..3e890da024 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -96,8 +96,8 @@ if (isGetCookie = typeof $request !== 'undefined') { return; } console.log(`------------- 共${tokenArr.length}个账号`) - if(new Date().getTimezoneOffset()/60 != `-8`){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-(0-new Date().getTimezoneOffset()*60) + if(new Date().getTimezoneOffset()/60 != '-8'){ + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + new Date().getTimezoneOffset()*60 console.log(time) } else { From 991520d17eb66812b40151a1e0ab095a5c650615 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 22:38:24 +0800 Subject: [PATCH 223/266] --- Task/dianshijia.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 3e890da024..fb5518664c 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -97,8 +97,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + new Date().getTimezoneOffset()*60 - + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + Number(new Date().getTimezoneOffset()*60) console.log(time) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 From ec24a5b245ec3f9f0ca04809afd2427a051614fe Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 23:06:56 +0800 Subject: [PATCH 224/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index fb5518664c..b44fefe7ed 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -97,7 +97,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + Number(new Date().getTimezoneOffset()*60) + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 console.log(time) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 From baddeb85cec7971780ebb52e2822548cb27d0de8 Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 23:28:27 +0800 Subject: [PATCH 225/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index b44fefe7ed..0b442e98e7 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -98,7 +98,7 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 - console.log(time) + console.log(new Date().getTimezoneOffset()*60) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From de1b6cff90ccb56a8873b3c888a8853a86b00f7e Mon Sep 17 00:00:00 2001 From: Best Date: Wed, 4 Nov 2020 23:39:41 +0800 Subject: [PATCH 226/266] --- Task/dianshijia.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 0b442e98e7..4571e1d251 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -97,8 +97,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 - console.log(new Date().getTimezoneOffset()*60) + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-8*60*60 } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From c5bedf08db4074b469f813bda4724273cb272535 Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 5 Nov 2020 10:20:11 +0800 Subject: [PATCH 227/266] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BE=AE=E5=8D=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/weibo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/weibo.yml b/.github/workflows/weibo.yml index b43e809d0c..8212569a5f 100644 --- a/.github/workflows/weibo.yml +++ b/.github/workflows/weibo.yml @@ -17,7 +17,7 @@ jobs: steps: - name: Checkout run: | - git clone https://github.com/Sunert/Scripts.git ~/Script + git clone https://github.com/Sunert/Scripts.git ~/Scripts - name: Use Node.js 12.x uses: actions/setup-node@v1 with: From 5d28a86c600da8c4017d808f059d44313bff7a6c Mon Sep 17 00:00:00 2001 From: Best Date: Thu, 5 Nov 2020 19:28:47 +0800 Subject: [PATCH 228/266] --- .github/workflows/jd_ timeMachine.yml | 40 +++ .github/workflows/jd_lotteryMachine.yml | 40 +++ .github/workflows/jd_rankingList.yml | 40 +++ .github/workflows/jd_starStore.yml | 2 +- Task/jd_lotteryMachine.js | 281 +++++++++++++++++++ Task/jd_rankingList.js | 228 +++++++++++++++ Task/jd_starStore.js | 25 +- Task/jd_timeMachine.js | 356 ++++++++++++++++++++++++ 8 files changed, 999 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/jd_ timeMachine.yml create mode 100644 .github/workflows/jd_lotteryMachine.yml create mode 100644 .github/workflows/jd_rankingList.yml create mode 100644 Task/jd_lotteryMachine.js create mode 100644 Task/jd_rankingList.js create mode 100644 Task/jd_timeMachine.js diff --git a/.github/workflows/jd_ timeMachine.yml b/.github/workflows/jd_ timeMachine.yml new file mode 100644 index 0000000000..332d52373f --- /dev/null +++ b/.github/workflows/jd_ timeMachine.yml @@ -0,0 +1,40 @@ + +name: 京东时光机 + +on: + workflow_dispatch: + schedule: + - cron: '15 */4 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + env: + JD_COOKIE: ${{ secrets.JD_COOKIE }} + steps: + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: | + cd ~/Scripts + npm install + - name: '运行 【京东时光机】' + if: env.JD_COOKIE + run: | + cd ~/Scripts + node Task/jd_timeMachine.js + env: + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/.github/workflows/jd_lotteryMachine.yml b/.github/workflows/jd_lotteryMachine.yml new file mode 100644 index 0000000000..03d250ff0f --- /dev/null +++ b/.github/workflows/jd_lotteryMachine.yml @@ -0,0 +1,40 @@ + +name: 京东抽奖机 + +on: + workflow_dispatch: + schedule: + - cron: '8 16 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + env: + JD_COOKIE: ${{ secrets.JD_COOKIE }} + steps: + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: | + cd ~/Scripts + npm install + - name: '运行 【京东抽奖机】' + if: env.JD_COOKIE + run: | + cd ~/Scripts + node Task/jd_lotteryMachine.js + env: + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/.github/workflows/jd_rankingList.yml b/.github/workflows/jd_rankingList.yml new file mode 100644 index 0000000000..a8c5967275 --- /dev/null +++ b/.github/workflows/jd_rankingList.yml @@ -0,0 +1,40 @@ + +name: 京东排行榜 + +on: + workflow_dispatch: + schedule: + - cron: '10 16 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + env: + JD_COOKIE: ${{ secrets.JD_COOKIE }} + steps: + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: | + cd ~/Scripts + npm install + - name: '运行 【京东排行榜】' + if: env.JD_COOKIE + run: | + cd ~/Scripts + node Task/jd_rankingList.js + env: + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/.github/workflows/jd_starStore.yml b/.github/workflows/jd_starStore.yml index 3d6f899011..575a5210d4 100644 --- a/.github/workflows/jd_starStore.yml +++ b/.github/workflows/jd_starStore.yml @@ -4,7 +4,7 @@ name: 星店长 on: workflow_dispatch: schedule: - - cron: '5 19 * * *' + - cron: '5 16 * * *' watch: types: started jobs: diff --git a/Task/jd_lotteryMachine.js b/Task/jd_lotteryMachine.js new file mode 100644 index 0000000000..31cb666e9f --- /dev/null +++ b/Task/jd_lotteryMachine.js @@ -0,0 +1,281 @@ +/* +京东抽奖机 +更新时间:2020-11-05 16:06 +脚本说明: +脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js +// quantumultx +[task_local] +#京东抽奖机 +11 1 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_lotteryMachine.js, tag=京东抽奖机, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true +// Loon +[Script] +cron "11 1 * * *" script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_lotteryMachine.js,tag=京东抽奖机 +// Surge +京东抽奖机 = type=cron,cronexp=11 1 * * *,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_lotteryMachine.js + */ +const $ = new Env('京东抽奖机'); +//Node.js用户请在jdCookie.js处填写京东ck; +const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; +const STRSPLIT = "|"; +const needSum = false; //是否需要显示汇总 +$.isMuteLog = true //是否显示出参详情 +//IOS等用户直接用NobyDa的jd cookie +let cookiesArr = [], cookie = ''; +if ($.isNode()) { + Object.keys(jdCookieNode).forEach((item) => { + cookiesArr.push(jdCookieNode[item]) + }) +} else { + cookiesArr.push($.getdata('CookieJD')); + cookiesArr.push($.getdata('CookieJD2')); +} + +const JD_API_HOST = `https://api.m.jd.com/client.action`; +!(async () => { + if (!cookiesArr[0]) { + $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + return; + } + for (let i = 0; i < cookiesArr.length; i++) { + cookie = cookiesArr[i]; + if (cookie) { + if (i) console.log(`\n***************开始京东账号${i + 1}***************`) + initial(); + await QueryJDUserInfo(); + if (!merge.enabled) //cookie不可用 + { + $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。 + $.msg($.name, `【提示】京东账号${i + 1} cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + continue; + } + await interact_template_getHomeData(); + await interact_template_getLotteryResult(); + await msgShow(); + } + } +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + + +//获取昵称 +function QueryJDUserInfo(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, + headers : { + 'Referer' : `https://wqs.jd.com/my/iserinfo.html`, + 'Cookie' : cookie + } + } + $.get(url, (err, resp, data) => { + try { + data = JSON.parse(data); + if (data.retcode === 13) { + merge.enabled = false + return + } + merge.nickname = data.base.nickname; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +function interact_template_getHomeData(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=interact_template_getHomeData&body={"appId":"1EFRQxQ","taskToken":""}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + if (!$.isMuteLog) console.log(data); + data = JSON.parse(data); + + for (let i = 0;i < data.data.result.taskVos.length;i ++) { + console.log("\n" + data.data.result.taskVos[i].taskType + '-' + data.data.result.taskVos[i].taskName + '-' + (data.data.result.taskVos[i].status === 1 ? `已完成${data.data.result.taskVos[i].times}-未完成${data.data.result.taskVos[i].maxTimes}` : "全部已完成")) + //签到 + if (data.data.result.taskVos[i].taskType === 13) { + if (data.data.result.taskVos[i].status === 1) { + await harmony_collectScore(data.data.result.taskVos[i].simpleRecordInfoVo.taskToken,data.data.result.taskVos[i].taskId); + } + continue + } + if (data.data.result.taskVos[i].taskType === 14) {//'data.data.result.taskVos[i].assistTaskDetailVo.taskToken' + await harmony_collectScore('P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0',data.data.result.taskVos[i].taskId); + continue + } + let list = data.data.result.taskVos[i].productInfoVos || data.data.result.taskVos[i].followShopVo || data.data.result.taskVos[i].shoppingActivityVos || data.data.result.taskVos[i].browseShopVo + for (let k = data.data.result.taskVos[i].times; k < data.data.result.taskVos[i].maxTimes; k++) { + for (let j in list) { + if (list[j].status === 1) { + //console.log(list[j].simpleRecordInfoVo||list[j].assistTaskDetailVo) + console.log("\n" + (list[j].title || list[j].shopName||list[j].skuName)) + await harmony_collectScore(list[j].taskToken,data.data.result.taskVos[i].taskId); + list[j].status = 2; + break; + } else { + continue; + } + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +function harmony_collectScore(taskToken,taskId,timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html?inviteId=P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0`,//?inviteId=P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=harmony_collectScore&body={"appId":"1EFRQxQ","taskToken":"${taskToken}","taskId":${taskId},"actionType":0}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + if (!$.isMuteLog) console.log(data); + data = JSON.parse(data); + console.log(data.data.bizMsg) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} +// +function interact_template_getLotteryResult(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html?inviteId=P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0`,//?inviteId=P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=interact_template_getLotteryResult&body={"appId":"1EFRQxQ"}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + if (!$.isMuteLog) console.log(data); + if (!timeout) console.log('\n开始抽奖') + data = JSON.parse(data); + if (data.data.bizCode === 0) { + merge.jdBeans.success++; + if (data.data.result.userAwardsCacheDto.jBeanAwardVo&&data.data.result.userAwardsCacheDto.jBeanAwardVo.prizeName === "京豆") { + console.log(data.data.result.userAwardsCacheDto.jBeanAwardVo.prizeName + ':' + data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity) + merge.jdBeans.prizeCount += parseInt(data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity) + } + if (parseInt(data.data.result.userScore) >= 400 ) { + await interact_template_getLotteryResult(1000) + } + } else{ + merge.jdBeans.fail++; + console.log(data.data.bizMsg) + if (data.data.bizCode === 111 ) data.data.bizMsg = "无机会" + merge.jdBeans.notify = `${data.data.bizMsg}`; + } + + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//初始化 +function initial() { + merge = { + nickname: "", + enabled: true, + //blueCoin: {prizeDesc : "收取|蓝币|个",number : true}, //定义 动作|奖励名称|奖励单位 是否是数字 + jdBeans: {prizeDesc : "抽得|京豆|个",number : true,fixed : 0} + } + for (let i in merge) { + merge[i].success = 0; + merge[i].fail = 0; + merge[i].prizeCount = 0; + merge[i].notify = ""; + merge[i].show = true; + } + //merge.jdBeans.show =Boolean(coinToBeans); +} +//通知 +function msgShow() { + let message = ""; + let url ={ "open-url" : `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html%22%20%7D`} + let title = `京东账号:${merge.nickname}`; + for (let i in merge) { + if (typeof (merge[i]) !== "object" || !merge[i].show) continue; + if (merge[i].notify.split("").reverse()[0] === "\n") merge[i].notify = merge[i].notify.substr(0,merge[i].notify.length - 1); + message += `${merge[i].prizeDesc.split(STRSPLIT)[0]}${merge[i].prizeDesc.split(STRSPLIT)[1]}:` + (merge[i].success ? `${merge[i].prizeCount.toFixed(merge[i].fixed)}${merge[i].prizeDesc.split(STRSPLIT)[2]}\n` : `失败:${merge[i].notify}\n`) + } +//合计 + if (needSum) + { + $.sum = {}; + for (let i in merge) { + if (typeof (merge[i]) !== "object" || !merge[i].show) continue; + if (typeof ($.sum[merge[i].prizeDesc.split(STRSPLIT)[1]]) === "undefined") $.sum[merge[i].prizeDesc.split(STRSPLIT)[1]] = {count : 0}; + $.sum[merge[i].prizeDesc.split(STRSPLIT)[1]].count += merge[i].prizeCount; + } + message += `合计:` + for (let i in $.sum) + { + message += `${$.sum[i].count.toFixed($.sum[i].fixed)}${i},` + } + } + message += `请点击通知跳转至APP查看` + //message = message.substr(0,message.length - 1); + $.msg($.name, title, message, url); +} + + + +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/jd_rankingList.js b/Task/jd_rankingList.js new file mode 100644 index 0000000000..9578098cad --- /dev/null +++ b/Task/jd_rankingList.js @@ -0,0 +1,228 @@ +/* +京东排行榜 +更新时间:2020-11-05 16:07 +脚本说明:京东排行榜签到得京豆 +活动入口:找不着了,点击脚本通知进入吧 +脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js +// quantumultx +[task_local] +#京东排行榜 +11 9 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_rankingList.js, tag=京东排行榜, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true +// Loon +[Script] +cron "11 9 * * *" script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_rankingList.js,tag=京东排行榜 +// Surge +京东排行榜 = type=cron,cronexp=11 9 * * *,wake-system=1,timeout=20,script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_rankingList.js + */ +const $ = new Env('京东排行榜'); +//Node.js用户请在jdCookie.js处填写京东ck; +const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; +const needSum = false; //是否需要显示汇总 +const STRSPLIT = "|"; +//IOS等用户直接用NobyDa的jd cookie +let cookiesArr = [], cookie = ''; +if ($.isNode()) { + Object.keys(jdCookieNode).forEach((item) => { + cookiesArr.push(jdCookieNode[item]) + }) +} else { + cookiesArr.push($.getdata('CookieJD')); + cookiesArr.push($.getdata('CookieJD2')); +} + +const JD_API_HOST = `https://api.m.jd.com/client.action?functionId=`; +!(async () => { + if (!cookiesArr[0]) { + $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + return; + } + for (let i = 0; i < cookiesArr.length; i++) { + cookie = cookiesArr[i]; + if (cookie) { + if (i) console.log(`\n***************开始京东账号${i + 1}***************`) + initial(); + await QueryJDUserInfo(); + if (!merge.enabled) //cookie不可用 + { + $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。 + $.msg($.name, `【提示】京东账号${i + 1} cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + continue; + } + await queryTrumpTask(); + await msgShow(); + } + } +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + + +//获取昵称 +function QueryJDUserInfo(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, + headers : { + 'Referer' : `https://wqs.jd.com/my/iserinfo.html`, + 'Cookie' : cookie + } + } + $.get(url, (err, resp, data) => { + try { + data = JSON.parse(data); + if (data.retcode === 13) { + merge.enabled = false + return + } + merge.nickname = data.base.nickname; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//查询任务 +function queryTrumpTask(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}queryTrumpTask&body=%7B%22sign%22%3A2%7D&appid=content_ecology&clientVersion=9.2.0&client=wh5`, + headers : { + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/3wtN2MjeQgjmxYTLB3YFcHjKiUJj/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + } + } + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data) + let now = $.time('yyyy-MM-dd') + for (let i in data.result.signTask.taskItemInfo.signList){ + //console.log(data.result.signTask.taskItemInfo.signList[i]) + if (data.result.signTask.taskItemInfo.signList[i].match(now)) { + merge.jdBeans.fail++; + merge.jdBeans.notify = `${now}已签过`; + console.log(now + '已签过') + return + } + } + for (let i in data.result.taskList) { + console.log(data.result.taskList[i].taskName) + if (data.result.taskList[i].taskItemInfo.status === 0) { + await doTrumpTask(data.result.taskList[i].taskId,data.result.taskList[i].taskItemInfo.itemId,1000) + } else { + console.log('已完成') + } + } + console.log('开始签到') + await doTrumpTask(4,"1",1000) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +//做任务 +function doTrumpTask(taskId,itemId,timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}doTrumpTask&body=%7B%22taskId%22%3A${taskId}%2C%22itemId%22%3A%22${itemId}%22%2C%22sign%22%3A2%7D&appid=content_ecology&clientVersion=9.2.0&client=wh5`, + headers : { + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/3wtN2MjeQgjmxYTLB3YFcHjKiUJj/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + } + } + $.post(url, async (err, resp, data) => { + try { + // + data = JSON.parse(data); + console.log(data.msg) + if (data.code !== "0") { + merge.jdBeans.fail++; + merge.jdBeans.notify = `${data.msg}`; + return + } else { + merge.jdBeans.success++; + merge.jdBeans.prizeCount += parseInt(data.result.lotteryScore) + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + + +//初始化 +function initial() { + merge = { + nickname: "", + enabled: true, + //blueCoin: {prizeDesc : "收取|蓝币|个",number : true}, //定义 动作|奖励名称|奖励单位 是否是数字 + jdBeans: {prizeDesc : "获得|京豆|个",number : true,fixed : 0} + } + for (let i in merge) { + merge[i].success = 0; + merge[i].fail = 0; + merge[i].prizeCount = 0; + merge[i].notify = ""; + merge[i].show = true; + } +} +//通知 +function msgShow() { + let message = ""; + let url ={ "open-url" : `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3wtN2MjeQgjmxYTLB3YFcHjKiUJj/index.html%22%20%7D`} + let title = `京东账号:${merge.nickname}`; + for (let i in merge) { + if (typeof (merge[i]) !== "object" || !merge[i].show) continue; + if (merge[i].notify.split("").reverse()[0] === "\n") merge[i].notify = merge[i].notify.substr(0,merge[i].notify.length - 1); + message += `${merge[i].prizeDesc.split(STRSPLIT)[0]}${merge[i].prizeDesc.split(STRSPLIT)[1]}:` + (merge[i].success ? `${merge[i].prizeCount.toFixed(merge[i].fixed)}${merge[i].prizeDesc.split(STRSPLIT)[2]}\n` : `失败:${merge[i].notify}\n`) + } +//合计 +if (needSum) + { + $.sum = {}; + for (let i in merge) { + if (typeof (merge[i]) !== "object" || !merge[i].show) continue; + if (typeof ($.sum[merge[i].prizeDesc.split(STRSPLIT)[1]]) === "undefined") $.sum[merge[i].prizeDesc.split(STRSPLIT)[1]] = {count : 0}; + $.sum[merge[i].prizeDesc.split(STRSPLIT)[1]].count += merge[i].prizeCount; + } + message += `合计:` + for (let i in $.sum) + { + message += `${$.sum[i].count.toFixed($.sum[i].fixed)}${i},` + } + } + message += `请点击通知跳转至APP查看` + //message = message.substr(0,message.length - 1); + $.msg($.name, title, message, url); +} + + +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file diff --git a/Task/jd_starStore.js b/Task/jd_starStore.js index 7ddc023a96..f03e68f6eb 100644 --- a/Task/jd_starStore.js +++ b/Task/jd_starStore.js @@ -1,6 +1,6 @@ /* 京东星店长 -更新时间:2020-11-03 16:51 +更新时间:2020-11-04 08:27 脚本说明: 第一次执行会循环 8--86号店铺,时间比较长,后面会判断,做完86的不再全部做,每天运行一次即可 使用前请先看下活动介绍,可能会关注店铺,入会是假入会,入会任务可能不会完成 @@ -46,14 +46,14 @@ const JD_API_HOST = `https://api.m.jd.com/client.action?functionId=`; } let shopId = 0; let now = new Date(); - await mcxhd_starmall_taskList(86); //做最后一个,看是否做完 - if (!merge.end) { - for (shopId = 8; shopId <86 ; shopId ++ ) { - console.log('\n开始店铺:' + shopId) - await mcxhd_starmall_taskList(shopId); - } + //await mcxhd_starmall_taskList(86); //做最后一个,看是否做完 + //if (!merge.end) { + for (shopId = 8; shopId <87 ; shopId ++ ) { + console.log('\n开始店铺:' + shopId) + await mcxhd_starmall_taskList(shopId); } - merge.end = false; + //} + //merge.end = false; if (now.getDate() === 3) shopId = 2; if (now.getDate() === 4) shopId = 2; if (now.getDate() === 5) shopId = 3; @@ -140,11 +140,12 @@ function mcxhd_starmall_taskList(shopId,timeout = 0){ await mcxhd_starmall_doTask(shopId,data.result.tasks[i].taskType,data.result.tasks[i].subItem[j].itemId) } } else { - if (shopId === 86) { - console.log('最后一个店铺已做完,不再执行所有店铺') - merge.end = true; - } + //console.log(data.result.tasks[i].taskType) console.log('已完成') + if (data.result.tasks[i].taskType === "1") { + console.log('签到已完成,本店任务跳过') + break + } } } } catch (e) { diff --git a/Task/jd_timeMachine.js b/Task/jd_timeMachine.js new file mode 100644 index 0000000000..78f3374da3 --- /dev/null +++ b/Task/jd_timeMachine.js @@ -0,0 +1,356 @@ +/* +京东时光机 +更新时间:2020-10-31 03:14 +脚本说明: +京东时光机 +20 0-20/4 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_timeMachine.js, tag=京东时光机, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true +*/ +const $ = new Env('京东时光机'); +//Node.js用户请在jdCookie.js处填写京东ck; +const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; +//IOS等用户直接用NobyDa的jd cookie +let cookiesArr = [], cookie = ''; +if ($.isNode()) { + Object.keys(jdCookieNode).forEach((item) => { + cookiesArr.push(jdCookieNode[item]) + }) +} else { + cookiesArr.push($.getdata('CookieJD')); + cookiesArr.push($.getdata('CookieJD2')); +} + +const JD_API_HOST = `https://api.m.jd.com/client.action`; +!(async () => { + if (!cookiesArr[0]) { + $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + return; + } + console.log('提示:任务状态显示0是成功的意思,不要问为什么是0,执行完去app看!') + console.log('4小时执行一次是为了领能量球,不需要的设置为每天执行一次即可!') + for (let i = 0; i < cookiesArr.length; i++) { + cookie = cookiesArr[i]; + if (cookie) { + initial(); + console.log('*******************分割线*********************') + await QueryJDUserInfo(); + if (!merge.enabled) //cookie不可用 + { + $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。 + $.msg($.name, `【提示】京东账号${i + 1} cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + continue; + } + await bc_getHome() + await bc_collectEnergyBall() + await bc_taskList() + console.log('\n开始兑换碎片') + await bc_fragmentCharge() + await msgShow() + } + } +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + + +//获取昵称(直接用,勿删) +function QueryJDUserInfo(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, + headers : { + 'Referer' : `https://wqs.jd.com/my/iserinfo.html`, + 'Cookie' : cookie + } + } + $.get(url, (err, resp, data) => { + try { + data = JSON.parse(data); + if (data.retcode === 13) { + merge.enabled = false + return + } + merge.nickname = data.base.nickname; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +function qryCompositeMaterials(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn`, + 'Content-Type' : `application/x-www-form-urlencoded` + }, + body : `functionId=qryCompositeMaterials&appid=publicUseApi&body={"activityId":"3DDunaJMLDamrmGwu73QbqtGtbX1","qryParam":"[{\\"type\\":\\"advertGroup\\",\\"id\\":\\"04891674\\",\\"mapTo\\":\\"assist\\",\\"promotion\\":1},{\\"type\\":\\"advertGroup\\",\\"id\\":\\"04892350\\",\\"mapTo\\":\\"game\\",\\"promotion\\":1},{\\"type\\":\\"advertGroup\\",\\"id\\":\\"04891674\\",\\"mapTo\\":\\"normal\\",\\"promotion\\":1}]","applyKey":"big_promotion"}&client=wh5&clientVersion=1.0.0&sid=` + } + $.post(url, async (err, resp, data) => { + try { + console.log(data) + data = JSON.parse(data); + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//查询任务 +function bc_taskList(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url: `${JD_API_HOST}`, + headers: { + 'Origin': `https://h5.m.jd.com`, + 'Cookie': cookie, + 'Connection': `keep-alive`, + 'Accept': `application/json, text/plain, */*`, + 'Referer': `https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html`, + 'Host': `api.m.jd.com`, + 'Accept-Encoding': `gzip, deflate, br`, + 'Accept-Language': `zh-cn`, + 'Content-Type': `application/x-www-form-urlencoded`, + 'User-Agent': `jdapp;iPhone;9.2.0;14.1;` + }, + body : `functionId=bc_taskList&appid=publicUseApi&body={"lat":"36","lng":"117"}&client=wh5&clientVersion=1.0.0&sid=` + } + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + if (data.data.result.signInfo.todayIsSigned === 0) { + console.log('\n开始签到:') + await bc_doTask(0) + } else { + console.log('\n当天已签到') + } + await bc_doTask(8,"","6acTpqhUjIOlhxlTq3RiZg") + for (let i in data.data.result.taskList) { + if (data.data.result.taskList[i].taskType === 8) continue; + console.log('\n开始做任务:' + data.data.result.taskList[i].taskType + '-' + data.data.result.taskList[i].mainTitle) + if (data.data.result.taskList[i].isCompleted === 1) { + console.log('已做完') + continue + } + for (let j = data.data.result.taskList[i].doTimes; j < data.data.result.taskList[i].timesLimit; j++) { + if (data.data.result.taskList[i].taskType === 1) { + for (let k in $.plusAdvertList) { + if ($.plusAdvertList[k].isCompleted === 0) { + console.log('\n' + $.plusAdvertList[k].desc) + await bc_doTask(data.data.result.taskList[i].taskType,$.plusAdvertList[k].comments0) + $.plusAdvertList[k].isCompleted = 1 + } + } + } else if (data.data.result.taskList[i].taskType === 2) { + for (let k in $.t1AdvertList) { + if ($.t1AdvertList[k].isCompleted === 0) { + console.log('\n' + $.t1AdvertList[k].desc) + await bc_doTask(data.data.result.taskList[i].taskType,$.t1AdvertList[k].comments0) + $.t1AdvertList[k].isCompleted = 1 + } + } + } else { + await bc_doTask(data.data.result.taskList[i].taskType) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} +//做任务 +function bc_doTask(taskType,shopId = "",invitePin = "",timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + shopId = shopId&&`"shopId":"${shopId}",` + invitePin = invitePin&&`"invitePin":"${invitePin}",` + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn`, + 'Content-Type' : `application/x-www-form-urlencoded` + }, + body : `functionId=bc_doTask&appid=publicUseApi&body={${shopId}${invitePin}"taskType":${taskType}}&client=wh5&clientVersion=1.0.0&sid=` + } + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + console.log('做任务结果:'+ data.data.bizCode) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} +// 换碎片 +function bc_fragmentCharge(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn`, + 'Content-Type' : `application/x-www-form-urlencoded` + }, + body : `functionId=bc_fragmentCharge&appid=publicUseApi&body={}&client=wh5&clientVersion=1.0.0&sid=` + } + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + if (data.data.bizCode === 0) { + console.log('寻找碎片结果:剩余'+ data.data.result.energy) + if (data.data.result.energy >= data.data.result.fragmentEnergy) { + await bc_fragmentCharge() + } + } else { + console.log(data.data.bizMsg) + } + + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +// 主页 +function bc_getHome(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn`, + 'Content-Type' : `application/x-www-form-urlencoded` + }, + body : `functionId=bc_getHome&appid=publicUseApi&body={"lat":"","lng":""}&client=wh5&clientVersion=1.0.0&sid=` + } + $.post(url, async (err, resp, data) => { + try { + // + //console.log(data) + data = JSON.parse(data); + console.log("您的助力码为:" + data.data.result.ePin) + $.plusAdvertList = data.data.result.homeAdvertVO.plusAdvertList; + $.t1AdvertList = data.data.result.homeAdvertVO.t1AdvertList; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//收集能量球 +function bc_collectEnergyBall(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}`, + headers : { + 'Origin' : `https://h5.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html`, + 'Host' : `api.m.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn`, + 'Content-Type' : `application/x-www-form-urlencoded` + }, + body : `functionId=bc_collectEnergyBall&appid=publicUseApi&body={}&client=wh5&clientVersion=1.0.0` + } + console.log("\n收取能量球") + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + console.log(data.data.bizMsg) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} +//初始化 +function initial() { + merge = { + nickname: "", + enabled: true + } + for (let i in merge) { + merge[i].success = 0; + merge[i].fail = 0; + merge[i].prizeCount = 0; + merge[i].notify = ""; + merge[i].show = true; + } +} +//通知 +function msgShow() { + let url ={ "open-url" : `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/3DDunaJMLDamrmGwu73QbqtGtbX1/index.html%22%20%7D`} + $.msg($.Name,"","京东账号:" + merge.nickname +"\n任务已做完!逛同城好店请手动做",url) +} + + +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} From 574df041203bd0579cabd920abc943fbda2a145c Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 02:44:48 +0800 Subject: [PATCH 229/266] --- .github/workflows/dianshijia.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index 1693489c33..073f452f9b 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -4,7 +4,7 @@ name: 电视家 on: workflow_dispatch: schedule: - - cron: '*/29 4,12,23 * * *' + - cron: '*/15 4,12,19,23 * * *' watch: types: started jobs: From cf2706b26cf02e5faa09338d5510d29b48ee70af Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 14:39:00 +0800 Subject: [PATCH 230/266] --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 4571e1d251..851536cfb7 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -41,7 +41,7 @@ http:\/\/api\.gaoqingdianshi\.com\/api\/v2\/cash\/withdrawal url script-request- */ const walkstep = '20000';//每日步数设置,可设置0-20000 const gametimes = "1999"; //游戏时长 -const logs = 0 //响应日志开关,默认关闭 +const logs = 1 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; @@ -317,8 +317,8 @@ function dotask(code) { else if (taskcode == '4000'){ //console.log('任务代码:'+code+','+taskres.msg) } + resolve() }) - resolve() }) } From 57422b8c8e388579bde8945bd0d7bfdb43d83a0b Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 14:42:03 +0800 Subject: [PATCH 231/266] --- Task/dianshijia.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 851536cfb7..5b2ba9913b 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -283,11 +283,12 @@ function cashlist() { else if(!cashres&&cashtotal){ detail += `【提现结果】今日未提现 共计提现:`+cashtotal+`元\n` } + resolve() } - resolve() } catch (e){ console.log(`提现列表失败,可忽略: ${data}`) + resolve() } }) }) From 3fc0a573c0db3bbe7cfaca88ccee5ca8c86113ab Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 14:45:46 +0800 Subject: [PATCH 232/266] --- Task/dianshijia.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 5b2ba9913b..822b23d2e1 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -283,13 +283,12 @@ function cashlist() { else if(!cashres&&cashtotal){ detail += `【提现结果】今日未提现 共计提现:`+cashtotal+`元\n` } - resolve() } } catch (e){ console.log(`提现列表失败,可忽略: ${data}`) - resolve() - } + } + resolve() }) }) } From a0e7eb75b177ac432935a38968f343b065033f82 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 14:49:36 +0800 Subject: [PATCH 233/266] --- Task/dianshijia.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 822b23d2e1..cc62a5b9c6 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -41,7 +41,7 @@ http:\/\/api\.gaoqingdianshi\.com\/api\/v2\/cash\/withdrawal url script-request- */ const walkstep = '20000';//每日步数设置,可设置0-20000 const gametimes = "1999"; //游戏时长 -const logs = 1 //响应日志开关,默认关闭 +const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; @@ -269,6 +269,7 @@ function cashlist() { headers: JSON.parse(signheaderVal)}, (error, response, data) => { let result = JSON.parse(data) let totalcash = Number(),cashres = ""; + console.log(`提现列表: ${data}`) try{ if (result.errCode == 0) { for (i=0;i { - //console.log(`金币列表: ${data}`) + console.log(`金币列表: ${data}`) let result = JSON.parse(data) let onlamount = 0, vdamount = 0, gamestime = 0, todaysign = 0; + try { for (i=0;i= time;i++){ if (result.data[i].from=="领取走路金币"){ From a7611607be3d97cfff0ef6ccc5bb88ef06bd7fca Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 14:58:56 +0800 Subject: [PATCH 234/266] --- Task/dianshijia.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index cc62a5b9c6..1595b48dff 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -269,24 +269,21 @@ function cashlist() { headers: JSON.parse(signheaderVal)}, (error, response, data) => { let result = JSON.parse(data) let totalcash = Number(),cashres = ""; - console.log(`提现列表: ${data}`) - try{ - if (result.errCode == 0) { - for (i=0;i= time ){ cashres = `✅ 今日提现:`+result.data[i].amount/100+`元 ` } - }; + } if(cashres && cashtotal){ detail += `【提现结果】`+cashres+`共计提现:`+cashtotal+`元\n` } else if(!cashres&&cashtotal){ detail += `【提现结果】今日未提现 共计提现:`+cashtotal+`元\n` } - } - } - catch (e){ + } else { console.log(`提现列表失败,可忽略: ${data}`) } resolve() @@ -383,11 +380,10 @@ function coinlist() { let url = { url: `${dianshijia_API}/coin/detail`, headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { - console.log(`金币列表: ${data}`) + //console.log(`金币列表: ${data}`) let result = JSON.parse(data) let onlamount = 0, vdamount = 0, gamestime = 0, todaysign = 0; - try { for (i=0;i= time;i++){ if (result.data[i].from=="领取走路金币"){ From 13f6d52af0a315011ad9203b4905f7e1eb5f96e1 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 15:32:33 +0800 Subject: [PATCH 235/266] --- Task/dianshijia.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 1595b48dff..d70f04c03e 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -47,7 +47,7 @@ const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; let RewardId = $.getdata('REWARD')||'55'; //额外签到奖励,默认55为兑换0.2元额度,44为兑换1天VIP,42为兑换1888金币 const dianshijia_API = 'http://api.gaoqingdianshi.com/api' -let tokenArr = [], DsjurlArr = [], DrawalArr = [],CountMax,CompCount; +let tokenArr = [], DsjurlArr = [], DrawalArr = [],todrawal=""; if ($.isNode()) { if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.indexOf('#') > -1) { Dsjheaders = process.env.DSJ_HEADERS.split('#'); @@ -122,8 +122,8 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - if ($.isNode() && code == 'playTask' && CountMax == CompCount && taskcode == 0 ) { - await notify.sendNotify($.name, subTitle+'\n'+ detail) + if ($.isNode() && todrawal == '0') { + await notify.sendNotify($.name+"提现成功", subTitle+'\n'+ detail) } } } @@ -146,7 +146,7 @@ function GetCookie() { } } async function run() { - if ($.isNode()) { + if ($.isNode()&&new Date().getTimezoneOffset() == '0') { if ($.time('HH')>11){ await sleep(); await CarveUp(); @@ -302,8 +302,8 @@ function tasks(tkcode) { function dotask(code) { return new Promise((resolve, reject) => { $.get({ url: `${dianshijia_API}/v4/task/complete?code=${code}`, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - let taskres = JSON.parse(data) - taskcode = taskres.errCode + let taskres = JSON.parse(data), + taskcode = taskres.errCode; if (taskcode == 0){ CompCount = taskres.data.dayCompCount CountMax = taskres.data.dayDoCountMax @@ -368,8 +368,8 @@ function wakeup() { headers: JSON.parse(signheaderVal)} $.get(url, (error, response, data) => { if(logs)$.log(`睡觉打卡: ${data}\n`) - resolve() }) + resolve() }) } @@ -471,9 +471,10 @@ function getCUpcoin() { function Withdrawal() { return new Promise((resolve, reject) => { $.get({url: drawalVal, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - if(logs)$.log(`金币随机兑换 : ${data}\n`) - let result = JSON.parse(data) - if (result.errCode == 0) { + $.log(`金币随机兑换 : ${data}\n`) + let result = JSON.parse(data), + todrawal = result.errCode; + if (todrawal == 0) { detail += `【金额提现】✅ 到账`+result.data.price/100+`元 🌷\n` } resolve() @@ -505,4 +506,4 @@ function Addsign() { }) } -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();s&&this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};if(this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r))),!this.isMuteLog){let t=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];t.push(e),s&&t.push(s),i&&t.push(i),console.log(t.join("\n")),this.logs=this.logs.concat(t)}}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 2108765c70d809804c65b7341f2691c8ad2c7ea3 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 15:42:05 +0800 Subject: [PATCH 236/266] --- Task/jd_lotteryMachine.js | 46 ++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/Task/jd_lotteryMachine.js b/Task/jd_lotteryMachine.js index 31cb666e9f..88b05dba42 100644 --- a/Task/jd_lotteryMachine.js +++ b/Task/jd_lotteryMachine.js @@ -1,7 +1,7 @@ /* 京东抽奖机 -更新时间:2020-11-05 16:06 -脚本说明: +更新时间:2020-11-06 13:12 +脚本说明:四个抽奖活动,【东东抽奖机】【新店福利】【东东福利屋】【东东生活】,点通知只能跳转一个,入口在京东APP玩一玩里面可以看到 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js // quantumultx [task_local] @@ -18,7 +18,10 @@ const $ = new Env('京东抽奖机'); const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; const STRSPLIT = "|"; const needSum = false; //是否需要显示汇总 -$.isMuteLog = true //是否显示出参详情 +const printDetail = false; //是否显示出参详情 +const appIdArr = ['1EFRQxQ','1EFRQxA','1EFRQxw','1EFRQyw'] +const shareCodeArr = ['P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0','P04z54XCjVXmIaW5m9cZ2f433tIlGWEga-IO2o','P04z54XCjVXm4aW5m9cZ2f433tIlINrBDzgMdY','P04z54XCjVXl4aW5m9cZ2f433tIlHQIDDSzFzg'] +//const funPrefixArr = ['interact_template','interact_template','wfh'] //IOS等用户直接用NobyDa的jd cookie let cookiesArr = [], cookie = ''; if ($.isNode()) { @@ -48,8 +51,14 @@ const JD_API_HOST = `https://api.m.jd.com/client.action`; $.msg($.name, `【提示】京东账号${i + 1} cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); continue; } - await interact_template_getHomeData(); - await interact_template_getLotteryResult(); + for (let j in appIdArr) { + appId = appIdArr[j] + shareCode = shareCodeArr[j] + //funPrefix = funPrefixArr[j] + if (parseInt(j)) console.log(`\n开始第${parseInt(j) + 1}个抽奖活动`) + await interact_template_getHomeData(); + await interact_template_getLotteryResult(); + } await msgShow(); } } @@ -103,13 +112,14 @@ function interact_template_getHomeData(timeout = 0) { 'Accept-Encoding' : `gzip, deflate, br`, 'Accept-Language' : `zh-cn` }, - body : `functionId=interact_template_getHomeData&body={"appId":"1EFRQxQ","taskToken":""}&client=wh5&clientVersion=1.0.0` + body : `functionId=${appId === '1EFRQxw' ? 'wfh' :'interact_template'}_getHomeData&body={"appId":"${appId}","taskToken":""}&client=wh5&clientVersion=1.0.0` } $.post(url, async (err, resp, data) => { try { - if (!$.isMuteLog) console.log(data); + if (printDetail) console.log(data); data = JSON.parse(data); - + scorePerLottery = data.data.result.userInfo.scorePerLottery||data.data.result.userInfo.lotteryMinusScore + //console.log(scorePerLottery) for (let i = 0;i < data.data.result.taskVos.length;i ++) { console.log("\n" + data.data.result.taskVos[i].taskType + '-' + data.data.result.taskVos[i].taskName + '-' + (data.data.result.taskVos[i].status === 1 ? `已完成${data.data.result.taskVos[i].times}-未完成${data.data.result.taskVos[i].maxTimes}` : "全部已完成")) //签到 @@ -120,7 +130,8 @@ function interact_template_getHomeData(timeout = 0) { continue } if (data.data.result.taskVos[i].taskType === 14) {//'data.data.result.taskVos[i].assistTaskDetailVo.taskToken' - await harmony_collectScore('P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0',data.data.result.taskVos[i].taskId); + console.log('您的助力码:'+data.data.result.taskVos[i].assistTaskDetailVo.taskToken) + await harmony_collectScore(shareCode,data.data.result.taskVos[i].taskId); continue } let list = data.data.result.taskVos[i].productInfoVos || data.data.result.taskVos[i].followShopVo || data.data.result.taskVos[i].shoppingActivityVos || data.data.result.taskVos[i].browseShopVo @@ -159,16 +170,17 @@ function harmony_collectScore(taskToken,taskId,timeout = 0) { 'Cookie' : cookie, 'Connection' : `keep-alive`, 'Accept' : `application/json, text/plain, */*`, - 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html?inviteId=P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0`,//?inviteId=P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ + 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/2WBcKYkn8viyxv7MoKKgfzmu7Dss/index.html`,//?inviteId=P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ P225KkcRx4b8lbWJU72wvZZcwCjVXmYaS5jQ?inviteId=${shareCode} 'Host' : `api.m.jd.com`, 'Accept-Encoding' : `gzip, deflate, br`, 'Accept-Language' : `zh-cn` }, - body : `functionId=harmony_collectScore&body={"appId":"1EFRQxQ","taskToken":"${taskToken}","taskId":${taskId},"actionType":0}&client=wh5&clientVersion=1.0.0` + body : `functionId=${appId === '1EFRQxw' ? 'wfh' :'harmony'}_collectScore&body={"appId":"${appId}","taskToken":"${taskToken}","taskId":${taskId},"actionType":0}&client=wh5&clientVersion=1.0.0` } + //console.log(url) $.post(url, async (err, resp, data) => { try { - if (!$.isMuteLog) console.log(data); + if (printDetail) console.log(data); data = JSON.parse(data); console.log(data.data.bizMsg) } catch (e) { @@ -196,20 +208,20 @@ function interact_template_getLotteryResult(timeout = 0) { 'Accept-Encoding' : `gzip, deflate, br`, 'Accept-Language' : `zh-cn` }, - body : `functionId=interact_template_getLotteryResult&body={"appId":"1EFRQxQ"}&client=wh5&clientVersion=1.0.0` + body : `functionId=${appId === '1EFRQxw' ? 'wfh' :'interact_template'}_getLotteryResult&body={"appId":"${appId}"}&client=wh5&clientVersion=1.0.0` } $.post(url, async (err, resp, data) => { try { - if (!$.isMuteLog) console.log(data); + if (printDetail) console.log(data); if (!timeout) console.log('\n开始抽奖') data = JSON.parse(data); if (data.data.bizCode === 0) { merge.jdBeans.success++; - if (data.data.result.userAwardsCacheDto.jBeanAwardVo&&data.data.result.userAwardsCacheDto.jBeanAwardVo.prizeName === "京豆") { - console.log(data.data.result.userAwardsCacheDto.jBeanAwardVo.prizeName + ':' + data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity) + if (data.data.result.userAwardsCacheDto.jBeanAwardVo&&data.data.result.userAwardsCacheDto.jBeanAwardVo.prizeName.match(/京豆/)) { + console.log('京豆:' + data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity) merge.jdBeans.prizeCount += parseInt(data.data.result.userAwardsCacheDto.jBeanAwardVo.quantity) } - if (parseInt(data.data.result.userScore) >= 400 ) { + if (parseInt(data.data.result.userScore) >= scorePerLottery ) { await interact_template_getLotteryResult(1000) } } else{ From 7021c229bea4242bb8fa0672972c016ea01b8fa4 Mon Sep 17 00:00:00 2001 From: Best Date: Fri, 6 Nov 2020 18:39:27 +0800 Subject: [PATCH 237/266] --- Task/midu_Read.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Task/midu_Read.js b/Task/midu_Read.js index feb24d3776..96c05ead38 100644 --- a/Task/midu_Read.js +++ b/Task/midu_Read.js @@ -212,7 +212,7 @@ function addDraw() { url = { url: 'https://apiwz.midukanshu.com/wz/task/weekReward', headers: {}, - body: drawVal + body: drawVal+"&draw_num=28&sign=36646430333630313c3c353c6661326136333266326036353663333232363d3d" } url.headers['Host'] = 'apiwz.midukanshu.com' url.headers['Content-Type'] = 'application/x-www-form-urlencoded' @@ -222,12 +222,12 @@ function addDraw() { // $.log(`🐍🐢 ${cookieName} addDraw - response: ${JSON.stringify(data)}\n`) add_Draw = JSON.parse(data) if(add_Draw.code==0){ - console.log("额外奖励:"+add_Draw.data.msg) + console.log("转盘额外奖励:"+add_Draw.data.msg) } resolve() } catch (e) { // $.msg(cookieName, `额外奖励: 失败`, `说明: ${e}`) - $.log(`❌ ${cookieName} addDraw - 额外奖励失败: ${e}`) + $.log(`❌ ${cookieName} addDraw - 转盘额外奖励失败: ${e}`) $.log(`❌ ${cookieName} addDraw - response: ${JSON.stringify(data)}\n`) resolve() } From 3eee1acdc5b078fdd1ecf99ea84f4ddb972ec1f7 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 7 Nov 2020 10:13:47 +0800 Subject: [PATCH 238/266] --- README.md | 2 +- Task/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f038fbca02..eab9a7267a 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ > ***您使用或者复制了本仓库且本人制作的任何脚本,则视为`已接受`此免责声明,请仔细阅读*** #### 开发者不易,请赏杯茶水费 -
+
### 特别感谢: diff --git a/Task/README.md b/Task/README.md index d6aee70625..105a37bf35 100644 --- a/Task/README.md +++ b/Task/README.md @@ -21,7 +21,7 @@ ***您使用或者复制了本仓库且本人制作的任何脚本,则视为`已接受`此免责声明,请仔细阅读*** ####开发者不易,请赏杯茶水费 -
+
### 特别感谢: From a2c53c5e66bb12c60b2e3ab3f820425c4e40ece0 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 7 Nov 2020 12:20:09 +0800 Subject: [PATCH 239/266] --- Task/dianshijia.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index d70f04c03e..a39f7e55f0 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -41,7 +41,7 @@ http:\/\/api\.gaoqingdianshi\.com\/api\/v2\/cash\/withdrawal url script-request- */ const walkstep = '20000';//每日步数设置,可设置0-20000 const gametimes = "1999"; //游戏时长 -const logs = 0 //响应日志开关,默认关闭 +const logs = 1 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; @@ -122,6 +122,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 + console.log(todrawal) if ($.isNode() && todrawal == '0') { await notify.sendNotify($.name+"提现成功", subTitle+'\n'+ detail) } From d4ce262aa7db215fc7a2562bdb7246e0c2983b8d Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 7 Nov 2020 12:26:30 +0800 Subject: [PATCH 240/266] --- Task/dianshijia.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index a39f7e55f0..efdd52323c 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -41,7 +41,7 @@ http:\/\/api\.gaoqingdianshi\.com\/api\/v2\/cash\/withdrawal url script-request- */ const walkstep = '20000';//每日步数设置,可设置0-20000 const gametimes = "1999"; //游戏时长 -const logs = 1 //响应日志开关,默认关闭 +const logs = 0 //响应日志开关,默认关闭 const $ = new Env('电视家') const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; @@ -270,7 +270,7 @@ function cashlist() { headers: JSON.parse(signheaderVal)}, (error, response, data) => { let result = JSON.parse(data) let totalcash = Number(),cashres = ""; - //console.log(`提现列表: ${data}`) + console.log(`提现列表: ${data}`) if (result.errCode == 0) { for (i=0;i { - //console.log(`金币列表: ${data}`) + console.log(`金币列表: ${data}`) let result = JSON.parse(data) let onlamount = 0, vdamount = 0, gamestime = 0, todaysign = 0; @@ -434,14 +434,13 @@ function coinlist() { detail += `【任务统计】共完成${i+1}次任务🌷` } $.msg($.name+` `+sleeping, subTitle, detail) - resolve() } catch(e) { console.log(`获取任务金币列表失败,错误代码${e}+ \n响应数据:${data}`) $.msg($.name+` `+sleeping, subTitle, detail) - resolve() } }) - },1000) + },2000) + resolve() }) } From e67099c1aa76a72009c34a3f51c24e507a2e3ac5 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 7 Nov 2020 12:34:33 +0800 Subject: [PATCH 241/266] --- Task/dianshijia.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index efdd52323c..974823ced7 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -374,7 +374,6 @@ function wakeup() { }) } - function coinlist() { return new Promise((resolve, reject) => { setTimeout(() => { @@ -439,8 +438,8 @@ function coinlist() { $.msg($.name+` `+sleeping, subTitle, detail) } }) + resolve() },2000) - resolve() }) } From 3c52583fb2a9f99b253274c8cf4eb0a06de1cf27 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 7 Nov 2020 12:37:32 +0800 Subject: [PATCH 242/266] --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 974823ced7..d45e14ea35 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -435,10 +435,10 @@ function coinlist() { $.msg($.name+` `+sleeping, subTitle, detail) } catch(e) { console.log(`获取任务金币列表失败,错误代码${e}+ \n响应数据:${data}`) - $.msg($.name+` `+sleeping, subTitle, detail) + $.msg($.name+` 获取任务金币详情失败 `, subTitle, detail) } + resolve() }) - resolve() },2000) }) } From 655390b660b26cc3aa277a003e666f705ad3b646 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 7 Nov 2020 12:43:30 +0800 Subject: [PATCH 243/266] --- Task/dianshijia.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index d45e14ea35..3c94469765 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -122,8 +122,8 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - console.log(todrawal) - if ($.isNode() && todrawal == '0') { + console.log(todrawal); + if ($.isNode() && todrawal != '0') { await notify.sendNotify($.name+"提现成功", subTitle+'\n'+ detail) } } @@ -435,7 +435,7 @@ function coinlist() { $.msg($.name+` `+sleeping, subTitle, detail) } catch(e) { console.log(`获取任务金币列表失败,错误代码${e}+ \n响应数据:${data}`) - $.msg($.name+` 获取任务金币详情失败 `, subTitle, detail) + $.msg($.name+` 获取金币详情失败 `, subTitle, detail) } resolve() }) @@ -473,10 +473,10 @@ function Withdrawal() { $.log(`金币随机兑换 : ${data}\n`) let result = JSON.parse(data), todrawal = result.errCode; - if (todrawal == 0) { - detail += `【金额提现】✅ 到账`+result.data.price/100+`元 🌷\n` - } - resolve() + if (todrawal == 0) { + detail += `【金额提现】✅ 到账`+result.data.price/100+`元 🌷\n` + } + resolve() }) }) } From 4d32ed5a9ec0b12b62dd343787886b5a9a561e86 Mon Sep 17 00:00:00 2001 From: Best Date: Sat, 7 Nov 2020 13:12:11 +0800 Subject: [PATCH 244/266] --- Task/dianshijia.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 3c94469765..07e95efe11 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -47,7 +47,7 @@ const notify = $.isNode() ? require('./sendNotify') : ''; let sleeping = "",detail=``,subTitle=``; let RewardId = $.getdata('REWARD')||'55'; //额外签到奖励,默认55为兑换0.2元额度,44为兑换1天VIP,42为兑换1888金币 const dianshijia_API = 'http://api.gaoqingdianshi.com/api' -let tokenArr = [], DsjurlArr = [], DrawalArr = [],todrawal=""; +let tokenArr = [], DsjurlArr = [], DrawalArr = [],drawalCode=""; if ($.isNode()) { if (process.env.DSJ_HEADERS && process.env.DSJ_HEADERS.indexOf('#') > -1) { Dsjheaders = process.env.DSJ_HEADERS.split('#'); @@ -113,8 +113,7 @@ if (isGetCookie = typeof $request !== 'undefined') { if (drawalVal != undefined){ await Withdrawal() } else { - detail += `【金额提现】❌ 请获取提现地址 \n` - };// 金额提现 + detail += `【金额提现】❌ 请获取提现地址 \n`}; // 金额提现 await run(); await tasks(); // 任务状态 await getGametime();// 游戏时长 @@ -122,8 +121,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await cash(); // 现金 await cashlist(); // 现金列表 await coinlist(); // 金币列表 - console.log(todrawal); - if ($.isNode() && todrawal != '0') { + if ($.isNode() && drawalCode == '0') { await notify.sendNotify($.name+"提现成功", subTitle+'\n'+ detail) } } @@ -270,7 +268,7 @@ function cashlist() { headers: JSON.parse(signheaderVal)}, (error, response, data) => { let result = JSON.parse(data) let totalcash = Number(),cashres = ""; - console.log(`提现列表: ${data}`) + //console.log(`提现列表: ${data}`) if (result.errCode == 0) { for (i=0;i { - console.log(`金币列表: ${data}`) + //console.log(`金币列表: ${data}`) let result = JSON.parse(data) let onlamount = 0, vdamount = 0, gamestime = 0, todaysign = 0; @@ -439,7 +437,7 @@ function coinlist() { } resolve() }) - },2000) + },1000) }) } @@ -470,13 +468,13 @@ function getCUpcoin() { function Withdrawal() { return new Promise((resolve, reject) => { $.get({url: drawalVal, headers: JSON.parse(signheaderVal)}, (error, response, data) => { - $.log(`金币随机兑换 : ${data}\n`) - let result = JSON.parse(data), - todrawal = result.errCode; - if (todrawal == 0) { - detail += `【金额提现】✅ 到账`+result.data.price/100+`元 🌷\n` + if(logs)$.log(`金币随机兑换 : ${data}\n`) + let todrawal = JSON.parse(data); + if (todrawal.errCode == 0) { + detail += `【金额提现】✅ 到账`+todrawal.data.price/100+`元 🌷\n` + drawalCode = todrawal.errCode } - resolve() + resolve() }) }) } From 259be77e276bd503e636605e73cfc365a975f452 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 8 Nov 2020 08:57:40 +0800 Subject: [PATCH 245/266] --- Task/dianshijia.js | 1 + 1 file changed, 1 insertion(+) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 07e95efe11..a185c3269d 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -98,6 +98,7 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-8*60*60 + console.log(time) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From b82de9b86870456fa089acd18eefc99674173bc4 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 8 Nov 2020 09:07:35 +0800 Subject: [PATCH 246/266] --- Task/dianshijia.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index a185c3269d..1057af2f10 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -113,8 +113,7 @@ if (isGetCookie = typeof $request !== 'undefined') { await Addsign(); // 额外奖励,默认额度 if (drawalVal != undefined){ await Withdrawal() - } else { - detail += `【金额提现】❌ 请获取提现地址 \n`}; // 金额提现 + } else { detail += `【金额提现】❌ 请获取提现地址 \n`}; await run(); await tasks(); // 任务状态 await getGametime();// 游戏时长 @@ -244,8 +243,9 @@ function total() { } resolve() } catch(e){ - console.log(e) } - resolve() + console.log(e) + resolve() + } }) }) } From 910aa47264fefc47ec38be98ffa88a681db13f7e Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 8 Nov 2020 09:15:42 +0800 Subject: [PATCH 247/266] --- .github/workflows/dianshijia.yml | 1 + Task/dianshijia.js | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/dianshijia.yml b/.github/workflows/dianshijia.yml index 073f452f9b..8622189e88 100644 --- a/.github/workflows/dianshijia.yml +++ b/.github/workflows/dianshijia.yml @@ -14,6 +14,7 @@ jobs: env: DSJ_HEADERS: ${{ secrets.DSJ_HEADERS }} DSJ_DRAWAL: ${{ secrets.DSJ_DRAWAL }} + TZ: Asia/shanghai steps: - name: Checkout run: | diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 1057af2f10..dde0d302f0 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -99,6 +99,7 @@ if (isGetCookie = typeof $request !== 'undefined') { if(new Date().getTimezoneOffset()/60 != '-8'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-8*60*60 console.log(time) + console.log(TZ) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From b7cab49fa5d223d38460865a6b263729138df564 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 8 Nov 2020 09:17:52 +0800 Subject: [PATCH 248/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index dde0d302f0..368c861d35 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -99,7 +99,7 @@ if (isGetCookie = typeof $request !== 'undefined') { if(new Date().getTimezoneOffset()/60 != '-8'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-8*60*60 console.log(time) - console.log(TZ) + console.log(env.TZ) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From 1e6da175dd4284d91da6d1bb4fa8e98d03c31377 Mon Sep 17 00:00:00 2001 From: Best Date: Sun, 8 Nov 2020 09:18:33 +0800 Subject: [PATCH 249/266] --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 368c861d35..113df765cc 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -99,7 +99,7 @@ if (isGetCookie = typeof $request !== 'undefined') { if(new Date().getTimezoneOffset()/60 != '-8'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-8*60*60 console.log(time) - console.log(env.TZ) + console.log(process.env.TZ) } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From baaad50672cc195c615271d38bd613c493a67bae Mon Sep 17 00:00:00 2001 From: Best Date: Mon, 9 Nov 2020 13:29:18 +0800 Subject: [PATCH 250/266] --- .github/workflows/jd_baiTiao.yml | 40 ++ .github/workflows/jd_bigWinner.yml | 40 ++ Task/jd_baiTiao.js | 220 +++++++ Task/jd_bigWinner.js | 934 +++++++++++++++++++++++++++++ Task/jd_lotteryMachine.js | 12 +- 5 files changed, 1240 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/jd_baiTiao.yml create mode 100644 .github/workflows/jd_bigWinner.yml create mode 100644 Task/jd_baiTiao.js create mode 100644 Task/jd_bigWinner.js diff --git a/.github/workflows/jd_baiTiao.yml b/.github/workflows/jd_baiTiao.yml new file mode 100644 index 0000000000..86e99567dd --- /dev/null +++ b/.github/workflows/jd_baiTiao.yml @@ -0,0 +1,40 @@ + +name: 京东白条 + +on: + workflow_dispatch: + #schedule: + # - cron: '15 */4 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + env: + JD_COOKIE: ${{ secrets.JD_COOKIE }} + steps: + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: | + cd ~/Scripts + npm install + - name: '运行 【京东白条】' + if: env.JD_COOKIE + run: | + cd ~/Scripts + node Task/jd_baiTiao.js + env: + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/.github/workflows/jd_bigWinner.yml b/.github/workflows/jd_bigWinner.yml new file mode 100644 index 0000000000..3ba820eaca --- /dev/null +++ b/.github/workflows/jd_bigWinner.yml @@ -0,0 +1,40 @@ + +name: 京东大赢家 + +on: + workflow_dispatch: + schedule: + - cron: '3 */2 * * *' + watch: + types: started +jobs: + build: + runs-on: ubuntu-latest + if: github.event.repository.owner.id == github.event.sender.id + env: + JD_COOKIE: ${{ secrets.JD_COOKIE }} + steps: + - name: Checkout + run: | + git clone https://github.com/Sunert/Scripts.git ~/Scripts + - name: Use Node.js 12.x + uses: actions/setup-node@v1 + with: + node-version: 12.x + - name: npm install + run: | + cd ~/Scripts + npm install + - name: '运行 【京东大赢家】' + if: env.JD_COOKIE + run: | + cd ~/Scripts + node Task/jd_bigWinner.js + env: + PUSH_KEY: ${{ secrets.PUSH_KEY }} + BARK_PUSH: ${{ secrets.BARK_PUSH }} + TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} + TG_USER_ID: ${{ secrets.TG_USER_ID }} + BARK_SOUND: ${{ secrets.BARK_SOUND }} + DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} + DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file diff --git a/Task/jd_baiTiao.js b/Task/jd_baiTiao.js new file mode 100644 index 0000000000..301f81e438 --- /dev/null +++ b/Task/jd_baiTiao.js @@ -0,0 +1,220 @@ +/* +京东金融领白条券 +更新时间:2020-10-26 16:02 +[task_local] +# 京东金融领白条券 9点执行(非天天领券要9点开始领) +0 9 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_baiTiao.js, tag=京东白条, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/baitiao.png, enabled=true +*/ +const $ = new Env('天天领白条券'); +const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; +//直接用NobyDa的jd cookie +let cookiesArr = [], cookie = ''; +if ($.isNode()) { + Object.keys(jdCookieNode).forEach((item) => { + cookiesArr.push(jdCookieNode[item]) + }) +} else { + cookiesArr.push($.getdata('CookieJD')); + cookiesArr.push($.getdata('CookieJD2')); +} +const JR_API_HOST = 'https://jrmkt.jd.com/activity/newPageTake/takePrize'; +let prize = + //每日领随机白条券 + [ + {name : `prizeDaily`, desc : `天天领`, id : `Q72m9P5k3K94223q5k5O1w228U2S8B040D2B9qt`}, + //周一领 + {name : `prizeMonday`, desc : `周一领`, id : `Q1295372232228280029Aw`}, + //周二领 + {name : `prizeTuesday`, desc : `周二领`, id : `Q9293947555491r1b3U870x0D2V95X`}, + //周三领 + {name : `prizeWednesday`, desc : `周三领`, id : `Q8299679592g5N1Y1r3j8X0004269Ll`}, + //周四领 + {name : `prizeThursday`, desc : `周四领`, id : `X9D2l0f0P8S31154947512923QU`}, + //每周五领55-5券 + {name : `prizeFriday`, desc : `周五领`, id : `Q529284818011r8O2Y8L07082T9kE`}, + //周六领 + {name : `prizeSaturday`, desc : `周六领`, id : `i9200831161952186922QB`}, + //周六领2 + {name : `prizeSaturday2`, desc : `周六领`, id : `Q4295706b5Q9t2D6F181k3x8Q0v0W2e9JK`} + ] + +!(async () => { + if (!cookiesArr[0]) { + $.msg($.name, '提示:请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + return; + } + + for (let i = 0; i < prize.length; i++) { + prize[i].body =`activityId=${prize[i].id}&eid=${randomWord(false,90).toUpperCase()}&fp=${randomWord(false,32).toLowerCase()}` + } + + for (let i = 0; i < cookiesArr.length; i++) { + cookie = cookiesArr[i]; + if (cookie) { + $.prize = {addMsg : ``}; + let date = new Date(); + await takePrize(prize[0]); + if ($.prize["prizeDaily"].respCode === "00001" ) { + $.msg($.name, '提示:请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + continue; + } + if (date.getDay() !== 0) { + await takePrize(prize[date.getDay()],820);//延迟执行,防止提示活动火爆 + if (date.getDay() === 6) await takePrize(prize[7],820);//第二个周六券 + } + if (date.getDay() === 0) { + $.prize.addMsg = `提 醒:请于今天使用周日专享白条券\n` + } + await queryMissionWantedDetail(); + await msgShow(); + } + } +})() + .catch((e) => { + $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '') + }) + .finally(() => { + $.done(); + }) + + +function takePrize(prize,timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url: JR_API_HOST, + body : prize.body, + headers: { + 'Cookie' : cookie, + 'X-Requested-With' : `XMLHttpRequest`, + 'Accept' : `application/json, text/javascript, */*; q=0.01`, + 'Origin' : `https://jrmkt.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Content-Type' : `application/x-www-form-urlencoded;charset=UTF-8`, + 'Host' : `jrmkt.jd.com`, + 'Connection' : `keep-alive`, + 'Referer' : `https://jrmkt.jd.com/ptp/wl/vouchers.html?activityId=${prize.id}`, + 'Accept-Language' : `zh-cn` + } + } + $.post(url, (err, resp, data) => { + try { + data = JSON.parse(data); + $.prize[prize.name] = data; + $.prize[prize.name].desc = prize.desc; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +function queryMissionWantedDetail(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url: `https://ms.jr.jd.com/gw/generic/mission/h5/m/queryMissionWantedDetail?reqData=%7B%22playId%22:%2281%22,%22channelCode%22:%22MISSIONCENTER%22,%22timeStamp%22:%2${$.time(`yyyy-MM-ddTHH:mm:ss.SZ`)}%22%7D`, + headers: { + 'Cookie' : cookie, + 'Origin' : `https://m.jr.jd.com`, + 'Connection' : `keep-alive`, + 'Accept' : `application/json`, + 'Referer' : `https://m.jr.jd.com/member/task/RewardDetail/?playId=81&platformCode=MISSIONCENTER&channel=baitiao&jrcontainer=h5&jrcloseweb=false`, + 'Host' : `ms.jr.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + } + } + $.post(url, async (err, resp, data) => { + try { + data = JSON.parse(data); + switch (data.resultData.data.mission.status ) { + case -1 : + $.prize.addMsg += `周任务:${data.resultData.data.mission.name}`; + await receivePlay(data.resultData.data.mission.missionId); + break; + case 0 : // 2已完成 -1未领取 0已领取 + $.prize.addMsg += `周任务:完成进度${data.resultData.data.mission.scheduleNowValue || 0}/${data.resultData.data.mission.scheduleTargetValue},剩余数量:${data.resultData.data.residueAwardNum || `未知`}\n` + break; + case 1 : // + $.prize.addMsg += `周任务:完成进度${data.resultData.data.mission.scheduleNowValue || 0}/${data.resultData.data.mission.scheduleTargetValue},剩余数量:${data.resultData.data.residueAwardNum || `未知`}\n` + break; + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +function receivePlay(missionId,timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url: `https://ms.jr.jd.com/gw/generic/mission/h5/m/receivePlay?reqData=%7B%22playId%22:%2281%22,%22channelCode%22:%22MISSIONCENTER%22,%22playType%22:1,%22missionId%22:${missionId},%22timeStamp%22:%22${$.time(`yyyy-MM-ddTHH:mm:ss.SZ`)}%22%7D`, + headers: { + 'Cookie' : cookie, + 'Origin' : `https://m.jr.jd.com`, + 'Connection' : `keep-alive`, + 'Accept' : `application/json`, + 'Referer' : `https://m.jr.jd.com/member/task/RewardDetail/?playId=81&platformCode=MISSIONCENTER&channel=baitiao&jrcontainer=h5&jrcloseweb=false`, + 'Host' : `ms.jr.jd.com`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + } + } + $.post(url, (err, resp, data) => { + try { + data = JSON.parse(data); + $.prize.addMsg += `-${data.resultData.msg.replace(`该任务`,``)}\n`; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +function randomWord(randomFlag, min, max){ + let str = "", + range = min, + arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; + // 随机产生 + if(randomFlag){ + range = Math.round(Math.random() * (max-min)) + min; + } + for(let i=0; i{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} diff --git a/Task/jd_bigWinner.js b/Task/jd_bigWinner.js new file mode 100644 index 0000000000..554e26ac86 --- /dev/null +++ b/Task/jd_bigWinner.js @@ -0,0 +1,934 @@ +/* +京东大赢家 双11活动 +更新时间:2020-11-09 13:10 +修复火爆问题,第一次还有可能个别的火爆,再次运行即可 +脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js +// quantumultx +[task_local] +#京东大赢家 +5 0-22/2 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_bigWinner.js, tag=京东大赢家, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true +// Loon +[Script] +cron "5 0-22/2 * * *" script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_bigWinner.js,tag=京东大赢家 +// Surge +京东大赢家 = type=cron,cronexp=5 0-22/2 * * *,wake-system=1,timeout=500,script-path=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_bigWinner.js +*/ +const $ = new Env('京东大赢家'); +//Node.js用户请在jdCookie.js处填写京东ck; +const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; +//IOS等用户直接用NobyDa的jd cookie +let cookiesArr = [], cookie = '',secretp = ''; +if ($.isNode()) { + Object.keys(jdCookieNode).forEach((item) => { + cookiesArr.push(jdCookieNode[item]) + }) +} else { + cookiesArr.push($.getdata('CookieJD')); + cookiesArr.push($.getdata('CookieJD2')); +} + +const JD_API_HOST = `https://api.m.jd.com/client.action?functionId=`; +!(async () => { + if (!cookiesArr[0]) { + $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + return; + } + //console.log('提示-1002的账号是因为京东对入参进行了强校验,并不是黑号,目前无法使用脚本,请手动去APP做吧,不提示-1002的可以继续使用') + //console.log('目前京东已全面判断入参校验,所有账号都不能用,手动做吧') + //console.log('请删除或禁用脚本!') + //return + + + for (let i = 0; i < cookiesArr.length; i++) { + cookie = cookiesArr[i]; + if (cookie) { + if (Date.now() > Date.parse('2020-11-12')) { + $.msg($.Name,"","活动已结束,请删除或禁用脚本!") + return + } + initial(); + await QueryJDUserInfo(); + if (!merge.enabled) //cookie不可用 + { + $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。 + $.msg($.name, `【提示】京东账号${i ? i + 1 : "" } cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); + continue; + } + console.log('\n\n京东账号:'+merge.nickname + ' 任务开始') + await stall_pk_getHomeData(); + await stall_getHomeData(); + //if (merge.black) continue ; + //await stall_pk_assistGroup() + await stall_myShop() + await qryCompositeMaterials() + await msgShow(); + } + } +})() + .catch((e) => $.logErr(e)) + .finally(() => $.done()) + +//获取昵称(直接用,勿删) +function QueryJDUserInfo(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, + headers : { + 'Referer' : `https://wqs.jd.com/my/iserinfo.html`, + 'Cookie' : cookie + } + } + $.get(url, (err, resp, data) => { + try { + data = JSON.parse(data); + if (data.retcode === 13) { + merge.enabled = false + return + } + merge.nickname = data.base.nickname; + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//查询任务 "appSign":"2","channel":1, +function stall_getTaskDetail(shopSign = "",appSign = "",timeout = 0){ + return new Promise((resolve) => { + setTimeout( ()=>{ + appSign = appSign&&'"appSign":"2","channel":1,' + let url = { + url : `${JD_API_HOST}stall_getTaskDetail`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_getTaskDetail&body={${appSign}"shopSign":"${shopSign}"}&client=wh5&clientVersion=1.0.0` + } + + $.post(url, async (err, resp, data) => { + try { + //console.log('stall_getTaskDetail:' + data) + data = JSON.parse(data); + if (shopSign === "") { + shopSign = '""' + //if (appSign === "") console.log(`您的个人助力码:${data.data.result.inviteId}`) + } + for (let i = 0;i < data.data.result.taskVos.length;i ++) { + //if (merge.black) return ; + console.log( "\n" + data.data.result.taskVos[i].taskType + '-' + data.data.result.taskVos[i].taskName + (appSign&&"(微信小程序)") + '-' + (data.data.result.taskVos[i].status === 1 ? `已完成${data.data.result.taskVos[i].times}-未完成${data.data.result.taskVos[i].maxTimes}` : "全部已完成") ) + let rnd = Math.round(Math.random()*1e6) + let nonstr = randomWord(false,10) + let time = Date.now() + let key = minusByByte(nonstr.slice(0,5),String(time).slice(-5)) + let msg = `inviteId=-1&rnd=${rnd}&stealId=-1&taskId=${data.data.result.taskVos[i].taskId}&token=dzbn7uttoxf3v6kowburzrashgxz9jpq&time=${time}&nonce_str=${nonstr}&key=${key}&is_trust=true` + let sign = bytesToHex(wordsToBytes(getSign(msg))).toUpperCase() + if ([1,3,7,9].includes(data.data.result.taskVos[i].taskType) && data.data.result.taskVos[i].status === 1 ) { + let list = data.data.result.taskVos[i].brandMemberVos||data.data.result.taskVos[i].followShopVo||data.data.result.taskVos[i].shoppingActivityVos||data.data.result.taskVos[i].browseShopVo + //console.log(list) + //if (data.data.result.taskVos[i].taskType === 9) continue + for (let k = data.data.result.taskVos[i].times; k < data.data.result.taskVos[i].maxTimes; k++) { + //body : `functionId=stall_collectProduceScore&body={"ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"fpb\\":\\"xAX3mMUyCgH120XCrQXIZUw==\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"collectProducedCoin\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"-1\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}"}&client=wh5&clientVersion=1.0.0` + for (let j in list) { + if (list[j].status === 1) { + let taskBody = `functionId=stall_collectScore&body={"taskId":${data.data.result.taskVos[i].taskId},"itemId":"${list[j].itemId}","ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"${data.data.result.taskVos[i].taskId}\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"-1\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}","actionType":"1","shopSign":${shopSign}}&client=wh5&clientVersion=1.0.0` + console.log("\n"+(list[j].title||list[j].shopName)) + await stall_collectScore(taskBody,2000) + //} + list[j].status = 2; + break; + } else { + continue; + } + } + } + } + + if ([12,13].includes(data.data.result.taskVos[i].taskType) && data.data.result.taskVos[i].status === 1) { + //let taskBody = `functionId=stall_collectScore&body={"taskId":${data.data.result.taskVos[i].taskId},"itemId":"1","ss":"{\\"extraData\\":{},\\"businessData\\":{},\\"secretp\\":\\"${secretp}\\"}","shopSign":${shopSign}}&client=wh5&clientVersion=1.0.0` + let taskBody = `functionId=stall_collectScore&body={"taskId":${data.data.result.taskVos[i].taskId},"itemId":"1","ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"${data.data.result.taskVos[i].taskId}\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"-1\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}","actionType":"1","shopSign":${shopSign}}&client=wh5&clientVersion=1.0.0` + for (let k = data.data.result.taskVos[i].times; k < data.data.result.taskVos[i].maxTimes; k++) { + if (merge.black) return ; + //if (typeof data.data.result.taskVos[i].simpleRecordInfoVo !== "undefined"){ + // taskBody = encodeURIComponent(`{"dataSource":"newshortAward","method":"getTaskAward","reqParams":"{\\"taskToken\\":\\"${data.data.result.taskVos[i].simpleRecordInfoVo.taskToken}\\"}","sdkVersion":"1.0.0","clientLanguage":"zh"}`) + // await qryViewkitCallbackResult(taskBody,1000) + //} else { + await stall_collectScore(taskBody,3000) + //} + } + } + + if ([2].includes(data.data.result.taskVos[i].taskType) && data.data.result.taskVos[i].status === 1) { + for (let k = data.data.result.taskVos[i].times; k < data.data.result.taskVos[i].maxTimes; k++) { + await stall_getFeedDetail(data.data.result.taskVos[i].taskId) + } + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//获取我的城市 +function stall_myShop(timeout = 0){ + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_myShop`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_myShop&body={"ss":"{\\"extraData\\":{},\\"businessData\\":{},\\"secretp\\":\\"${secretp}\\"}"}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + //console.log('stall_myShop:' + data) + data = JSON.parse(data); + for (let i in data.data.result.shopList) { + // (data.data.result.shopList[i].status === 1) { + //console.log(data.data.result.shopList[i]) + console.log('\n开始城市任务:'+ data.data.result.shopList[i].name)// + '-' + data.data.result.shopList[i].shopId + await stall_getTaskDetail(data.data.result.shopList[i].shopId) + //} + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//逛商城 +function stall_shopSignInWrite(shopSign,timeout = 0){ + return new Promise((resolve) => { + + let rnd = Math.round(Math.random()*1e6) + let nonstr = randomWord(false,10) + let time = Date.now() + let key = minusByByte(nonstr.slice(0,5),String(time).slice(-5)) + let msg = `inviteId=-1&rnd=${rnd}&stealId=-1&taskId=${shopSign}&token=dzbn7uttoxf3v6kowburzrashgxz9jpq&time=${time}&nonce_str=${nonstr}&key=${key}&is_trust=true` + let sign = bytesToHex(wordsToBytes(getSign(msg))).toUpperCase() + + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_shopSignInWrite`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_shopSignInWrite&body={"shopSign":"${shopSign}","ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"${shopSign}\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"-1\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}"}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + if (data.data.bizCode !== 0) { + console.log(data.data.bizMsg) + merge.end = true + } else { + console.log('获得金币' + data.data.result.score) + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//逛商城 +function stall_shopSignInRead(shopSign,timeout = 0){ + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_shopSignInRead`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_shopSignInRead&client=wh5&clientVersion=1.0.0&body={"shopSign":"${shopSign}"}` + } + $.post(url, async (err, resp, data) => { + try { + data = JSON.parse(data); + //console.log(shopSign) + if (data.data.result.signInTag === 0) { + secretp = secretp||data.data.result.secretp + await stall_shopSignInWrite(shopSign) + } else { + console.log('已逛过') + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//收金币 +function stall_collectProduceScore(timeout = 0){ + return new Promise((resolve) => { + let rnd = Math.round(Math.random()*1e6) + let nonstr = randomWord(false,10) + let time = Date.now() + let key = minusByByte(nonstr.slice(0,5),String(time).slice(-5)) + let msg = `inviteId=-1&rnd=${rnd}&stealId=-1&taskId=collectProducedCoin&token=dzbn7uttoxf3v6kowburzrashgxz9jpq&time=${time}&nonce_str=${nonstr}&key=${key}&is_trust=true` + let sign = bytesToHex(wordsToBytes(getSign(msg))).toUpperCase() + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_collectProduceScore`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_collectProduceScore&body={"ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"fpb\\":\\"xAX3mMUyCgH120XCrQXIZUw==\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"collectProducedCoin\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"-1\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}"}&client=wh5&clientVersion=1.0.0` + } + //console.log(url.body) + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + if (data.data.bizCode === -1002) { + //console.log('此账号暂不可使用脚本,脚本终止!') + //merge.black = true; + return ; + } + console.log(`\n收取金币:${data.data.result.produceScore}`) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//获取可偷 +function stall_pk_getStealForms(taskBody,timeout = 0){ + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_pk_getStealForms`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : taskBody + } + $.post(url, async (err, resp, data) => { + try { + console.log(data) + data = JSON.parse(data); + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} +//做任务 +function stall_collectScore(taskBody,timeout = 0){ + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_collectScore`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : taskBody + } + //console.log(url.body) + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + console.log('任务执行结果:' + data.data.bizMsg) + if (data.data.bizCode === -1002) { + await $.wait(1000) + //console.log('此账号暂不可使用脚本,脚本终止!') + //merge.black = true; + return ; + } + if (data.data.bizCode === 0 && typeof data.data.result.taskToken !== "undefined") { + //console.log('需要再次执行,如提示活动异常请多次重试,个别任务多次执行也不行就去APP做吧!') + let taskBody = encodeURIComponent(`{"dataSource":"newshortAward","method":"getTaskAward","reqParams":"{\\"taskToken\\":\\"${data.data.result.taskToken}\\"}","sdkVersion":"1.0.0","clientLanguage":"zh"}`) + //console.log(taskBody) + await qryViewkitCallbackResult(taskBody,8000) + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//查询甄选任务 +function stall_getFeedDetail(taskId,timeout = 0){ + return new Promise((resolve) => { + + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_getFeedDetail`, + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_getFeedDetail&body={"taskId":"${taskId}"}&client=wh5&clientVersion=1.0.0` + } + //console.log(url) + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + let list = data.data.result.viewProductVos||data.data.result.addProductVos + for (let i in list) { + if (list[i].status === 1) { + for (let j in list[i].productInfoVos) { + if (j >= 5) break; + + let rnd = Math.round(Math.random()*1e6) + let nonstr = randomWord(false,10) + let time = Date.now() + let key = minusByByte(nonstr.slice(0,5),String(time).slice(-5)) + let msg = `inviteId=-1&rnd=${rnd}&stealId=-1&taskId=${taskId}&token=dzbn7uttoxf3v6kowburzrashgxz9jpq&time=${time}&nonce_str=${nonstr}&key=${key}&is_trust=true` + let sign = bytesToHex(wordsToBytes(getSign(msg))).toUpperCase() + let taskBody = `functionId=stall_collectScore&body={"taskId":${list[i].taskId},"itemId":"${list[i].productInfoVos[j].skuId}","ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"${taskId}\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"-1\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}","shopSign":""}&client=wh5&clientVersion=1.0.0` + console.log(list[i].productInfoVos[j].skuName) + await stall_collectScore(taskBody,1000) + } + list[i].status = 2 + } + } + + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//做任务2 +function qryViewkitCallbackResult(taskBody,timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `https://api.m.jd.com/?functionId=qryViewkitCallbackResult&client=wh5&clientVersion=1.0.0&body=${taskBody}&_timestamp=`+Date.now(), + headers : { + 'Origin' : `https://bunearth.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `*/*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn`, + 'Content-Type' : 'application/x-www-form-urlencoded', + 'Referer' : 'https://bunearth.m.jd.com/babelDiy/Zeus/4SJUHwGdUQYgg94PFzjZZbGZRjDd/index.html?jmddToSmartEntry=login' + } + } + + $.get(url, async (err, resp, data) => { + try { + //console.log(url.url) + //console.log(data) + data = JSON.parse(data); + console.log(data.toast.subTitle) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +//群组助力 +function stall_pk_assistGroup(inviteId = "XUkkFpUhDG0OdMYzp22uY_lyEaiFin-OxTLmhqosoNJHNIHp84xOJxNmUElr71Un",timeout = 0) { + return new Promise((resolve) => { + let rnd = Math.round(Math.random()*1e6) + let nonstr = randomWord(false,10) + let time = Date.now() + let key = minusByByte(nonstr.slice(0,5),String(time).slice(-5)) + let msg = `inviteId=${inviteId}&rnd=${rnd}&stealId=-1&taskId=2&token=dzbn7uttoxf3v6kowburzrashgxz9jpq&time=${time}&nonce_str=${nonstr}&key=${key}&is_trust=true` + let sign = bytesToHex(wordsToBytes(getSign(msg))).toUpperCase() + //let taskBody = `functionId=stall_collectScore&body={"taskId":2,"itemId":"${data.data.result.homeMainInfo.guestInfo.itemId}","inviteId": "${body}","ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"2\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"${body}\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}"}&client=wh5&clientVersion=1.0.0` + + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_pk_assistGroup` , + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn`, + 'Refer' : `https://bunearth.m.jd.com/babelDiy/Zeus/4SJUHwGdUQYgg94PFzjZZbGZRjDd/index.html?jmddToSmartEntry=login` + }, + body : `functionId=stall_pk_assistGroup&client=wh5&clientVersion=1.0.0&body={"confirmFlag":1,"inviteId": "${inviteId}","ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"2\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"${inviteId}\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}"}` + } + //console.log(url.body) + $.post(url, async (err, resp, data) => { + try { + //console.log('商圈助力:' + data) + data = JSON.parse(data); + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +//获取首页信息 +function stall_getHomeData(body= "",timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_getHomeData` , + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_getHomeData&body={${body ? "\"inviteId\":\"" + body +'\"': ""}}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + //console.log(url.body) + //if (merge.black) return ; + data = JSON.parse(data); + if (data.code === 0) { + if (body !== "") { + //console.log('stall_getHomeData2:' + JSON.stringify(data)) + if (data.data.result.homeMainInfo.guestInfo.status === 0) { + + let rnd = Math.round(Math.random()*1e6) + let nonstr = randomWord(false,10) + let time = Date.now() + let key = minusByByte(nonstr.slice(0,5),String(time).slice(-5)) + let msg = `inviteId=${body}&rnd=${rnd}&stealId=-1&taskId=2&token=dzbn7uttoxf3v6kowburzrashgxz9jpq&time=${time}&nonce_str=${nonstr}&key=${key}&is_trust=true` + let sign = bytesToHex(wordsToBytes(getSign(msg))).toUpperCase() + let taskBody = `functionId=stall_collectScore&body={"taskId":2,"itemId":"${data.data.result.homeMainInfo.guestInfo.itemId}","inviteId": "${body}","ss":"{\\"extraData\\":{\\"is_trust\\":true,\\"sign\\":\\"${sign}\\",\\"time\\":${time},\\"encrypt\\":\\"3\\",\\"nonstr\\":\\"${nonstr}\\",\\"jj\\":\\"\\",\\"token\\":\\"dzbn7uttoxf3v6kowburzrashgxz9jpq\\",\\"cf_v\\":\\"1.0.1\\",\\"client_version\\":\\"2.1.3\\",\\"sceneid\\":\\"homePageh5\\",\\"appid\\":\\"50073\\"},\\"businessData\\":{\\"taskId\\":\\"2\\",\\"rnd\\":\\"${rnd}\\",\\"inviteId\\":\\"${body}\\",\\"stealId\\":\\"-1\\"},\\"secretp\\":\\"${secretp}\\"}"}&client=wh5&clientVersion=1.0.0` + //console.log(taskBody) + //let taskBody = `functionId=stall_collectScore&body={"taskId":2,"itemId":"${data.data.result.homeMainInfo.guestInfo.itemId}","inviteId": "${body}","ss":"{\\"secretp\\":\\"${secretp}\\"}"}&client=wh5&clientVersion=1.0.0` + //console.log(taskBody) + //console.log('开始助力:') + await stall_collectScore(taskBody, 1000) + } + return + } + //console.log('stall_getHomeData:' + JSON.stringify(data)) + secretp = data.data.result.homeMainInfo.secretp + await stall_collectProduceScore(); + await stall_pk_assistGroup() + if (data.data.result.homeMainInfo.raiseInfo.buttonStatus === 2 ) await stall_raise(1000) + await stall_getHomeData('Vl4ISNZnRyNVJf028W76ZuyTXfbtGlbVhbQEF3XxyFux9uadYgA0uao'); + await stall_getTaskDetail("","app") + await stall_getTaskDetail() + } else { + return + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + + +//助力 +function collectFriendRecordColor(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}collectFriendRecordColor` , + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=collectFriendRecordColor&body={"mpin":"RnFgwWRbPDGKy9RP--twXV_3bZt2p2ZADl2v","businessCode":"20118","assistType":"1"}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + console.log(data) + //data = JSON.parse(data); + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +function getEncryptedPinColor(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}getEncryptedPinColor` , + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=getEncryptedPinColor&body={}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + data = JSON.parse(data); + console.log('助力码:'+ data.result) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +function stall_raise(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_raise` , + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_raise&body={}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + console.log('解锁结果:'+ data.data.bizMsg) + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +function qryCompositeMaterials(timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}qryCompositeMaterials` , + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=qryCompositeMaterials&client=wh5&clientVersion=1.0.0&body={"qryParam":"[{\\"type\\":\\"advertGroup\\",\\"mapTo\\":\\"homeFeedBanner\\",\\"id\\":\\"04891279\\"},{\\"type\\":\\"advertGroup\\",\\"mapTo\\":\\"homeBottomBanner\\",\\"id\\":\\"04888981\\"}]","activityId":"4SJUHwGdUQYgg94PFzjZZbGZRjDd","pageId":"","reqSrc":"","applyKey":"raiders_venue_lite"}` + } + $.post(url, async (err, resp, data) => { + try { + //console.log(data) + data = JSON.parse(data); + for (let i in data.data.homeBottomBanner.list) { + if (merge.end) break; + console.log('\n开始逛'+data.data.homeBottomBanner.list[i].name) + await stall_shopSignInRead(data.data.homeBottomBanner.list[i].link) + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +function stall_pk_getHomeData(body = "",timeout = 0) { + return new Promise((resolve) => { + setTimeout( ()=>{ + let url = { + url : `${JD_API_HOST}stall_pk_getHomeData` , + headers : { + 'Origin' : `https://wbbny.m.jd.com`, + 'Cookie' : cookie, + 'Connection' : `keep-alive`, + 'Accept' : `application/json, text/plain, */*`, + 'Host' : `api.m.jd.com`, + 'User-Agent' : `jdapp;iPhone;9.2.0;14.1;`, + 'Accept-Encoding' : `gzip, deflate, br`, + 'Accept-Language' : `zh-cn` + }, + body : `functionId=stall_pk_getHomeData&body={}&client=wh5&clientVersion=1.0.0` + } + $.post(url, async (err, resp, data) => { + try { + if (body !== "") { + await stall_pk_assistGroup(); + } else { + data = JSON.parse(data); + if (data.data.result.groupInfo.groupAssistInviteId.match(/XUkkFpUhDG0OdMYzp22uY_lyEaiFin/)){ + console.log('您的商圈助力码:' + data.data.result.groupInfo.groupAssistInviteId) + } + } + } catch (e) { + $.logErr(e, resp); + } finally { + resolve() + } + }) + },timeout) + }) +} + +function randomWord(randomFlag, min, max){ + let str = "", + range = min, + arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; + // 随机产生 + if(randomFlag){ + range = Math.round(Math.random() * (max-min)) + min; + } + for(let i=0; i>> 5] >>> 24 - e % 32 & 255); + return n +} + +function bytesToHex(t) { + for (var n = [], e = 0; e < t.length; e++) + n.push((t[e] >>> 4).toString(16)), + n.push((15 & t[e]).toString(16)); + return n.join("") +} + +function stringToBytes(t) { + t = unescape(encodeURIComponent(t)) + for (var n = [], e = 0; e < t.length; e++) + n.push(255 & t.charCodeAt(e)); + return n +} + +function bytesToWords(t) { + for (var n = [], e = 0, r = 0; e < t.length; e++, + r += 8) + n[r >>> 5] |= t[e] << 24 - r % 32; + return n +} +function getSign (t) { + t = stringToBytes(t) + var e = bytesToWords(t) + , i = 8 * t.length + , a = [] + , s = 1732584193 + , u = -271733879 + , c = -1732584194 + , f = 271733878 + , h = -1009589776; + e[i >> 5] |= 128 << 24 - i % 32, + e[15 + (i + 64 >>> 9 << 4)] = i; + for (var l = 0; l < e.length; l += 16) { + for (var p = s, g = u, v = c, d = f, y = h, m = 0; m < 80; m++) { + if (m < 16) + a[m] = e[l + m]; + else { + var w = a[m - 3] ^ a[m - 8] ^ a[m - 14] ^ a[m - 16]; + a[m] = w << 1 | w >>> 31 + } + var _ = (s << 5 | s >>> 27) + h + (a[m] >>> 0) + (m < 20 ? 1518500249 + (u & c | ~u & f) : m < 40 ? 1859775393 + (u ^ c ^ f) : m < 60 ? (u & c | u & f | c & f) - 1894007588 : (u ^ c ^ f) - 899497514); + h = f, + f = c, + c = u << 30 | u >>> 2, + u = s, + s = _ + } + s += p, + u += g, + c += v, + f += d, + h += y + } + return [s, u, c, f, h] +} +//初始化 +function initial() { + merge = { + nickname: "", + enabled: true, + end: false, + black: false + } + for (let i in merge) { + merge[i].success = 0; + merge[i].fail = 0; + merge[i].prizeCount = 0; + merge[i].notify = ""; + merge[i].show = true; + } +} +//通知 +function msgShow() { + console.log("\n\n京东账号:"+merge.nickname + ' 任务已做完!\n如有未完成的任务,请多执行几次') + //$.msg($.Name,"","京东账号:"+merge.nickname + ' 任务已做完!\n如有未完成的任务,请多执行几次') +} + +function Env(t,s){return new class{constructor(t,s){this.name=t,this.data=null,this.dataFile="box.dat",this.logs=[],this.logSeparator="\n",this.startTime=(new Date).getTime(),Object.assign(this,s),this.log("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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}getScript(t){return new Promise(s=>{$.get({url:t},(t,e,i)=>s(i))})}runScript(t,s){return new Promise(e=>{let i=this.getdata("@chavy_boxjs_userCfgs.httpapi");i=i?i.replace(/\n/g,"").trim():i;let o=this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");o=o?1*o:20,o=s&&s.timeout?s.timeout:o;const[h,a]=i.split("@"),r={url:`http://${a}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:o},headers:{"X-Key":h,Accept:"*/*"}};$.post(r,(t,s,i)=>e(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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s);if(!e&&!i)return{};{const i=e?t:s;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),s=this.path.resolve(process.cwd(),this.dataFile),e=this.fs.existsSync(t),i=!e&&this.fs.existsSync(s),o=JSON.stringify(this.data);e?this.fs.writeFileSync(t,o):i?this.fs.writeFileSync(s,o):this.fs.writeFileSync(t,o)}}lodash_get(t,s,e){const i=s.replace(/\[(\d+)\]/g,".$1").split(".");let o=t;for(const t of i)if(o=Object(o)[t],void 0===o)return e;return o}lodash_set(t,s,e){return Object(t)!==t?t:(Array.isArray(s)||(s=s.toString().match(/[^.[\]]+/g)||[]),s.slice(0,-1).reduce((t,e,i)=>Object(t[e])===t[e]?t[e]:t[e]=Math.abs(s[i+1])>>0==+s[i+1]?[]:{},t)[s[s.length-1]]=e,t)}getdata(t){let s=this.getval(t);if(/^@/.test(t)){const[,e,i]=/^@(.*?)\.(.*?)$/.exec(t),o=e?this.getval(e):"";if(o)try{const t=JSON.parse(o);s=t?this.lodash_get(t,i,""):s}catch(t){s=""}}return s}setdata(t,s){let e=!1;if(/^@/.test(s)){const[,i,o]=/^@(.*?)\.(.*?)$/.exec(s),h=this.getval(i),a=i?"null"===h?null:h||"{}":"{}";try{const s=JSON.parse(a);this.lodash_set(s,o,t),e=this.setval(JSON.stringify(s),i)}catch(s){const h={};this.lodash_set(h,o,t),e=this.setval(JSON.stringify(h),i)}}else e=$.setval(t,s);return e}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,s){return this.isSurge()||this.isLoon()?$persistentStore.write(t,s):this.isQuanX()?$prefs.setValueForKey(t,s):this.isNode()?(this.data=this.loaddata(),this.data[s]=t,this.writedata(),!0):this.data&&this.data[s]||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,s=(()=>{})){t.headers&&(delete t.headers["Content-Type"],delete t.headers["Content-Length"]),this.isSurge()||this.isLoon()?$httpClient.get(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)}):this.isQuanX()?$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,s)=>{try{const e=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(e,null),s.cookieJar=this.ckjar}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t)))}post(t,s=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),delete t.headers["Content-Length"],this.isSurge()||this.isLoon())$httpClient.post(t,(t,e,i)=>{!t&&e&&(e.body=i,e.statusCode=e.status),s(t,e,i)});else if(this.isQuanX())t.method="POST",$task.fetch(t).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t));else if(this.isNode()){this.initGotEnv(t);const{url:e,...i}=t;this.got.post(e,i).then(t=>{const{statusCode:e,statusCode:i,headers:o,body:h}=t;s(null,{status:e,statusCode:i,headers:o,body:h},h)},t=>s(t))}}time(t){let s={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let e in s)new RegExp("("+e+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[e]:("00"+s[e]).substr((""+s[e]).length)));return t}msg(s=t,e="",i="",o){const h=t=>!t||!this.isLoon()&&this.isSurge()?t:"string"==typeof t?this.isLoon()?t:this.isQuanX()?{"open-url":t}:void 0:"object"==typeof t&&(t["open-url"]||t["media-url"])?this.isLoon()?t["open-url"]:this.isQuanX()?t:void 0:void 0;this.isSurge()||this.isLoon()?$notification.post(s,e,i,h(o)):this.isQuanX()&&$notify(s,e,i,h(o)),this.logs.push("","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="),this.logs.push(s),e&&this.logs.push(e),i&&this.logs.push(i)}log(...t){t.length>0?this.logs=[...this.logs,...t]:console.log(this.logs.join(this.logSeparator))}logErr(t,s){const e=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();e?$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):$.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(s=>setTimeout(s,t))}done(t={}){const s=(new Date).getTime(),e=(s-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${e} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,s)} diff --git a/Task/jd_lotteryMachine.js b/Task/jd_lotteryMachine.js index 88b05dba42..283966fbf1 100644 --- a/Task/jd_lotteryMachine.js +++ b/Task/jd_lotteryMachine.js @@ -1,7 +1,7 @@ /* 京东抽奖机 -更新时间:2020-11-06 13:12 -脚本说明:四个抽奖活动,【东东抽奖机】【新店福利】【东东福利屋】【东东生活】,点通知只能跳转一个,入口在京东APP玩一玩里面可以看到 +更新时间:2020-11-07 21:42 +脚本说明:五个抽奖活动,【东东抽奖机】【新店福利】【东东福利屋】【东东生活】【闪购盲盒】,点通知只能跳转一个,入口在京东APP玩一玩里面可以看到 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js // quantumultx [task_local] @@ -19,8 +19,8 @@ const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; const STRSPLIT = "|"; const needSum = false; //是否需要显示汇总 const printDetail = false; //是否显示出参详情 -const appIdArr = ['1EFRQxQ','1EFRQxA','1EFRQxw','1EFRQyw'] -const shareCodeArr = ['P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0','P04z54XCjVXmIaW5m9cZ2f433tIlGWEga-IO2o','P04z54XCjVXm4aW5m9cZ2f433tIlINrBDzgMdY','P04z54XCjVXl4aW5m9cZ2f433tIlHQIDDSzFzg'] +const appIdArr = ['1EFRQxQ','1EFRQxA','1EFRQxw','1EFRQyw','1EFRRxA'] +const shareCodeArr = ['P04z54XCjVXmYaW5m9cZ2f433tIlGBj3JnLHD0','P04z54XCjVXmIaW5m9cZ2f433tIlGWEga-IO2o','P04z54XCjVXm4aW5m9cZ2f433tIlINrBDzgMdY','P04z54XCjVXl4aW5m9cZ2f433tIlHQIDDSzFzg','P04z54XCjVWmIaW5m9cZ2f433tIlJz4FjX2kfk'] //const funPrefixArr = ['interact_template','interact_template','wfh'] //IOS等用户直接用NobyDa的jd cookie let cookiesArr = [], cookie = ''; @@ -123,7 +123,7 @@ function interact_template_getHomeData(timeout = 0) { for (let i = 0;i < data.data.result.taskVos.length;i ++) { console.log("\n" + data.data.result.taskVos[i].taskType + '-' + data.data.result.taskVos[i].taskName + '-' + (data.data.result.taskVos[i].status === 1 ? `已完成${data.data.result.taskVos[i].times}-未完成${data.data.result.taskVos[i].maxTimes}` : "全部已完成")) //签到 - if (data.data.result.taskVos[i].taskType === 13) { + if ([0,13].includes(data.data.result.taskVos[i].taskType)) { if (data.data.result.taskVos[i].status === 1) { await harmony_collectScore(data.data.result.taskVos[i].simpleRecordInfoVo.taskToken,data.data.result.taskVos[i].taskId); } @@ -290,4 +290,4 @@ function msgShow() { -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file +function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} From 96c3f6bbf74cf304a908ae07f54beff69ed3fc68 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Wed, 11 Nov 2020 22:37:20 +0800 Subject: [PATCH 251/266] Delete LICENSE --- LICENSE | 72 --------------------------------------------------------- 1 file changed, 72 deletions(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index b8e7853f41..0000000000 --- a/LICENSE +++ /dev/null @@ -1,72 +0,0 @@ -Copyright (c) [Year] [name of copyright holder] - [Software Name] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. - - - Mulan Permissive Software License,Version 2 - - Mulan Permissive Software License,Version 2 (Mulan PSL v2) - January 2020 http://license.coscl.org.cn/MulanPSL2 - - Your reproduction, use, modification and distribution of the Software shall be subject to Mulan PSL v2 (this License) with the following terms and conditions: - - 0. Definition - - Software means the program and related documents which are licensed under this License and comprise all Contribution(s). - - Contribution means the copyrightable work licensed by a particular Contributor under this License. - - Contributor means the Individual or Legal Entity who licenses its copyrightable work under this License. - - Legal Entity means the entity making a Contribution and all its Affiliates. - - Affiliates means entities that control, are controlled by, or are under common control with the acting entity under this License, ‘control’ means direct or indirect ownership of at least fifty percent (50%) of the voting power, capital or other securities of controlled or commonly controlled entity. - - 1. Grant of Copyright License - - Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable copyright license to reproduce, use, modify, or distribute its Contribution, with modification or not. - - 2. Grant of Patent License - - Subject to the terms and conditions of this License, each Contributor hereby grants to you a perpetual, worldwide, royalty-free, non-exclusive, irrevocable (except for revocation under this Section) patent license to make, have made, use, offer for sale, sell, import or otherwise transfer its Contribution, where such patent license is only limited to the patent claims owned or controlled by such Contributor now or in future which will be necessarily infringed by its Contribution alone, or by combination of the Contribution with the Software to which the Contribution was contributed. The patent license shall not apply to any modification of the Contribution, and any other combination which includes the Contribution. If you or your Affiliates directly or indirectly institute patent litigation (including a cross claim or counterclaim in a litigation) or other patent enforcement activities against any individual or entity by alleging that the Software or any Contribution in it infringes patents, then any patent license granted to you under this License for the Software shall terminate as of the date such litigation or activity is filed or taken. - - 3. No Trademark License - - No trademark license is granted to use the trade names, trademarks, service marks, or product names of Contributor, except as required to fulfill notice requirements in Section 4. - - 4. Distribution Restriction - - You may distribute the Software in any medium with or without modification, whether in source or executable forms, provided that you provide recipients with a copy of this License and retain copyright, patent, trademark and disclaimer statements in the Software. - - 5. Disclaimer of Warranty and Limitation of Liability - - THE SOFTWARE AND CONTRIBUTION IN IT ARE PROVIDED WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL ANY CONTRIBUTOR OR COPYRIGHT HOLDER BE LIABLE TO YOU FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO ANY DIRECT, OR INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING FROM YOUR USE OR INABILITY TO USE THE SOFTWARE OR THE CONTRIBUTION IN IT, NO MATTER HOW IT’S CAUSED OR BASED ON WHICH LEGAL THEORY, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - 6. Language - - THIS LICENSE IS WRITTEN IN BOTH CHINESE AND ENGLISH, AND THE CHINESE VERSION AND ENGLISH VERSION SHALL HAVE THE SAME LEGAL EFFECT. IN THE CASE OF DIVERGENCE BETWEEN THE CHINESE AND ENGLISH VERSIONS, THE CHINESE VERSION SHALL PREVAIL. - - END OF THE TERMS AND CONDITIONS - - How to Apply the Mulan Permissive Software License,Version 2 (Mulan PSL v2) to Your Software - - To apply the Mulan PSL v2 to your work, for easy identification by recipients, you are suggested to complete following three steps: - - i Fill in the blanks in following statement, including insert your software name, the year of the first publication of your software, and your name identified as the copyright owner; - - ii Create a file named “LICENSE” which contains the whole context of this License in the first directory of your software package; - - iii Attach the statement to the appropriate annotated syntax at the beginning of each source file. - - - Copyright (c) [Year] [name of copyright holder] - [Software Name] is licensed under Mulan PSL v2. - You can use this software according to the terms and conditions of the Mulan PSL v2. - You may obtain a copy of Mulan PSL v2 at: - http://license.coscl.org.cn/MulanPSL2 - THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - See the Mulan PSL v2 for more details. From 1726ae7ab7b63550859ba31dcaa1a789de44e231 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Wed, 11 Nov 2020 22:37:48 +0800 Subject: [PATCH 252/266] Create LICENSE --- LICENSE | 1 + 1 file changed, 1 insertion(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/LICENSE @@ -0,0 +1 @@ + From 452f42335374d3389d56a86c468e91fcc43f0f0c Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Wed, 11 Nov 2020 22:50:24 +0800 Subject: [PATCH 253/266] Delete LICENSE --- LICENSE | 1 - 1 file changed, 1 deletion(-) delete mode 100644 LICENSE diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 8b13789179..0000000000 --- a/LICENSE +++ /dev/null @@ -1 +0,0 @@ - From 2c5768b6b605e4b7a04ce016f94bd3dd3baa4153 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Wed, 11 Nov 2020 23:26:48 +0800 Subject: [PATCH 254/266] Delete test.yml --- .workflow/test.yml | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .workflow/test.yml diff --git a/.workflow/test.yml b/.workflow/test.yml deleted file mode 100644 index 8fbd35db80..0000000000 --- a/.workflow/test.yml +++ /dev/null @@ -1,23 +0,0 @@ -# ======================================================== -# npm 构建参考流水线样例 -# 功能:输出当前 npm 构建环境的环境信息 -# ======================================================== -name: gitee-go-npm-example # 定义一个唯一 ID 标识为 gitee-go-npm-example,名称为 “npm-流水线示例” 的流水线 -displayName: 'npm-流水线示例' -triggers: # 流水线触发器配置 - push: # 设置 master 分支 在产生代码 push 时精确触发(PRECISE)构建 - - matchType: PRECISE - branch: master -commitMessage: '' # 通过匹配当前提交的 CommitMessage 决定是否执行流水线 -stages: # 构建阶段配置 - - stage: # 定义一个 ID 标识为 npm-build-stage ,名为 “npm Stage” 的阶段 - name: npm-build-stage - displayName: 'npm Stage' - failFast: false # 允许快速失败,即当 Stage 中有任务失败时,直接结束整个 Stage - steps: # 构建步骤配置 - - step: npmbuild@1 # 采用 npm 编译环境 - name: npm-build # 定义一个 ID 标识为 npm-build ,名为 “npm Step” 的阶段 - displayName: 'npm Step' - inputs: # 构建输入参数设定 - nodeVersion: 10.1 # 指定 node 环境版本为 10.1 - goals: "node -v && npm -v" # 输出 构建环境 Node 和 npm 信息 \ No newline at end of file From c42dd0de22782deb51ed7b4543969bbbcda930c4 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Thu, 12 Nov 2020 00:54:40 +0800 Subject: [PATCH 255/266] Create LICENSE --- LICENSE | 661 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 661 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000000..dbbe355815 --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. From 6293d2bc69701a7ba40485dac9f8898a25dcf60c Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Thu, 12 Nov 2020 01:06:13 +0800 Subject: [PATCH 256/266] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eab9a7267a..1fb95d98d7 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,12 @@ ### 特别感谢: -* [@NobyDa](https://github.com/NobyDa) * [@chavyleung](https://github.com/chavyleung) +* [@NobyDa](https://github.com/NobyDa) + +* [@lxk0301](https://github.com/lxk0301) + +* [@id77_Github](https://github.com/id77) + From 4e8b41669d2517f95485ad2dccaad92e60bdba48 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Thu, 12 Nov 2020 09:46:35 +0800 Subject: [PATCH 257/266] Delete jd_starStore.js --- Task/jd_starStore.js | 309 ------------------------------------------- 1 file changed, 309 deletions(-) delete mode 100644 Task/jd_starStore.js diff --git a/Task/jd_starStore.js b/Task/jd_starStore.js deleted file mode 100644 index f03e68f6eb..0000000000 --- a/Task/jd_starStore.js +++ /dev/null @@ -1,309 +0,0 @@ -/* -京东星店长 -更新时间:2020-11-04 08:27 -脚本说明: -第一次执行会循环 8--86号店铺,时间比较长,后面会判断,做完86的不再全部做,每天运行一次即可 -使用前请先看下活动介绍,可能会关注店铺,入会是假入会,入会任务可能不会完成 -此脚本仅做任务,需要拉人头才能参与瓜分,请按需使用 -活动进入方式:京东app搜索【星店长】 -5 9 * * * https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/scripts/jd/jd_starStore.js, tag=京东星店长, img-url=https://raw.githubusercontent.com/yangtingxiao/QuantumultX/master/image/jd.png, enabled=true - -*/ -const $ = new Env('京东星店长'); -//Node.js用户请在jdCookie.js处填写京东ck; -const jdCookieNode = $.isNode() ? require('./jdCookie.js') : ''; -//IOS等用户直接用NobyDa的jd cookie -let cookiesArr = [], cookie = ''; -if ($.isNode()) { - Object.keys(jdCookieNode).forEach((item) => { - cookiesArr.push(jdCookieNode[item]) - }) -} else { - cookiesArr.push($.getdata('CookieJD')); - cookiesArr.push($.getdata('CookieJD2')); -} -const JD_API_HOST = `https://api.m.jd.com/client.action?functionId=`; -!(async () => { - if (!cookiesArr[0]) { - $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); - return; - } - for (let i = 0; i < cookiesArr.length; i++) { - cookie = cookiesArr[i]; - if (cookie) { - console.log('**********************分割线**********************') - initial(); - await QueryJDUserInfo(); - if (!merge.enabled) //cookie不可用 - { - $.setdata('', `CookieJD${i ? i + 1 : "" }`);//cookie失效,故清空cookie。 - $.msg($.name, `【提示】京东账号${i + 1} cookie已过期!请先获取cookie\n直接使用NobyDa的京东签到获取`, 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); - continue; - } - if (Date.now() > Date.parse('2020-11-12')){ - $.msg($.Name,"","活动已结束,请删除或禁用脚本!"); - return - } - let shopId = 0; - let now = new Date(); - //await mcxhd_starmall_taskList(86); //做最后一个,看是否做完 - //if (!merge.end) { - for (shopId = 8; shopId <87 ; shopId ++ ) { - console.log('\n开始店铺:' + shopId) - await mcxhd_starmall_taskList(shopId); - } - //} - //merge.end = false; - if (now.getDate() === 3) shopId = 2; - if (now.getDate() === 4) shopId = 2; - if (now.getDate() === 5) shopId = 3; - if (now.getDate() === 6) shopId = 3; - if (now.getDate() === 7) shopId = 4; - if (now.getDate() === 8) shopId = 4; - if (now.getDate() === 9) shopId = 5; - if (now.getDate() === 10) shopId = 6; - if (now.getDate() === 11) shopId = 7; - await mcxhd_starmall_taskList(shopId); - await msgShow(); - } - } -})() - .catch((e) => $.logErr(e)) - .finally(() => $.done()) - - -//获取昵称(直接用,勿删) -function QueryJDUserInfo(timeout = 0) { - return new Promise((resolve) => { - setTimeout( ()=>{ - let url = { - url : `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`, - headers : { - 'Referer' : `https://wqs.jd.com/my/iserinfo.html`, - 'Cookie' : cookie - } - } - $.get(url, (err, resp, data) => { - try { - data = JSON.parse(data); - if (data.retcode === 13) { - merge.enabled = false - return - } - merge.nickname = data.base.nickname; - } catch (e) { - $.logErr(e, resp); - } finally { - resolve() - } - }) - },timeout) - }) -} - -//查询 -function mcxhd_starmall_taskList(shopId,timeout = 0){ - return new Promise((resolve) => { - setTimeout( ()=>{ - let url = { - url : `${JD_API_HOST}mcxhd_starmall_taskList&appid=jd_mp_h5&body=%7B%22shopId%22:%22${shopId}%22,%22token%22:%22jd6df03bd53f0f292f%22%7D&loginType=2`, - headers : { - 'Origin' : `https://h5.m.jd.com`, - 'Cookie' : cookie, - 'Connection' : `keep-alive`, - 'Accept' : `application/json, text/plain, */*`, - 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/4DEZi5iUgrNLD9EWknrGZhCjNv7V/index.html`, - 'Host' : `api.m.jd.com`, - 'Accept-Encoding' : `gzip, deflate, br`, - 'Accept-Language' : `zh-cn` - } - } - $.get(url, async (err, resp, data) => { - try { - data = JSON.parse(data); - if (data.retCode !== "200") { - console.log(data.retMessage) - return - } - console.log('\n星店长:'+data.result.starName) - for (let i in data.result.tasks) { - if (merge.end) return ; - //if (data.result.tasks[i].taskType !== "7"){ - // continue - //} else { - // console.log(data.result.tasks[i].subItem[0].itemId) - // return - //} - if (data.result.tasks[i].taskType !== "7") console.log('\n开始做任务:' + data.result.tasks[i].taskName) - if (data.result.tasks[i].status === 0 ) { - for (let j in data.result.tasks[i].subItem) { - await mcxhd_starmall_doTask(shopId,data.result.tasks[i].taskType,data.result.tasks[i].subItem[j].itemId) - } - } else { - //console.log(data.result.tasks[i].taskType) - console.log('已完成') - if (data.result.tasks[i].taskType === "1") { - console.log('签到已完成,本店任务跳过') - break - } - } - } - } catch (e) { - $.logErr(e, resp); - } finally { - resolve() - } - }) - },timeout) - }) -} - -//做任务 -function mcxhd_starmall_doTask(shopId,taskType,itemId,timeout = 0){ - return new Promise((resolve) => { - setTimeout( ()=>{ - if (taskType === "7") itemId = shareCode[shopId];// '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8zYv7WVIxFMVj1lV2pKDjARLLbNU_JV-gpnPfE9HW-02KqFUKGtvxAhB0qpzIrZwdSu-yZTRWQMbBwd4k2XPmFHDqa'; - let url = { - url : `${JD_API_HOST}mcxhd_starmall_doTask&appid=jd_mp_h5&body=%7B%22itemId%22:%22${itemId}%22,%22taskType%22:%22${taskType}%22,%22shopId%22:%22${shopId}%22,%22token%22:%22jd6df03bd53f0f292f%22%7D&loginType=2`, - headers : { - 'Origin' : `https://h5.m.jd.com`, - 'Cookie' : cookie, - 'Connection' : `keep-alive`, - 'Accept' : `*/*`, - 'Referer' : `https://h5.m.jd.com/babelDiy/Zeus/4DEZi5iUgrNLD9EWknrGZhCjNv7V/index.html?shopId=${shopId}&inviteId=${shareCode[shopId]}&babelChannel=ttt1`, - 'Host' : `api.m.jd.com`, - 'Accept-Encoding' : `gzip, deflate, br`, - 'Accept-Language' : `zh-cn` - } - } - $.get(url, async (err, resp, data) => { - try { - //console.log(url.url) - //console.log(data) - data = JSON.parse(data); - if (taskType !== "7") console.log(data.retMessage) - } catch (e) { - $.logErr(e, resp); - } finally { - resolve() - } - }) - },timeout) - }) -} - -var shareCode = [ - '', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwzfupaUAaCzThSWkJH-rWzkE1CiSqcKjixdbItXLI36wd2PRn53FF3Qd83QaH-eksFJaOtrv6OeY7ZPZxBlToRqbNRrw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8zYv7WVIxFMVj1lV2pKDjARLLbNU_JV-gpnPfE9HW-02KqFUKGtvxAhB0qpzIrZwdSu-yZTRWQMbBwd4k2XPmFHDqa', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4zzIuAP9ftTzuEao3sXWuGLLpFCZ5icB_-WvBMpD6Go5-HLIIV5iGRwTgj8stXlkisI8N_5JhwQsD7GQ4LGsgvJ_Wruw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkzagijopM6HP9i8jM8Hvo2CfFhtPmUIBcG2gmTDdvOg_bCvQS9LROdHNxp2CaqYwdqkm5goAePm-yVeRUMoYj_dRnugg', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgzSEllgoZFO2Qm8oFmt0Q4mow9dCzWpinng8olsX7EMifKAGeDMVk7_oaIVQPCbC9-VtlD_hzdK811DMzScm33McGt', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfszf6XfbSkVmvZ41eDovmsK1hM-13auIalW_2Mj5eLGaScrZA_euWAVL3G95wbuAV8viZaEFCcUPGUmCwe5VZd-mTzilw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfoza8K0IpL9mvWLveI1os5oJp2dTVcxqcNGK_we7REPVSOQHIRX47scO74cIkYQOB6T_S6RhuILYyMUbS4BPjRvYbO06g', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUzFOD-4F8YdcGyLhJdtLVbkV1zpvhNUdZVO_auO4PKrbCS3XQffPgTvdVQpelJiK3roby2J2TZV9EBDwmkaotEL7jQSQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfQzcjir8SeH7RnnwOFgXTwfTeoyrdK7ZaR-SBmLf3RsY--v7DpVA7H5rjSgRFZCgbfm-Z0M6nvxkVmWAzsU3B97Gcw7iA', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwhwhxjv9goOzjcVIHpVqBrcgAu1QDzjWRmis99vVsRXHAfdITKHZWgSKYP4rTiNmILf3hhGBKRt3nwWYelfcfx3tByzQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwg1GkpMYts8kEYMM2UgyMYF8s7hGmA3s9SGNYAns7xhs_og6O6QR7O-JtMWGMcG1iEPf-H9L85wein_wFn1mVM-sCA0V8', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwj5lnjD6wrhVGo0oN2nUU-aYNeqA-PDItHq9HQhFppDm8vvcs622gpz-0BVf5ftyaVigNkqZLf2veMaRgeGcEUXv7h8N0', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwiej9xjZP0LbnLloPCge1bsVtIH7k2tYk4mUw-ntWz2Cn46Iy1E4tOhSOL-Dyx-tfnhAPyy2adQ8Jln8-NlLp6iToiNTw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwlOWoIwiLSKbuDSbp6V-f6tZd5dZ7pHcl1Rmw5UYW8ugOuFtG1obW1eMGitMUo87QRUbPSKilOxYXXGTKDYSU-PU4KTg', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwkEyo_2Xqhtn8UM5huWU49Yu2ogT4bguZxlaguPeK5l2Qj88DZeTmPUVVHY0zW4ov2geKLvKHqO4wHoOFL7Oa1ruI59TQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwniukeK0jGMdPRHf7_w5TEv4yKLIq5ifuYOHX9Nv2wVUkOp2OnXrhrMdIuFpPuqY_wUgIgXbV7J1mOnQpHr2dd4SYldQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwmXvcUbGY9LbbkDifMWqHOdmpi9ks5VS1KiGauQZjnyuGH8S-1_GTd5IKrecfzbAE24D0QtfSGw8XVQDZv8alrDZ1iFA', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwpBn9H4cZ55ZHQXbHyK64A6XkWjfzxsJNIl7_cgBfmqDGnnQRs2FNDxi-gJ1m-LoBHAYDuaW47H_ON8aBYJDEZohEiLGY', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfwoDFjEn_bARCtQnOAU-aQtTTdvLHbUeMcdncaUPqMVCCzAJekDdSDcoFvRdYfLvbGKvnqNfRT1Ra1EjKoNqVzxurhcCw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8hYAlTUnHWn0lIqm0wmbkyMT_ZiCBePGEwwqUOUokFoSk1PMMwmYHmkd_cq_0uWHy0tEwLkCwBSBRrqTaDDSp80h2aEKo', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8g-ERlkoyFzDfwGNc4ujzFPPpVPDav6KLvNJToaZyngBY1gX8i3LpYkFYTG7UsC0HsdBeHmy_xvECm84qlXHwIoGBV2rk', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8jg4H-3mtslFtHHj5odslZizbzquoy0KJPp_ZcaPJfmEWGakJGkXr0xuLh-5pzESdP7DZDDPuyx7TOk-Vr-GdD9d4MzQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8iaLgHXA9kP1Gab0-LjixH1XbYRSyvDh8U_Bz0U2Tjc5JpjuM3Zrub4EcS-nFbaObQiOKOCHIKZuBn1Q91hLblDfQtYx0', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8luvOmnSUBSuwwQV_84Z8bcEt3CRzSTz2RQS016aI8wuaCzgjpnxUxCOtD8lGIGSQfkERRzxW1T2t2qSaOjb4aPEJ-Jx0', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8kbKT3QJERdmecdKDkHSoMoXSniWOQsn-QIAxV6DdMFtaCVtSkaN8ZAbAYsq4ASWNiBuNGGR8kD2cmoSvmIdKnuhztNw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8nNTbJHovvbC-2gPbI5KOgt2zghQehOj9cRCiG4vCC7JoRTNqmIkjSLhRbbI-UhQQ4qV6VoZuc2opMo3DqGmVV5buJycQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8mQGt4VfZKRvRhI5ILdBLkxXar2g51KytOYsbHkHdExbreOWA54eVdlkiPEoaJJMG8LUBZ7iZ8-E5INsHrdA1ZG7deRh4', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8pLXJYHI-a8nHXvxfeGZ4Wx9xbU7BcN19iGczuIIrUqFOS38wC2KeBH1oChm-JIH0EhtlEmUnqzhVLRE-K4mMLWQh72w', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf8okmHdcCdskP7LmeBLQiN9reOaSydRb1rl1SrM8gMHJTci93Pjvcls9dqlWalYLm8sBFzieqAVD6nCyBB2G2sPu-PiUmg', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4hOcHPA4zCjLnErqe9LD5c8E8gRs4rBf4KkPYCbKVvgF68nefvxa0BS5SFumwHJsT8wW6RdTd867QCewf4Udlp7-ygiA', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4gv7ktxxXawJyq73ZXSDDO3K3W4XdaPCHnm9Fhi2bH9kAj7wOd_FPpHhoLc9oEHW6JHBVkC15igau8ppEDn6b9PADFmgo', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4jSN_mDWvfNa5RrLTavB-U9YOF-6G0HyZa5RXdQ-QrNmVT9Oo0_SjPOtDWAeBC2hYdlAx-QmhHAXS4yB-3YEGDRJiwf54', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4i59rZPbyugO3dSl_y3r71j5kre0TVzA8Mn_ejcxaF9nszVzBmMcWNFJCv4qR9j9C6y-m4EOA27TJE6lIse8pIqPtiGzM', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4le55QaxXu2zOLDO53A0S5tDUVyoQjqihzMn43fMRajKaMeobc3_lYTJNWRbuufGpzZjbSJqODeeJSIOTkSm-NhFMnsL4', - '活动不存在或已结束,试试其他活动吧~', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4nVvBWxlihhrqqtJhrVGMzep75ykmRsh0RYafgHWA1DJhDcZn12n6L-82KG5NFY3gD7UI5IxliqAoKSj6vhJy7FAtSwA', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4mLJGS2hwyI05jqfoxqpX_fLOBWLhLJedkAZCNWZe_N7n5xIm5_K17KyNSTK2B5Xd-xVXC-vktUvxHJt8QbYDVcRL4OIY', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4pljzS2kzg32QlbdWIhIm4DcTeqsZ46Xehmm3-X5Nk5ZkAwXgLXY98IGZYKVqBmnqetu8iXtOcWKeA3BUeuyjwk2_TiKc', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWf4oEBZPcxERcmVGNMEUXy8y6E-cqbbfnR63aUrz5H7Yo6vc8L1E0SyHbI3d6N4b2CrQ_cLS8Voux-npXu8WbABWYfrUmQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkhDsSrdkcVGK3VTommsDKAvYw0l6HweWIWVOjHViJGyWGC38WVh963S5Ud1PAt4EQlV1MmI7jNTdQ5sk1iG8ZomoiZazQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkgy97snot-BF6Y0n9yUo6v0AN7ylo5Jbe0cB5T8A0783IPCGqMCm3yn-rOL395ebEQaM-nw6Da5Ap3Ias-VLHpIxeB8NE', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkjXCW2KTTC26wxgkilM-7gp6oP-EceBlbS7SH5xeHFkR4RmW3VotHe-F9kJFDZRbdGIPd5ATI38KQ6QHShR1zFb0Q3CQU', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkiBmW2WsEkjXxdxhQfNXDc8wfa-p9jwesxxnCOZZ0jBWF1gW5VespnUODpkyKDhz3g2LeKhup9EEdyp0kHoNe-Tm3bDyk', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfklnO45rRYZjmyo0tMWIEQIt2PjL0cEZWiUop4NmuzSvoMvQwamflWB2nR0HUzAq7JBA_lCgRGgpO7f-OSSu4y_bkZXZA', - '活动不存在或已结束,试试其他活动吧~', - '活动不存在或已结束,试试其他活动吧~', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfkmCjT4RXQOEO1JuKHUbhTy4jTDchNxUn5-n5HNHX6Mqptvx2i8lOe_cfYziWW_KbwN5iZfGd0mEiOM2qrPkWFayz-VMaw', - '活动不存在或已结束,试试其他活动吧~', - '活动不存在或已结束,试试其他活动吧~', - '活动不存在或已结束,试试其他活动吧~', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfggMxZjZNCAb9v9v2mWjs7bl2RxHBJWrCEV4xjJ9NBSese836v2mfKFfc2tv9SrjmhycjvhTqXR3CBmCrWEVbw_fljmrQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgj6GYEtRUHqfbhnsvLlCTSV-jTYvQR_t8SCOOABo2vxzkDDCaRXDDv2MUrOps5NumniB5MDKkoU5BVCxEikisRgsnPYd0', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgitlDQvhA0gqfgXU0UfYkrTuOXJnst9JYdbW5yHLe41n6RtD_pMMp2zc1SBIloFjmNFaeaUP1clWcOGqtV4wbLTeGLAKY', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgl0vbXXC9JdSAWkC-vVrO9vmU82R3qkl1oBmb9pNdjxgiDaklmSNZzhKSfieRcJ-Mn8y0o01XmiLQ6lWg7Tj-RdDyrig', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgkvQ0bu6XWOuaKd5H28f-yXxgdhMmK5RyAW9TzjtIskHb4QHYhqNATons0UdM3YjqizMaOKb5o373TDItVq5gvTG8fat0', - '活动不存在或已结束,试试其他活动吧~', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgmVp8WCv8r_aeQECSQZLMnp4ZxgGpbkZazZQETws2UMPvcMJeYaXH6SBG3ax6bwcmDW73vzOd9Qqcea625puk_oTdAln8', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgpHAaEY1G-5u_B-Hh6N0ua6psMP8lmBLSikCLnYmc5RONZxeHqyruE7TPlV44cwrCYYlS2lakReHT9HZqJ9EZyRhBBN_w', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfgozwf1YShpYwumLKrL2ds-Ag81fYt_1cAv52t7qDr42NdQFFaopeqjh6VRtU_aiNImgvJJ32UbedSst8YDL5JSEQ8Jl0Q', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfshzgVN_NDaq8FF1xcXks1Of81nzViBaivBA1KiwyeHh_cXdtE9jJbEpTStq8KmaT9B-LjEJNlR-7sBpUDHhZww7B6iCXM', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsgP4D0AfC15vH5HIIregOPLqDnr78boGgwDTgIynX7z-CPYc0V5w4G8zRgtIABHbj872nCBjsjr-wsWv1uUZCRMrBs-zk', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsj0X_ymCa6ASuH9tD9XzpcnvT70DQJ2uYV9vnfYD0eGFFvspksrWau9vCgvsqtg6MUpdoylM6iP27zWfi1Viout7gBv1Y', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsi-uUhG9sLfW9OhsLAFSwzLYKUWYRV6EzyrqbaOQqgc4gavlWUThHlBPJXBXYgV6Cq318pd01uwwnTdHCmuyePmFGp7w', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfslOA7UpZCFo6gy9F9tsvVD5GIjYRFPS4p9DUzpnlipH-R6Ov_GrQ7t1aUcr7aguuCVti_gXDboLJBrZkCDp_Ck1-zL04w', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfskmMFFOF1YzpVZ-2NGA0v5nDJ5DFdEf24JLCi9vi2RLagqxaIeOEf_cQdqCNyZI3EwfsStEvLuC8wd-bZWpWYDy6Fscr0', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsnd9UbKcTL-Uh4IvNj847UoVCCAysL3HRqrIqbgYVVuS0A1K9x3IZOfvtLSnjtzpGOMzzcu5XjTB4NT7BQGQx2hjOj9GQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfsmTZ3cgqFDSKt8YjYAgC13jJqcd-rNZDUamX1Kpf6rTaQMnben4JpS7OaO0zwwBHmnVBWBnQrciL9uUjKy0G1Rc-Ii3ec', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfspw6HcZ5vYwG8WHB2lVJz-sxaAb05U7A05tsQpb_ni_ec-_W6W2xOjWDXlKXZtUrKvg9K62yVrUpDpZgi6v4wIBP3i_A', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfso47WwFIl3VWc_YDFC-othyiQJe6toaODA3bAzRj8R-2XS40j3HI90wvW4mFtodnVkiGY7CgFcg8Ery0q-Jrm2SzUno0g', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfohrXzwpKGQht1jOwZEQRhHVi2kxj_hzvgj9nEzYftgVXgYal5gjmwchuHxJVr4zOxHxfPvImrZniHDDXuJuATC1h4qQlc', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfoglaRdeBfYHV_Rqhy6V0OpX2pemE-YlxdpmRgy_3C8ZEVjwp6gyK-XfDFYmtXpJsLBE48CiflFoP2yAvXGUdlr0iZh0g', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfojhnbJMryxC2HOwz_Ek2tydOLzdQTvynbTfaR_N2vXRMfDnxQBppvnBjCW-DScTQKKUkytI6xOyqRBCk1Z4Z4eXL_owCk', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfoiYwCuF_2kpo674jSO7Qx5IpVjyd-_uJorWExZavT2jyrB8GS36erI2h9kFgYLwCInekTISNM9gykIZswvQ4SxPR9hAzw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfolX68uJtWXPwReKCDo6vOdfwaqN-UZs9FpX4SjCVgLqmiPUR4QzIvGNyLfPm-wrNwC2fpsWyjHcFcrAiXQqzgUCZzeVUk', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfokpv63ZoN0iHyfMZo1SVajHKX2otxF4ze0mmw9ssKUorC--5bMjSHBALhA8_D9UHGKj2OOYxT37CTzCZesDz5n2FzQW5U', - '活动不存在或已结束,试试其他活动吧~', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfomGcx4Npir_v8wdomXvxUIhXD-MeaCmqOkFaqPFcwbmTcV8FCVSBJg0gkVFrotgMRMOzJp-Gl10zmjugQGIIxalBb0HwA', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfopmj6UNaaQf1RH3-j34B_k37p3W_NWW_ll-iqiYn0HehoderoVHNUxSuwLceQWStwSWx2m27ix2Y8MkpHBQ5Lg0Jt3nQY', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfooaxiDKISznvTYePbE3lOzASLuXPP8XWysr1MAYZ0KVZ7_HKiPlCSOAmOC5Skxcti8s_5sFtRIORHkRAHrFjyTQNXpjAM', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUhzydZiUwrQA-YYMy56oIDc_oCnNI-N6oSpCbCu2qxRcRLqp6Kp1GEmoAWDwSpq_NZxhDsqZHsHlk0_8qL_yFlMFbrYCw', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUgZwLfqVLDdWMlTpUkB4of3IHJLvvSpytixo0m-Re4R396shpCtt8IbN3zXYy1pMMfbVZR7kPgi9BSK5ST8G_K0ZSrFZA', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUjoOIj6OgMFLBamYLJ3HW8ad1nqLoj1D6NmlFnkGuyAzY5HsOFhsraGonP2B1Tx2nuJPZuJAwapb43a0WxRkKA3HSsXA', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUiRpJ9C08JwP3F2pMpRSWrVmOFj-6wM3wvABiP3AxpYGI1tjr4XIYZkFeMeUstUeifdvNES7Sgx1XXsIVxcD8dlJ8FfqQ', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUlnpdQctIkBIPCE-KoLw6aLglNbHq1qUUBhiT_2BfEFqX0sCJOpxd2ucp_E6syRQ9mW8pSKuTNo7kInnVSO28uaC_LluE', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUkmXh_RTbFx8L_BcJVAtEU78aNcj1OdAsxsTxnDn5jpw72bkx064VI86qV0HpdCbeDo4qPptTDz1m5Ydxb7cxzmeZyWM4', - '9HId9Z2m6CsyDV00EzbubGvFewAM3GwBiqLEr9J70c7yglxRrYXbB76sxU8dWfUnHohneTsnYM52nK570112qiiBTQKwEI-OLwFtqDgI2tM5zXpA_1AZDrYeFv4AczU53pMEPZBTWHeQMKWOqCrOrfM-AA' -] - - -//初始化 -function initial() { - merge = { - nickname: "", - enabled: true, - end: false - } - for (let i in merge) { - merge[i].success = 0; - merge[i].fail = 0; - merge[i].prizeCount = 0; - merge[i].notify = ""; - merge[i].show = true; - } -} -//通知 -function msgShow() { - let message = "京东账号:" +merge.nickname + "\n执行成功,请点击通知跳转APP查看!"; - let url ={ "open-url" : `openjd://virtual?params=%7B%20%22category%22:%20%22jump%22,%20%22des%22:%20%22m%22,%20%22url%22:%20%22https://h5.m.jd.com/babelDiy/Zeus/4DEZi5iUgrNLD9EWknrGZhCjNv7V/index.html%22%20%7D`} - $.msg($.name, "", message, url); -} - - -function Env(t,e){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("",`\ud83d\udd14${this.name}, \u5f00\u59cb!`)}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("@"),a={url:`http://${h}/v1/scripting/evaluate`,body:{script_text:t,mock_type:"cron",timeout:r},headers:{"X-Key":o,Accept:"*/*"}};this.post(a,(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"]),this.isSurge()||this.isLoon()?(this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.get(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)})):this.isQuanX()?(this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t))):this.isNode()&&(this.initGotEnv(t),this.got(t).on("redirect",(t,e)=>{try{if(t.headers["set-cookie"]){const s=t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();this.ckjar.setCookieSync(s,null),e.cookieJar=this.ckjar}}catch(t){this.logErr(t)}}).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)}))}post(t,e=(()=>{})){if(t.body&&t.headers&&!t.headers["Content-Type"]&&(t.headers["Content-Type"]="application/x-www-form-urlencoded"),t.headers&&delete t.headers["Content-Length"],this.isSurge()||this.isLoon())this.isSurge()&&this.isNeedRewrite&&(t.headers=t.headers||{},Object.assign(t.headers,{"X-Surge-Skip-Scripting":!1})),$httpClient.post(t,(t,s,i)=>{!t&&s&&(s.body=i,s.statusCode=s.status),e(t,s,i)});else if(this.isQuanX())t.method="POST",this.isNeedRewrite&&(t.opts=t.opts||{},Object.assign(t.opts,{hints:!1})),$task.fetch(t).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>e(t));else if(this.isNode()){this.initGotEnv(t);const{url:s,...i}=t;this.got.post(s,i).then(t=>{const{statusCode:s,statusCode:i,headers:r,body:o}=t;e(null,{status:s,statusCode:i,headers:r,body:o},o)},t=>{const{message:s,response:i}=t;e(s,i,i&&i.body)})}}time(t){let e={"M+":(new Date).getMonth()+1,"d+":(new Date).getDate(),"H+":(new Date).getHours(),"m+":(new Date).getMinutes(),"s+":(new Date).getSeconds(),"q+":Math.floor(((new Date).getMonth()+3)/3),S:(new Date).getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,((new Date).getFullYear()+"").substr(4-RegExp.$1.length)));for(let s in e)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?e[s]:("00"+e[s]).substr((""+e[s]).length)));return t}msg(e=t,s="",i="",r){const o=t=>{if(!t)return t;if("string"==typeof t)return this.isLoon()?t:this.isQuanX()?{"open-url":t}:this.isSurge()?{url:t}:void 0;if("object"==typeof t){if(this.isLoon()){let e=t.openUrl||t.url||t["open-url"],s=t.mediaUrl||t["media-url"];return{openUrl:e,mediaUrl:s}}if(this.isQuanX()){let e=t["open-url"]||t.url||t.openUrl,s=t["media-url"]||t.mediaUrl;return{"open-url":e,"media-url":s}}if(this.isSurge()){let e=t.url||t.openUrl||t["open-url"];return{url:e}}}};this.isMute||(this.isSurge()||this.isLoon()?$notification.post(e,s,i,o(r)):this.isQuanX()&&$notify(e,s,i,o(r)));let h=["","==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];h.push(e),s&&h.push(s),i&&h.push(i),console.log(h.join("\n")),this.logs=this.logs.concat(h)}log(...t){t.length>0&&(this.logs=[...this.logs,...t]),console.log(t.join(this.logSeparator))}logErr(t,e){const s=!this.isSurge()&&!this.isQuanX()&&!this.isLoon();s?this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t.stack):this.log("",`\u2757\ufe0f${this.name}, \u9519\u8bef!`,t)}wait(t){return new Promise(e=>setTimeout(e,t))}done(t={}){const e=(new Date).getTime(),s=(e-this.startTime)/1e3;this.log("",`\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`),this.log(),(this.isSurge()||this.isQuanX()||this.isLoon())&&$done(t)}}(t,e)} \ No newline at end of file From 5adadd5a51cfc69312378cf688a0499bc08f6836 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Thu, 12 Nov 2020 09:46:58 +0800 Subject: [PATCH 258/266] Delete jd_starStore.yml --- .github/workflows/jd_starStore.yml | 40 ------------------------------ 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/jd_starStore.yml diff --git a/.github/workflows/jd_starStore.yml b/.github/workflows/jd_starStore.yml deleted file mode 100644 index 575a5210d4..0000000000 --- a/.github/workflows/jd_starStore.yml +++ /dev/null @@ -1,40 +0,0 @@ - -name: 星店长 - -on: - workflow_dispatch: - schedule: - - cron: '5 16 * * *' - watch: - types: started -jobs: - build: - runs-on: ubuntu-latest - if: github.event.repository.owner.id == github.event.sender.id - env: - JD_COOKIE: ${{ secrets.JD_COOKIE }} - steps: - - name: Checkout - run: | - git clone https://github.com/Sunert/Scripts.git ~/Scripts - - name: Use Node.js 12.x - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: npm install - run: | - cd ~/Scripts - npm install - - name: '运行 【京东星店长】' - if: env.JD_COOKIE - run: | - cd ~/Scripts - node Task/jd_starStore.js - env: - PUSH_KEY: ${{ secrets.PUSH_KEY }} - BARK_PUSH: ${{ secrets.BARK_PUSH }} - TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} - TG_USER_ID: ${{ secrets.TG_USER_ID }} - BARK_SOUND: ${{ secrets.BARK_SOUND }} - DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} - DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file From 075b494fd0f99e94ff36f6aad2f95ce700d7ac35 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Thu, 12 Nov 2020 10:21:39 +0800 Subject: [PATCH 259/266] Delete jd_bigWinner.yml --- .github/workflows/jd_bigWinner.yml | 40 ------------------------------ 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/jd_bigWinner.yml diff --git a/.github/workflows/jd_bigWinner.yml b/.github/workflows/jd_bigWinner.yml deleted file mode 100644 index 3ba820eaca..0000000000 --- a/.github/workflows/jd_bigWinner.yml +++ /dev/null @@ -1,40 +0,0 @@ - -name: 京东大赢家 - -on: - workflow_dispatch: - schedule: - - cron: '3 */2 * * *' - watch: - types: started -jobs: - build: - runs-on: ubuntu-latest - if: github.event.repository.owner.id == github.event.sender.id - env: - JD_COOKIE: ${{ secrets.JD_COOKIE }} - steps: - - name: Checkout - run: | - git clone https://github.com/Sunert/Scripts.git ~/Scripts - - name: Use Node.js 12.x - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: npm install - run: | - cd ~/Scripts - npm install - - name: '运行 【京东大赢家】' - if: env.JD_COOKIE - run: | - cd ~/Scripts - node Task/jd_bigWinner.js - env: - PUSH_KEY: ${{ secrets.PUSH_KEY }} - BARK_PUSH: ${{ secrets.BARK_PUSH }} - TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} - TG_USER_ID: ${{ secrets.TG_USER_ID }} - BARK_SOUND: ${{ secrets.BARK_SOUND }} - DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} - DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file From 2ee7916639d132252d50f59df3f0162e54a82ba4 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Thu, 12 Nov 2020 10:22:26 +0800 Subject: [PATCH 260/266] Delete jd_ timeMachine.yml --- .github/workflows/jd_ timeMachine.yml | 40 --------------------------- 1 file changed, 40 deletions(-) delete mode 100644 .github/workflows/jd_ timeMachine.yml diff --git a/.github/workflows/jd_ timeMachine.yml b/.github/workflows/jd_ timeMachine.yml deleted file mode 100644 index 332d52373f..0000000000 --- a/.github/workflows/jd_ timeMachine.yml +++ /dev/null @@ -1,40 +0,0 @@ - -name: 京东时光机 - -on: - workflow_dispatch: - schedule: - - cron: '15 */4 * * *' - watch: - types: started -jobs: - build: - runs-on: ubuntu-latest - if: github.event.repository.owner.id == github.event.sender.id - env: - JD_COOKIE: ${{ secrets.JD_COOKIE }} - steps: - - name: Checkout - run: | - git clone https://github.com/Sunert/Scripts.git ~/Scripts - - name: Use Node.js 12.x - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: npm install - run: | - cd ~/Scripts - npm install - - name: '运行 【京东时光机】' - if: env.JD_COOKIE - run: | - cd ~/Scripts - node Task/jd_timeMachine.js - env: - PUSH_KEY: ${{ secrets.PUSH_KEY }} - BARK_PUSH: ${{ secrets.BARK_PUSH }} - TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} - TG_USER_ID: ${{ secrets.TG_USER_ID }} - BARK_SOUND: ${{ secrets.BARK_SOUND }} - DD_BOT_TOKEN: ${{ secrets.DD_BOT_TOKEN }} - DD_BOT_SECRET: ${{ secrets.DD_BOT_SECRET }} \ No newline at end of file From 0398349cf9e621761eed26e75076a922df29c49f Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Mon, 16 Nov 2020 09:41:15 +0800 Subject: [PATCH 261/266] Update dianshijia.js --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 113df765cc..82074fd75d 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -97,7 +97,7 @@ if (isGetCookie = typeof $request !== 'undefined') { } console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-8*60*60 + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+16*60*60 console.log(time) console.log(process.env.TZ) } else { From 853b454a93d2e47d98ea03d5093b80adb0749999 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Mon, 16 Nov 2020 09:45:39 +0800 Subject: [PATCH 262/266] Update dianshijia.js --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 82074fd75d..66a8dbdb9c 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -1,6 +1,6 @@ /* -更新时间: 2020-11-04 22:20 +更新时间: 2020-11-16 09:40 赞赏:电视家邀请码`893988`,农妇山泉 -> 有点咸,万分感谢 本脚本仅适用于电视家签到,支持Actions多账号运行,请用'#'或者换行隔开‼️ 获取Cookie方法: From d3c0fd378dcd51706a594e3fb25c1006079d7106 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Mon, 16 Nov 2020 10:09:05 +0800 Subject: [PATCH 263/266] Update dianshijia.js --- Task/dianshijia.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 66a8dbdb9c..5bdd3b418c 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -96,13 +96,14 @@ if (isGetCookie = typeof $request !== 'undefined') { return; } console.log(`------------- 共${tokenArr.length}个账号`) - if(new Date().getTimezoneOffset()/60 != '-8'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+16*60*60 - console.log(time) - console.log(process.env.TZ) + if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')<'16'){ + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + } if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')>'16'){ + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+8*60*60 } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } + console.log(time) for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { signheaderVal = tokenArr[i]; From 502c2811989c1347e97fee02ec78a8840552b086 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Mon, 16 Nov 2020 10:23:47 +0800 Subject: [PATCH 264/266] Update dianshijia.js --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index 5bdd3b418c..a1743b0cb2 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -98,8 +98,8 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')<'16'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 - } if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')>'16'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+8*60*60 + } else if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')>'16'){ + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+24*60*60 } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } From 95022ca1532bd02f0f8e6789b8f37bb7a9b810ba Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Mon, 16 Nov 2020 11:09:44 +0800 Subject: [PATCH 265/266] Update dianshijia.js --- Task/dianshijia.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index a1743b0cb2..bff0382098 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -98,12 +98,12 @@ if (isGetCookie = typeof $request !== 'undefined') { console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')<'16'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + console.log(time) } else if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')>'16'){ time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+24*60*60 } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 } - console.log(time) for (let i = 0; i < tokenArr.length; i++) { if (tokenArr[i]) { signheaderVal = tokenArr[i]; From 7206fb52807618c36e3f66d332b888d141ed61f0 Mon Sep 17 00:00:00 2001 From: Best <47924389+Sunert@users.noreply.github.com> Date: Mon, 16 Nov 2020 13:12:39 +0800 Subject: [PATCH 266/266] Update dianshijia.js --- Task/dianshijia.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Task/dianshijia.js b/Task/dianshijia.js index bff0382098..e124305909 100644 --- a/Task/dianshijia.js +++ b/Task/dianshijia.js @@ -97,10 +97,10 @@ if (isGetCookie = typeof $request !== 'undefined') { } console.log(`------------- 共${tokenArr.length}个账号`) if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')<'16'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000-28800 console.log(time) } else if(new Date().getTimezoneOffset()/60 != '-8'&&$.time('HH')>'16'){ - time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+24*60*60 + time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000+16*60*60 } else { time = new Date(new Date(new Date().toLocaleDateString()).getTime())/1000 }