├── 58tc.js ├── README.md ├── bak ├── daw.js ├── jrttjsb.js ├── shangtuo.jpg ├── shangtuo.js └── zcy.js ├── blackUnique.jpg ├── blackUnique.js ├── jckd ├── jckd_risk.js └── jckd_shareRead.js ├── jctq ├── README.md ├── jctq_daily.js ├── jctq_kkz.js ├── jctq_read.js ├── jctq_reward.js ├── jctq_rewrite.js ├── jctq_rewrite_subscribe.json ├── jctq_rewrite_subscribe.json.bak ├── jctq_shareRead.js └── jctq_task_subscribe.json ├── jztt.js ├── kfx.js ├── txstock.js ├── ydd.js ├── ysm.jpg ├── ysm.js ├── zqkd ├── zqkd_audio.js ├── zqkd_check.js ├── zqkd_kkz.js ├── zqkd_read.js ├── zqkd_reward.js ├── zqkd_risk.js ├── zqkd_shareRead.js └── zqkd_timerBox.js └── zqkdFast ├── zqkdFast_daily.js ├── zqkdFast_kkz.js ├── zqkdFast_read.js ├── zqkdFast_reward.js └── zqkdFast_shareRead.js /README.md: -------------------------------------------------------------------------------- 1 | # JavaScript 2 | 自用脚本 3 | -------------------------------------------------------------------------------- /bak/shangtuo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DsTansice/leafxcy_JavaScript/f0a40bd438f57f7308354d0c705a4ef311f4c29a/bak/shangtuo.jpg -------------------------------------------------------------------------------- /blackUnique.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DsTansice/leafxcy_JavaScript/f0a40bd438f57f7308354d0c705a4ef311f4c29a/blackUnique.jpg -------------------------------------------------------------------------------- /jckd/jckd_risk.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:晶彩看点 风险查询+今日收益详情 3 | 4 | 需要用到jckdCookie,只测试了青龙,理论上V2P也能用 5 | 本脚本没有设置重写,请自己复制jc_cookie到青龙环境下使用,多账号用@隔开 6 | 例子: export jckdCookie='uid=xxx&zqkey=yyy&zqkey_id=zzz@uid=aaa&zqkey=bbb&zqkey_id=ccc@uid=qqq&zqkey=sss&zqkey_id=ttt' 7 | */ 8 | 9 | const jsname = '晶彩看点风险查询' 10 | const $ = Env(jsname) 11 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 12 | const logDebug = 0 13 | 14 | const notify = $.isNode() ? require('./sendNotify') : ''; 15 | let notifyStr = '' 16 | 17 | let rndtime = "" //毫秒 18 | let httpResult //global buffer 19 | 20 | let userCookie = ($.isNode() ? process.env.jckdCookie : $.getdata('jckdCookie')) || ''; 21 | let userCookieArr = [] 22 | 23 | let nickname = [] 24 | /////////////////////////////////////////////////////////////////// 25 | 26 | !(async () => { 27 | 28 | if(typeof $request !== "undefined") 29 | { 30 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 31 | } 32 | else 33 | { 34 | if(!(await checkEnv())) { 35 | return 36 | } 37 | 38 | await initAccountInfo() 39 | await RunRiskInfo() 40 | await RunUserBalance() 41 | 42 | await showmsg() 43 | } 44 | 45 | 46 | })() 47 | .catch((e) => $.logErr(e)) 48 | .finally(() => $.done()) 49 | 50 | //通知 51 | async function showmsg() { 52 | 53 | notifyBody = jsname + "运行通知\n\n" + notifyStr 54 | 55 | if (notifyFlag != 1) { 56 | console.log(notifyBody); 57 | } 58 | 59 | if (notifyFlag == 1) { 60 | $.msg(notifyBody); 61 | if($.isNode()){await notify.sendNotify($.name, notifyBody );} 62 | } 63 | } 64 | 65 | async function checkEnv() { 66 | if(userCookie) { 67 | if(userCookie.indexOf('@') > -1) { 68 | let userCookies = userCookie.split('@') 69 | for(let i=0; i -1) { 201 | for(let j=0; j { 248 | $.post(url, async (err, resp, data) => { 249 | try { 250 | if (err) { 251 | console.log(caller + ": post请求失败"); 252 | console.log(JSON.stringify(err)); 253 | $.logErr(err); 254 | } else { 255 | if (safeGet(data)) { 256 | httpResult = JSON.parse(data); 257 | if(logDebug) console.log(httpResult); 258 | } 259 | } 260 | } catch (e) { 261 | $.logErr(e, resp); 262 | } finally { 263 | resolve(); 264 | } 265 | }); 266 | }); 267 | } 268 | 269 | async function httpGet(url,caller) { 270 | httpResult = null 271 | return new Promise((resolve) => { 272 | $.get(url, async (err, resp, data) => { 273 | try { 274 | if (err) { 275 | console.log(caller + ": get请求失败"); 276 | console.log(JSON.stringify(err)); 277 | $.logErr(err); 278 | } else { 279 | if (safeGet(data,caller)) { 280 | httpResult = JSON.parse(data); 281 | if(logDebug) console.log(httpResult); 282 | } 283 | } 284 | } catch (e) { 285 | $.logErr(e, resp); 286 | } finally { 287 | resolve(); 288 | } 289 | }); 290 | }); 291 | } 292 | 293 | function safeGet(data,caller) { 294 | try { 295 | if (typeof JSON.parse(data) == "object") { 296 | return true; 297 | } else { 298 | console.log(`Function ${caller}: 未知错误`); 299 | console.log(data) 300 | } 301 | } catch (e) { 302 | console.log(e); 303 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 304 | return false; 305 | } 306 | } 307 | 308 | function printCaller(){ 309 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 310 | } 311 | 312 | 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) } 313 | -------------------------------------------------------------------------------- /jckd/jckd_shareRead.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:晶彩看点 3 | 4 | 转发和分享阅读,请勿贪心,小心黑号 5 | */ 6 | 7 | const jsname = '晶彩看点分享阅读' 8 | const $ = Env(jsname) 9 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 10 | const logDebug = 0 11 | 12 | //const notify = $.isNode() ? require('./sendNotify') : ''; 13 | let notifyStr = '' 14 | 15 | let rndtime = "" //毫秒 16 | let httpResult //global buffer 17 | 18 | let jckdCookie = ($.isNode() ? process.env.jc_cookie : $.getdata('jc_cookie')) || ''; 19 | let jckdCookieArr = [] 20 | 21 | let userCk = '' 22 | let readCount = 0 23 | 24 | let jckdShareNum = ($.isNode() ? process.env.jckdShareNum : $.getdata('jckdShareNum')) || 0; 25 | 26 | let newsItem = '' 27 | let UserAgent = '' 28 | let si = '' 29 | 30 | /////////////////////////////////////////////////////////////////// 31 | 32 | !(async () => { 33 | 34 | if(typeof $request !== "undefined") 35 | { 36 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 37 | } 38 | else 39 | { 40 | if(!(await checkEnv())){ 41 | return 42 | } 43 | 44 | for(let j=0; j maxWaitTime ? maxWaitTime : seedFactor 62 | let randomTime = Math.floor(Math.random()*factor) + 1000 63 | let second = Math.floor(randomTime/1000) 64 | UserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x1800102c) NetType/WIFI Language/zh_CN' 65 | si = randomString(32) 66 | console.log(`--随机延迟${second}秒后开始模拟第${readCount}次分享阅读`) 67 | await $.wait(randomTime) 68 | console.log(`----模拟第${readCount}次阅读,使用si=${si}`) 69 | await shareReadStep1() 70 | await $.wait(Math.floor(Math.random()*500)+500) 71 | await shareReadStep2() 72 | await $.wait(Math.floor(Math.random()*1000)+2000) 73 | await shareReadStep3() 74 | await $.wait(Math.floor(Math.random()*1000)+2000) 75 | await shareReadStep4() 76 | console.log(`----模拟第${readCount}次阅读完成`) 77 | } 78 | 79 | } 80 | } 81 | } 82 | 83 | 84 | })() 85 | .catch((e) => $.logErr(e)) 86 | .finally(() => $.done()) 87 | 88 | //通知 89 | async function showmsg() { 90 | 91 | notifyBody = jsname + "运行通知\n\n" + notifyStr 92 | 93 | if (notifyFlag != 1) { 94 | console.log(notifyBody); 95 | } 96 | 97 | if (notifyFlag == 1) { 98 | $.msg(notifyBody); 99 | //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} 100 | } 101 | } 102 | 103 | async function checkEnv() { 104 | 105 | if(jckdShareNum == 0) { 106 | console.log('当前分享次数设置为0。如果需要开启分享阅读,请设置环境变量jckdShareNum为要被阅读的次数。') 107 | return false 108 | } 109 | 110 | if(jckdCookie) { 111 | if(jckdCookie.indexOf('@') > -1) { 112 | let jckdCookies = jckdCookie.split('@') 113 | for(let i=0; i { 267 | $.post(url, async (err, resp, data) => { 268 | try { 269 | if (err) { 270 | console.log(caller + ": post请求失败"); 271 | console.log(JSON.stringify(err)); 272 | $.logErr(err); 273 | } else { 274 | if (safeGet(data)) { 275 | httpResult = JSON.parse(data,caller); 276 | if(logDebug) console.log(httpResult); 277 | } 278 | } 279 | } catch (e) { 280 | $.logErr(e, resp); 281 | } finally { 282 | resolve(); 283 | } 284 | }); 285 | }); 286 | } 287 | 288 | async function httpGet(url,caller) { 289 | httpResult = null 290 | return new Promise((resolve) => { 291 | $.get(url, async (err, resp, data) => { 292 | try { 293 | if (err) { 294 | console.log(caller + ": get请求失败"); 295 | console.log(JSON.stringify(err)); 296 | $.logErr(err); 297 | } else { 298 | // 299 | } 300 | } catch (e) { 301 | $.logErr(e, resp); 302 | } finally { 303 | resolve(); 304 | } 305 | }); 306 | }); 307 | } 308 | 309 | function safeGet(data,caller) { 310 | try { 311 | if (typeof JSON.parse(data) == "object") { 312 | return true; 313 | } else { 314 | console.log(`Function ${caller}: 未知错误`); 315 | console.log(data) 316 | } 317 | } catch (e) { 318 | console.log(e); 319 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 320 | return false; 321 | } 322 | } 323 | 324 | function printCaller(){ 325 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 326 | } 327 | 328 | 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) } 329 | -------------------------------------------------------------------------------- /jctq/README.md: -------------------------------------------------------------------------------- 1 | # 晶彩天气(v8.3.7) 2 | 3 | ## 重写: 4 | https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json -- 点开福利页即可获取jctqCookie 5 | https://tq.xunsl.com/v5/CommonReward/toGetReward.json -- 签到,和福利页任务奖励 6 | https://tq.xunsl.com/v5/article/info.json -- 点开文章获取文章body 7 | https://tq.xunsl.com/v5/article/detail.json -- 点开视频获取视频body 8 | https://tq.xunsl.com/v5/user/stay.json -- 阅读文章或者看视频一段时间后可以获取到时长body 9 | https://tq.xunsl.com/v5/nameless/adlickstart.json -- 点开看看赚获取body,可以一直开着,脚本会自动删除重复body 10 | https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json -- 点开福利页浮窗宝箱和观看翻倍视频获取body 11 | https://tq.xunsl.com/v5/weather/giveTimeInterval.json -- 点开首页气泡红包和观看翻倍视频获取body 12 | https://tq.xunsl.com/v5/wechat/withdraw2.json -- 提现一次对应金额获取body 13 | https://tq.xunsl.com/v5/CommonReward/toDouble.json -- 领取签到翻倍奖励后可获取 14 | 15 | ## 任务: 16 | jctq_daily.js -- 领转发页定时宝箱,领福利页定时宝箱,领首页气泡红包,时段转发,刷福利视频,抽奖5次 17 | jctq_reward.js -- 签到和翻倍,任务奖励领取,统计今日收益,自动提现 18 | jctq_kkz.js -- 完成看看赚任务,删除重复和失效的body 19 | jctq_read.js -- 阅读文章,浏览视频 20 | 21 | ## 分享阅读: 22 | jctq_shareRead.js -- 分享和助力阅读,需要在环境变量jctqShareNum里设置要被阅读的次数,不设置默认不跑 23 | -------------------------------------------------------------------------------- /jctq/jctq_daily.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:水果天气(v8.3.9) 3 | 4 | 此脚本负责: 5 | 旧版本8.3.7:领首页气泡红包和翻倍奖励,福利页定时宝箱和翻倍奖励 6 | 新版本8.3.9:领转发页定时宝箱,领资讯页宝箱和视频奖励,任务页一键收金币,时段转发,刷福利视频,抽奖5次 7 | */ 8 | 9 | const jsname = '晶彩天气日常' 10 | const $ = Env(jsname) 11 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 12 | const logDebug = 0 13 | 14 | //const notify = $.isNode() ? require('./sendNotify') : ''; 15 | let notifyStr = '' 16 | 17 | let rndtime = "" //毫秒 18 | let httpResult //global buffer 19 | 20 | let userCookie = '' 21 | 22 | let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; 23 | let jctqBubbleBody = ($.isNode() ? process.env.jctqBubbleBody : $.getdata('jctqBubbleBody')) || ''; 24 | let jctqGiveBoxBody = ($.isNode() ? process.env.jctqGiveBoxBody : $.getdata('jctqGiveBoxBody')) || ''; 25 | let jctqGoldBody = ($.isNode() ? process.env.jctqGoldBody : $.getdata('jctqGoldBody')) || ''; 26 | let jctqVideoBody = ($.isNode() ? process.env.jctqVideoBody : $.getdata('jctqVideoBody')) || ''; 27 | 28 | let jctqCookieArr = [] 29 | let jctqBubbleBodyArr = [] 30 | let jctqGiveBoxBodyArr = [] 31 | let jctqGoldBodyArr = [] 32 | let jctqVideoBodyArr = [] 33 | 34 | let refHotShare = 'http://tq.xunsl.com/h5/hotShare/?' 35 | let refRotory = 'https://tq.xunsl.com/html/rotaryTable/index.html?keyword_wyq=woyaoq.com&' 36 | 37 | 38 | /////////////////////////////////////////////////////////////////// 39 | 40 | !(async () => { 41 | 42 | if(typeof $request !== "undefined") 43 | { 44 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 45 | } 46 | else 47 | { 48 | await checkEnv() 49 | 50 | numBoxbody = jctqCookieArr.length 51 | console.log(`找到${numBoxbody}个cookie`) 52 | 53 | for(let i=0; i $.logErr(e)) 83 | .finally(() => $.done()) 84 | 85 | //通知 86 | async function showmsg() { 87 | 88 | notifyBody = jsname + "运行通知\n\n" + notifyStr 89 | 90 | if (notifyFlag != 1) { 91 | console.log(notifyBody); 92 | } 93 | 94 | if (notifyFlag == 1) { 95 | $.msg(notifyBody); 96 | //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} 97 | } 98 | } 99 | 100 | async function checkEnv() { 101 | 102 | if(jctqCookie) { 103 | if(jctqCookie.indexOf('&') > -1) { 104 | let jctqCookies = jctqCookie.split('@') 105 | for(let i=0; i -1) { 116 | let jctqBubbleBodyArrs = jctqBubbleBody.split('&') 117 | for(let i=0; i -1) { 127 | let jctqGiveBoxBodyArrs = jctqGiveBoxBody.split('&') 128 | for(let i=0; i -1) { 138 | let jctqGoldBodyArrs = jctqGoldBody.split('&') 139 | for(let i=0; i -1) { 149 | let jctqVideoBodyArrs = jctqVideoBody.split('@') 150 | for(let i=0; i=5 && currentHour<10) { 187 | action = 'beread_extra_reward_one' 188 | } else if(currentHour>=11 && currentHour<16) { 189 | action = 'beread_extra_reward_two' 190 | } else if(currentHour>=17 && currentHour<22) { 191 | action = 'beread_extra_reward_three' 192 | } 193 | 194 | if(result.code == 200) { 195 | if(result.data && result.data.taskList && Array.isArray(result.data.taskList)) { 196 | let taskList = result.data.taskList 197 | for(let i=0; i -1) { 200 | if(taskItem.status == 1) { 201 | console.log(`\n转发页面定时宝箱可领取`) 202 | await $.wait(1000) 203 | await getRewardShareBox() 204 | } else { 205 | let cdTime = taskItem.total_time - taskItem.countdown 206 | console.log(`\n转发页面定时宝箱冷却时间:${cdTime}秒`) 207 | if(cdTime < 90) { 208 | let waitTime = cdTime+1 209 | console.log(`\n等待${waitTime}秒后尝试领取`) 210 | await $.wait(waitTime*1000) 211 | await queryShareStatus() 212 | } 213 | } 214 | } 215 | if(action && taskItem.action.indexOf(action) > -1) { 216 | if(taskItem.status == 0) { 217 | console.log(`\n开始做${taskItem.name}转发任务`) 218 | await $.wait(1000) 219 | await listsNewTag() 220 | await $.wait(1000) 221 | await execExtractTask(taskItem.action,taskItem.name) 222 | } else { 223 | console.log(`\n${taskItem.name}转发已完成`) 224 | } 225 | } 226 | } 227 | } 228 | } else { 229 | console.log(`\n转发页面查询失败:${result.msg}`) 230 | } 231 | } 232 | 233 | //转发页面红包领取 -- 30分钟一次 234 | async function getRewardShareBox() { 235 | let caller = printCaller() 236 | let url = 'http://tq.xunsl.com/WebApi/TimePacket/getReward' 237 | let urlObject = populatePostUrl(url,refHotShare,userCookie) 238 | await httpPost(urlObject,caller) 239 | let result = httpResult; 240 | if(!result) return 241 | 242 | if(result.code == 1) { 243 | console.log(`领取转发页面定时宝箱成功:获得${result.data.score}金币`) 244 | } else { 245 | console.log(`领取转发页面定时宝箱失败:${result.msg}`) 246 | } 247 | } 248 | 249 | //转发页面列表 250 | async function listsNewTag() { 251 | let caller = printCaller() 252 | let url = 'http://tq.xunsl.com/WebApi/ArticleTop/listsNewTag' 253 | let urlObject = populatePostUrl(url,refHotShare,userCookie) 254 | await httpPost(urlObject,caller) 255 | let result = httpResult; 256 | if(!result) return 257 | 258 | if(result.status == 1) { 259 | if(result.data && result.data.items && Array.isArray(result.data.items)) { 260 | let shareIdx = Math.floor(Math.random()*result.data.items.length) 261 | let newsItem = result.data.items[shareIdx] 262 | await $.wait(1000) 263 | await getShareArticleReward(newsItem.id) 264 | } 265 | } else { 266 | console.log(`查询转发页面列表失败:${result.msg}`) 267 | } 268 | } 269 | 270 | //转发文章 271 | async function getShareArticleReward(articleId) { 272 | let caller = printCaller() 273 | let url = 'http://tq.xunsl.com/WebApi/ShareNew/getShareArticleReward' 274 | let reqBody = userCookie + '&article_id=' + articleId 275 | let urlObject = populatePostUrl(url,refHotShare,reqBody) 276 | await httpPost(urlObject,caller) 277 | let result = httpResult; 278 | if(!result) return 279 | 280 | if(result.status == 1) { 281 | if(result.data.share == 1) { 282 | console.log(`转发文章成功`) 283 | } 284 | } else { 285 | console.log(`转发文章失败:${result.msg}`) 286 | } 287 | } 288 | 289 | //转发时段奖励 290 | async function execExtractTask(action,name) { 291 | let caller = printCaller() 292 | let url = 'http://tq.xunsl.com/WebApi/ShareNew/execExtractTask' 293 | let reqBody = userCookie + '&action=' + action 294 | let urlObject = populatePostUrl(url,refHotShare,reqBody) 295 | await httpPost(urlObject,caller) 296 | let result = httpResult; 297 | if(!result) return 298 | 299 | if(result.code == 200) { 300 | console.log(`领取${name}转发奖励成功`) 301 | } else { 302 | console.log(`领取${name}转发奖励失败:${result.msg}`) 303 | } 304 | } 305 | 306 | //首页气泡红包查询 307 | async function queryBubbleStatus() { 308 | let caller = printCaller() 309 | let url = 'https://tq.xunsl.com/v17/weather/index.json?' + userCookie 310 | let urlObject = populateGetUrl(url,refHotShare) 311 | await httpGet(urlObject,caller) 312 | let result = httpResult; 313 | if(!result) return 314 | 315 | if(result.success == true) { 316 | let numBody = jctqBubbleBodyArr.length 317 | if(numBody > 0) { 318 | if(result.items && result.items.bubble && Array.isArray(result.items.bubble)) { 319 | let bubbleList = result.items.bubble 320 | let numBubble = bubbleList.length 321 | console.log(`\n共有${numBubble}个气泡红包可以领取,找到${numBody}个气泡和翻倍body,开始尝试领取`) 322 | for(let i=0; i 1) { 371 | if(result.items.status == 1) { 372 | console.log(`\n福利页面定时宝箱可领取,找到${numBody}个宝箱body,开始尝试领取`) 373 | for(let i=0; i 5 ? 5 : result.data.remainTurn 430 | if(numTurn > 0) { 431 | for(let i=0; i= boxItem.times) { 442 | randomTime = Math.floor(Math.random()*5000)+30000 443 | console.log(`随机延迟 ${randomTime}ms 看视频开抽奖宝箱`) 444 | await $.wait(randomTime) 445 | await chestReward(i+1) 446 | } 447 | } 448 | } 449 | } else { 450 | console.log(`抽奖次数查询失败:${result.msg}`) 451 | } 452 | } 453 | 454 | //抽奖宝箱 455 | async function chestReward(idx) { 456 | rndtime = Math.floor(new Date().getTime()) 457 | let caller = printCaller() 458 | let url = 'https://tq.xunsl.com/WebApi/RotaryTable/chestReward?_='+rndtime 459 | let reqBody = userCookie + '&num=' + idx 460 | let urlObject = populatePostUrl(url,refRotory,reqBody) 461 | await httpPost(urlObject,caller) 462 | let result = httpResult; 463 | if(!result) return 464 | 465 | if(result.status == 1) { 466 | console.log(`开抽奖第${idx}个宝箱获得${result.data.score}金币`) 467 | } else { 468 | console.log(`开抽奖宝箱失败:${result.msg}`) 469 | } 470 | } 471 | 472 | //抽奖 473 | async function turnRotary() { 474 | rndtime = Math.floor(new Date().getTime()) 475 | let caller = printCaller() 476 | let url = 'https://tq.xunsl.com/WebApi/RotaryTable/turnRotary?_='+rndtime 477 | let urlObject = populatePostUrl(url,refRotory,userCookie) 478 | await httpPost(urlObject,caller) 479 | let result = httpResult; 480 | if(!result) return 481 | 482 | if(result.status == 1) { 483 | console.log(`抽奖获得${result.data.score}金币,剩余抽奖次数${result.data.remainTurn}`) 484 | } else { 485 | console.log(`抽奖失败:${result.msg}`) 486 | } 487 | } 488 | 489 | //查询日常任务进度 490 | async function getTaskListByWeather() { 491 | let caller = printCaller() 492 | let url = 'https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json?' + userCookie 493 | let urlObject = populateGetUrl(url,refHotShare) 494 | await httpGet(urlObject,caller) 495 | let result = httpResult; 496 | if(!result) return 497 | 498 | if(result.success == true) { 499 | if(Array.isArray(result.items.daily)) { 500 | for(let i=0; i 0) { 537 | console.log(`\n找到${numBody}个资讯页宝箱body,开始尝试领取`) 538 | for(let i=0; i 0) { 573 | console.log(`\n找到${numBody}个收金币body,开始尝试领取`) 574 | for(let i=0; i { 645 | $.post(url, async (err, resp, data) => { 646 | try { 647 | if (err) { 648 | console.log(caller + ": post请求失败"); 649 | console.log(JSON.stringify(err)); 650 | $.logErr(err); 651 | } else { 652 | if (safeGet(data)) { 653 | httpResult = JSON.parse(data,caller); 654 | if(logDebug) console.log(httpResult); 655 | } 656 | } 657 | } catch (e) { 658 | $.logErr(e, resp); 659 | } finally { 660 | resolve(); 661 | } 662 | }); 663 | }); 664 | } 665 | 666 | async function httpGet(url,caller) { 667 | httpResult = null 668 | return new Promise((resolve) => { 669 | $.get(url, async (err, resp, data) => { 670 | try { 671 | if (err) { 672 | console.log(caller + ": get请求失败"); 673 | console.log(JSON.stringify(err)); 674 | $.logErr(err); 675 | } else { 676 | if (safeGet(data,caller)) { 677 | httpResult = JSON.parse(data); 678 | if(logDebug) console.log(httpResult); 679 | } 680 | } 681 | } catch (e) { 682 | $.logErr(e, resp); 683 | } finally { 684 | resolve(); 685 | } 686 | }); 687 | }); 688 | } 689 | 690 | function safeGet(data,caller) { 691 | try { 692 | if (typeof JSON.parse(data) == "object") { 693 | return true; 694 | } else { 695 | console.log(`Function ${caller}: 未知错误`); 696 | console.log(data) 697 | } 698 | } catch (e) { 699 | console.log(e); 700 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 701 | return false; 702 | } 703 | } 704 | 705 | function printCaller(){ 706 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 707 | } 708 | 709 | 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) } 710 | -------------------------------------------------------------------------------- /jctq/jctq_kkz.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:水果天气(v8.3.9) 3 | 4 | 此脚本负责: 5 | 完成看看赚任务 6 | */ 7 | 8 | const jsname = '水果天气看看赚' 9 | const $ = Env(jsname) 10 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 11 | const logDebug = 0 12 | 13 | //const notify = $.isNode() ? require('./sendNotify') : ''; 14 | let notifyStr = '' 15 | 16 | let rndtime = "" //毫秒 17 | let httpResult //global buffer 18 | 19 | let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; 20 | let jctqLookStartbody = ($.isNode() ? process.env.jctqLookStartbody : $.getdata('jctqLookStartbody')) || ''; 21 | 22 | let jctqCookieArr = [] 23 | let jctqLookStartbodyArr = [] 24 | 25 | let userCookie = '' 26 | 27 | let bannerIdList = [] 28 | //let duplicatedCount = 0 29 | let finishCount = 0 30 | let rewardAmount = 0 31 | 32 | 33 | /////////////////////////////////////////////////////////////////// 34 | 35 | !(async () => { 36 | 37 | if(typeof $request !== "undefined") 38 | { 39 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 40 | } 41 | else 42 | { 43 | if(!(await checkEnv())) { 44 | return 45 | } 46 | 47 | for(let i=0; i $.logErr(e)) 66 | .finally(() => $.done()) 67 | 68 | //通知 69 | async function showmsg() { 70 | 71 | notifyBody = jsname + "运行通知\n\n" + notifyStr 72 | 73 | if (notifyFlag != 1) { 74 | console.log(notifyBody); 75 | } 76 | 77 | if (notifyFlag == 1) { 78 | $.msg(notifyBody); 79 | //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} 80 | } 81 | } 82 | 83 | async function checkEnv() { 84 | 85 | if(!jctqLookStartbody) { 86 | console.log(`未获取到看看赚body`) 87 | return false 88 | } 89 | 90 | if(jctqLookStartbody.indexOf('&') > -1) { 91 | jctqLookStartbodyArr = jctqLookStartbody.split('&') 92 | } else { 93 | jctqLookStartbodyArr.push(jctqLookStartbody) 94 | } 95 | 96 | let numBody = jctqLookStartbodyArr.length 97 | console.log(`找到${numBody}个看看赚body`) 98 | 99 | if(jctqCookie) { 100 | if(jctqCookie.indexOf('@') > -1) { 101 | let jctqCookies = jctqCookie.split('@') 102 | for(let i=0; i { 308 | $.post(url, async (err, resp, data) => { 309 | try { 310 | if (err) { 311 | console.log(caller + ": post请求失败"); 312 | console.log(JSON.stringify(err)); 313 | $.logErr(err); 314 | } else { 315 | if (safeGet(data)) { 316 | httpResult = JSON.parse(data,caller); 317 | if(logDebug) console.log(httpResult); 318 | } 319 | } 320 | } catch (e) { 321 | $.logErr(e, resp); 322 | } finally { 323 | resolve(); 324 | } 325 | }); 326 | }); 327 | } 328 | 329 | async function httpGet(url,caller) { 330 | httpResult = null 331 | return new Promise((resolve) => { 332 | $.get(url, async (err, resp, data) => { 333 | try { 334 | if (err) { 335 | console.log(caller + ": get请求失败"); 336 | console.log(JSON.stringify(err)); 337 | $.logErr(err); 338 | } else { 339 | if (safeGet(data,caller)) { 340 | httpResult = JSON.parse(data); 341 | if(logDebug) console.log(httpResult); 342 | } 343 | } 344 | } catch (e) { 345 | $.logErr(e, resp); 346 | } finally { 347 | resolve(); 348 | } 349 | }); 350 | }); 351 | } 352 | 353 | function safeGet(data,caller) { 354 | try { 355 | if (typeof JSON.parse(data) == "object") { 356 | return true; 357 | } else { 358 | console.log(`Function ${caller}: 未知错误`); 359 | console.log(data) 360 | } 361 | } catch (e) { 362 | console.log(e); 363 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 364 | return false; 365 | } 366 | } 367 | 368 | function printCaller(){ 369 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 370 | } 371 | 372 | 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) } 373 | -------------------------------------------------------------------------------- /jctq/jctq_read.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:水果天气(v8.3.9) 3 | 4 | 此脚本负责: 5 | 阅读文章,浏览视频 6 | */ 7 | 8 | const jsname = '水果天气文章视频' 9 | const $ = Env(jsname) 10 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 11 | const logDebug = 0 12 | 13 | //const notify = $.isNode() ? require('./sendNotify') : ''; 14 | let notifyStr = '' 15 | 16 | let rndtime = "" //毫秒 17 | let httpResult //global buffer 18 | 19 | let jctqTimeBody = ($.isNode() ? process.env.jctqTimeBody : $.getdata('jctqTimeBody')) || ''; 20 | let jctqWzBody = ($.isNode() ? process.env.jctqWzBody : $.getdata('jctqWzBody')) || ''; 21 | let jctqWzBodyArr = [] 22 | 23 | let bannerIdList = [] 24 | let totalTime = 0 25 | let invalidCount = 0 26 | let finishCount = 0 27 | let rewardAmount = 0 28 | 29 | /////////////////////////////////////////////////////////////////// 30 | 31 | !(async () => { 32 | 33 | if(typeof $request !== "undefined") 34 | { 35 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 36 | } 37 | else 38 | { 39 | if(!(await checkEnv())) { 40 | return 41 | } 42 | 43 | for(let i=0; i $.logErr(e)) 55 | .finally(() => $.done()) 56 | 57 | //通知 58 | async function showmsg() { 59 | 60 | notifyBody = jsname + "运行通知\n\n" + notifyStr 61 | 62 | if (notifyFlag != 1) { 63 | console.log(notifyBody); 64 | } 65 | 66 | if (notifyFlag == 1) { 67 | $.msg(notifyBody); 68 | //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} 69 | } 70 | } 71 | 72 | async function checkEnv() { 73 | 74 | if(!jctqWzBody) { 75 | console.log(`未获取到文章视频body`) 76 | return false 77 | } 78 | 79 | if(jctqWzBody.indexOf('&') > -1) { 80 | jctqWzBodyArr = jctqWzBody.split('&') 81 | } else { 82 | jctqWzBodyArr.push(jctqWzBody) 83 | } 84 | 85 | if(jctqTimeBody && jctqTimeBody.indexOf('&') > -1) { 86 | jctqTimeBodys = jctqTimeBody.split('&') 87 | jctqTimeBody = jctqTimeBodys[0] 88 | } 89 | 90 | let numWzBody = jctqWzBodyArr.length 91 | console.log(`找到${numWzBody}个文章视频body`) 92 | 93 | return true 94 | } 95 | 96 | /////////////////////////////////////////////////////////////////// 97 | 98 | //浏览文章 99 | async function readArticle(wzBody,idx) { 100 | let caller = printCaller() 101 | let url = 'https://tq.xunsl.com/v5/article/complete.json' 102 | let urlObject = populatePostUrl(url,wzBody) 103 | await httpPost(urlObject,caller) 104 | let result = httpResult; 105 | if(!result) return 106 | 107 | if(result.success == true) { 108 | finishCount++ 109 | let randomTime = Math.floor(Math.random()*10000)+60000 110 | let score = result.items.read_score || 0 111 | rewardAmount += parseInt(score) 112 | console.log(`浏览第${idx+1}篇文章获得${score}金币,随机延迟${randomTime}ms后刷阅读时长`) 113 | await $.wait(randomTime) 114 | if(jctqTimeBody) { 115 | await updateStayTime(jctqTimeBody) 116 | } else { 117 | console.log(`----没有找到时长body,不刷时长,请小心黑号`) 118 | } 119 | } else { 120 | //invalidCount++ 121 | //await removeBody(wzBody) 122 | console.log(`浏览第${idx+1}篇文章失败:${result.message}`) 123 | } 124 | } 125 | 126 | //更新阅读时长 127 | async function updateStayTime(timeBody) { 128 | let caller = printCaller() 129 | let url = 'https://tq.xunsl.com/v5/user/stay.json' 130 | let urlObject = populatePostUrl(url,timeBody) 131 | await httpPost(urlObject,caller) 132 | let result = httpResult; 133 | if(!result) return 134 | 135 | if(result.success == true) { 136 | totalTime = result.time 137 | console.log(`----更新阅读时长成功,今天总阅读时长${result.time}秒`) 138 | } else { 139 | console.log(`----更新阅读时长失败:${result.message}`) 140 | } 141 | } 142 | 143 | //删除失效body 144 | async function removeBody(wzBody) { 145 | newBody = $.getdata('jctqWzBody').replace(wzBody,""); 146 | newBody = newBody.replace("&&","&"); 147 | $.setdata(newBody,'jctqWzBody'); 148 | } 149 | 150 | //统计运行情况 151 | async function getStatus() { 152 | notifyStr += `本次运行情况:\n` 153 | notifyStr += `共阅读了${finishCount}篇文章/视频,获得${rewardAmount}金币,总阅读时长${totalTime}\n` 154 | //if(invalidCount > 0) notifyStr += `删除了${invalidCount}个无效的body\n` 155 | } 156 | 157 | //////////////////////////////////////////////////////////////////// 158 | function populatePostUrl(url,reqBody){ 159 | let rndtime = Math.floor(new Date().getTime()/1000) 160 | let urlObject = { 161 | url: url, 162 | headers: { 163 | 'request_time' : rndtime, 164 | 'Host' : 'tq.xunsl.com', 165 | 'device-model' : 'VOG-AL10', 166 | 'device-platform' : 'android', 167 | 'Connection' : 'keep-alive', 168 | 'app-type' : 'jcweather', 169 | }, 170 | body: reqBody 171 | } 172 | return urlObject; 173 | } 174 | 175 | function populateGetUrl(url){ 176 | let rndtime = Math.floor(new Date().getTime()/1000) 177 | let urlObject = { 178 | url: url, 179 | headers: { 180 | 'request_time' : rndtime, 181 | 'Host' : 'tq.xunsl.com', 182 | 'device-model' : 'VOG-AL10', 183 | 'device-platform' : 'android', 184 | 'Connection' : 'keep-alive', 185 | 'app-type' : 'jcweather', 186 | } 187 | } 188 | return urlObject; 189 | } 190 | 191 | async function httpPost(url,caller) { 192 | httpResult = null 193 | return new Promise((resolve) => { 194 | $.post(url, async (err, resp, data) => { 195 | try { 196 | if (err) { 197 | console.log(caller + ": post请求失败"); 198 | console.log(JSON.stringify(err)); 199 | $.logErr(err); 200 | } else { 201 | if (safeGet(data)) { 202 | httpResult = JSON.parse(data,caller); 203 | if(logDebug) console.log(httpResult); 204 | } 205 | } 206 | } catch (e) { 207 | $.logErr(e, resp); 208 | } finally { 209 | resolve(); 210 | } 211 | }); 212 | }); 213 | } 214 | 215 | async function httpGet(url,caller) { 216 | httpResult = null 217 | return new Promise((resolve) => { 218 | $.get(url, async (err, resp, data) => { 219 | try { 220 | if (err) { 221 | console.log(caller + ": get请求失败"); 222 | console.log(JSON.stringify(err)); 223 | $.logErr(err); 224 | } else { 225 | if (safeGet(data,caller)) { 226 | httpResult = JSON.parse(data); 227 | if(logDebug) console.log(httpResult); 228 | } 229 | } 230 | } catch (e) { 231 | $.logErr(e, resp); 232 | } finally { 233 | resolve(); 234 | } 235 | }); 236 | }); 237 | } 238 | 239 | function safeGet(data,caller) { 240 | try { 241 | if (typeof JSON.parse(data) == "object") { 242 | return true; 243 | } else { 244 | console.log(`Function ${caller}: 未知错误`); 245 | console.log(data) 246 | } 247 | } catch (e) { 248 | console.log(e); 249 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 250 | return false; 251 | } 252 | } 253 | 254 | function printCaller(){ 255 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 256 | } 257 | 258 | 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) } 259 | -------------------------------------------------------------------------------- /jctq/jctq_reward.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:水果天气(v8.3.9) 3 | 4 | 此脚本负责: 5 | 签到和翻倍,任务奖励领取,领首页福利视频奖励,首页统计今日收益,自动提现 6 | 7 | 请将定时放在看看赚和阅读任务后面 8 | 如果不想自动提现的,请不要捉提现body,或者新建环境变量jctqWithdrawFlag,写成0 9 | */ 10 | 11 | const jsname = '水果天气任务签到' 12 | const $ = Env(jsname) 13 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 14 | const logDebug = 0 15 | 16 | //const notify = $.isNode() ? require('./sendNotify') : ''; 17 | let notifyStr = '' 18 | 19 | let rndtime = "" //毫秒 20 | let httpResult //global buffer 21 | 22 | let numBoxbody 23 | 24 | let jctqWithdrawFlag = ($.isNode() ? process.env.jctqWithdrawFlag : $.getdata('jctqWithdrawFlag')) || 1; 25 | let jctqBoxbody = ($.isNode() ? process.env.jctqBoxbody : $.getdata('jctqBoxbody')) || ''; 26 | let jctqQdBody = ($.isNode() ? process.env.jctqQdBody : $.getdata('jctqQdBody')) || ''; 27 | let jctqSignDoubleBody = ($.isNode() ? process.env.jctqSignDoubleBody : $.getdata('jctqSignDoubleBody')) || ''; 28 | let jctqWithdraw = ($.isNode() ? process.env.jctqWithdraw : $.getdata('jctqWithdraw')) || ''; 29 | let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; 30 | 31 | let jctqRewardBodyArr = [] 32 | let jctqSignDoubleBodyArr = [] 33 | let jctqWithdrawArr = [] 34 | let jctqCookieArr = [] 35 | 36 | let withdrawSuccess = 0 37 | 38 | /////////////////////////////////////////////////////////////////// 39 | 40 | !(async () => { 41 | 42 | if(typeof $request !== "undefined") 43 | { 44 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 45 | } 46 | else 47 | { 48 | await checkEnv() 49 | 50 | numBoxbody = jctqRewardBodyArr.length 51 | console.log(`找到${numBoxbody}个签到/奖励body`) 52 | 53 | for(let i=0; i 0 && jctqWithdrawArr.length > 0) { 69 | numBoxbody = jctqWithdrawArr.length 70 | console.log(`找到${numBoxbody}个提现body`) 71 | 72 | for(let i=0; i $.logErr(e)) 99 | .finally(() => $.done()) 100 | 101 | //通知 102 | async function showmsg() { 103 | 104 | notifyBody = jsname + "运行通知\n\n" + notifyStr 105 | 106 | if (notifyFlag != 1) { 107 | console.log(notifyBody); 108 | } 109 | 110 | if (notifyFlag == 1) { 111 | $.msg(notifyBody); 112 | //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} 113 | } 114 | } 115 | 116 | async function checkEnv() { 117 | 118 | if(jctqCookie) { 119 | if(jctqCookie.indexOf('@') > -1) { 120 | let jctqCookies = jctqCookie.split('@') 121 | for(let i=0; i -1) { 132 | let jctqWithdraws = jctqWithdraw.split('&') 133 | for(let i=0; i -1) { 143 | let jctqQdBodyArr = jctqQdBody.split('&') 144 | for(let i=0; i -1) { 154 | let jctqBoxbodyArr = jctqBoxbody.split('&') 155 | for(let i=0; i -1) { 165 | let jctqSignDoubleBodys = jctqSignDoubleBody.split('&') 166 | for(let i=0; i -1) signStr = '签到' 203 | console.log(`领取第${idx+1}个奖励成功,${signStr}获得${result.items.score}金币`) 204 | } 205 | } else { 206 | console.log(`领取第${idx+1}个奖励失败:${result.message}`) 207 | } 208 | } 209 | 210 | //签到翻倍 211 | async function toDouble(rewardBody) { 212 | let caller = printCaller() 213 | let url = 'https://tq.xunsl.com/v5/CommonReward/toDouble.json' 214 | let urlObject = populatePostUrl(url,rewardBody) 215 | await httpPost(urlObject,caller) 216 | let result = httpResult; 217 | if(!result) return 218 | 219 | if(result.success == true) { 220 | if(result.items && result.items.score) { 221 | console.log(`签到翻倍成功,获得${result.items.score}金币`) 222 | } 223 | } else { 224 | console.log(`签到翻倍失败:${result.message}`) 225 | } 226 | } 227 | 228 | //今日收益 229 | async function getBalance(cookie) { 230 | let caller = printCaller() 231 | let url = 'https://tq.xunsl.com/wap/user/balance?keyword_wyq=woyaoq.com&' + cookie 232 | let urlObject = populateGetUrl(url) 233 | await httpGet(urlObject,caller) 234 | let result = httpResult; 235 | if(!result) return 236 | 237 | if(result.status == 0) { 238 | notifyStr += `【金币总数】:${result.user.score}\n` 239 | notifyStr += `【今日收益】:${result.user.today_score}\n` 240 | for(let i=0; i -1) { 243 | for(let j=0; j { 309 | $.post(url, async (err, resp, data) => { 310 | try { 311 | if (err) { 312 | console.log(caller + ": post请求失败"); 313 | console.log(JSON.stringify(err)); 314 | $.logErr(err); 315 | } else { 316 | if (safeGet(data)) { 317 | httpResult = JSON.parse(data,caller); 318 | if(logDebug) console.log(httpResult); 319 | } 320 | } 321 | } catch (e) { 322 | $.logErr(e, resp); 323 | } finally { 324 | resolve(); 325 | } 326 | }); 327 | }); 328 | } 329 | 330 | async function httpGet(url,caller) { 331 | httpResult = null 332 | return new Promise((resolve) => { 333 | $.get(url, async (err, resp, data) => { 334 | try { 335 | if (err) { 336 | console.log(caller + ": get请求失败"); 337 | console.log(JSON.stringify(err)); 338 | $.logErr(err); 339 | } else { 340 | if (safeGet(data,caller)) { 341 | httpResult = JSON.parse(data); 342 | if(logDebug) console.log(httpResult); 343 | } 344 | } 345 | } catch (e) { 346 | $.logErr(e, resp); 347 | } finally { 348 | resolve(); 349 | } 350 | }); 351 | }); 352 | } 353 | 354 | function safeGet(data,caller) { 355 | try { 356 | if (typeof JSON.parse(data) == "object") { 357 | return true; 358 | } else { 359 | console.log(`Function ${caller}: 未知错误`); 360 | console.log(data) 361 | } 362 | } catch (e) { 363 | console.log(e); 364 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 365 | return false; 366 | } 367 | } 368 | 369 | function printCaller(){ 370 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 371 | } 372 | 373 | 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) } 374 | -------------------------------------------------------------------------------- /jctq/jctq_rewrite.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:水果天气(v8.3.9) 3 | 4 | 此脚本负责:捉包重写 5 | 6 | 脚本会自动提现,如果不想自动提现的,请不要捉提现body,或者新建环境变量jctqWithdrawFlag,写成0 7 | 8 | 重写: 9 | https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json -- 点开任务页即可获取jctqCookie 10 | https://tq.xunsl.com/v5/CommonReward/toGetReward.json -- 领取签到和任务奖励后获取。首页左方点击福利视频浮窗(一共5次,建议捉到第一个后复制4遍)。获取完建议关掉重写 11 | https://tq.xunsl.com/v5/article/info.json -- 点开文章获取文章body,获取完建议关掉重写 12 | https://tq.xunsl.com/v5/article/detail.json -- 点开视频获取视频body,获取完建议关掉重写 13 | https://tq.xunsl.com/v5/user/stay.json -- 阅读文章或者看视频一段时间后可以获取到时长body,获取完务必关掉重写,同一个账号不要获取多个时长body 14 | https://tq.xunsl.com/v5/nameless/adlickstart.json -- 点开看看赚获取body,可以一直开着,看看赚会不定时更新 15 | https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json -- (旧版8.3.7)点开福利页浮窗宝箱和观看翻倍视频获取body,获取完建议关掉重写 16 | https://tq.xunsl.com/v5/weather/giveTimeInterval.json -- (旧版8.3.7)点开首页气泡红包和观看翻倍视频获取body,获取完建议关掉重写 17 | https://tq.xunsl.com/v5/Weather/giveReceiveGoldCoin.json -- 任务页点击一键收金币获取第一个body,收金币后看完视频领奖励获取第二个body 18 | https://tq.xunsl.com/v17/Rvideo/videoCallback.json -- 资讯页右上角宝箱,看视频领取奖励后获取 19 | https://tq.xunsl.com/v5/wechat/withdraw2.json -- 提现一次对应金额获取body 20 | https://tq.xunsl.com/v5/CommonReward/toDouble.json -- 领取签到翻倍奖励后可获取 21 | 22 | 任务: 23 | jctq_daily.js -- 各种时段奖励,抽奖,转发 24 | jctq_reward.js -- 签到和翻倍,任务奖励领取,领首页福利视频奖励,首页统计今日收益,自动提现 25 | jctq_kkz.js -- 完成看看赚任务 26 | jctq_read.js -- 阅读文章,浏览视频 27 | 28 | */ 29 | 30 | const jsname = '晶彩天气捉包重写' 31 | const $ = Env(jsname) 32 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 33 | const logDebug = 0 34 | 35 | let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; 36 | let jctqBoxbody = ($.isNode() ? process.env.jctqBoxbody : $.getdata('jctqBoxbody')) || ''; 37 | let jctqTimeBody = ($.isNode() ? process.env.jctqTimeBody : $.getdata('jctqTimeBody')) || ''; 38 | let jctqWzBody = ($.isNode() ? process.env.jctqWzBody : $.getdata('jctqWzBody')) || ''; 39 | let jctqLookStartbody = ($.isNode() ? process.env.jctqLookStartbody : $.getdata('jctqLookStartbody')) || ''; 40 | let jctqWithdraw = ($.isNode() ? process.env.jctqWithdraw : $.getdata('jctqWithdraw')) || ''; 41 | let jctqBubbleBody = ($.isNode() ? process.env.jctqBubbleBody : $.getdata('jctqBubbleBody')) || ''; 42 | let jctqGiveBoxBody = ($.isNode() ? process.env.jctqGiveBoxBody : $.getdata('jctqGiveBoxBody')) || ''; 43 | let jctqSignDoubleBody = ($.isNode() ? process.env.jctqSignDoubleBody : $.getdata('jctqSignDoubleBody')) || ''; 44 | let jctqGoldBody = ($.isNode() ? process.env.jctqGoldBody : $.getdata('jctqGoldBody')) || ''; 45 | let jctqVideoBody = ($.isNode() ? process.env.jctqVideoBody : $.getdata('jctqVideoBody')) || ''; 46 | 47 | /////////////////////////////////////////////////////////////////// 48 | 49 | !(async () => { 50 | 51 | if(typeof $request !== "undefined") 52 | { 53 | await getRewrite() 54 | } else { 55 | $.msg(jsname+': 此脚本只负责重写,请检查任务设置') 56 | } 57 | 58 | })() 59 | .catch((e) => $.logErr(e)) 60 | .finally(() => $.done()) 61 | 62 | async function getRewrite() { 63 | 64 | if($request.url.indexOf('v17/NewTask/getTaskListByWeather.json') > -1) { 65 | rUrl = $request.url 66 | app_version = rUrl.match(/app_version=([\w\.]+)/)[1] 67 | zqkey = rUrl.match(/zqkey=([\w-]+)/)[1] 68 | zqkey_id = rUrl.match(/zqkey_id=([\w-]+)/)[1] 69 | uid = rUrl.match(/uid=([\w]+)/)[1] 70 | uidStr = 'uid=' + uid 71 | 72 | let newCookie = `app_version=${app_version}&cookie=${zqkey}&cookie_id=${zqkey_id}&uid=${uid}` 73 | if(jctqCookie) { 74 | if(jctqCookie.indexOf(uidStr) > -1) { 75 | $.msg(jsname+` 此jctqCookie已存在,本次跳过`) 76 | } else { 77 | jctqCookie = jctqCookie + '@' + newCookie 78 | $.setdata(jctqCookie, 'jctqCookie'); 79 | bodyList = jctqCookie.split('@') 80 | $.msg(jsname+` 获取第${bodyList.length}个jctqCookie成功`) 81 | } 82 | } else { 83 | $.setdata(newCookie, 'jctqCookie'); 84 | $.msg(jsname+` 获取第一个jctqCookie成功`) 85 | } 86 | } 87 | 88 | if($request.url.indexOf('v5/CommonReward/toGetReward.json') > -1) { 89 | rBody = $request.body 90 | if(jctqBoxbody) { 91 | if(jctqBoxbody.indexOf(rBody) > -1) { 92 | $.msg(jsname+` 此签到/奖励body已存在,本次跳过`) 93 | } else { 94 | jctqBoxbody = jctqBoxbody + '&' + rBody 95 | $.setdata(jctqBoxbody, 'jctqBoxbody'); 96 | bodyList = jctqBoxbody.split('&') 97 | $.msg(jsname+` 获取第${bodyList.length}个签到/奖励body成功`) 98 | } 99 | } else { 100 | $.setdata(rBody, 'jctqBoxbody'); 101 | $.msg(jsname+` 获取第一个签到/奖励body成功`) 102 | } 103 | } 104 | 105 | if($request.url.indexOf('v5/article/info.json') > -1 || 106 | $request.url.indexOf('v5/article/detail.json') > -1) { 107 | rUrl = $request.url 108 | bodys = rUrl.split('?p=') 109 | rBody = 'p=' + bodys[1] 110 | if(jctqWzBody) { 111 | if(jctqWzBody.indexOf(rBody) > -1) { 112 | $.msg(jsname+` 此文章/视频body已存在,本次跳过`) 113 | } else { 114 | jctqWzBody = jctqWzBody + '&' + rBody 115 | $.setdata(jctqWzBody, 'jctqWzBody'); 116 | bodyList = jctqWzBody.split('&') 117 | $.msg(jsname+` 获取第${bodyList.length}个文章/视频body成功`) 118 | } 119 | } else { 120 | $.setdata(rBody, 'jctqWzBody'); 121 | $.msg(jsname+` 获取第一个文章/视频body成功`) 122 | } 123 | } 124 | 125 | if($request.url.indexOf('v5/user/stay.json') > -1) { 126 | rBody = $request.body 127 | if(jctqTimeBody) { 128 | if(jctqTimeBody.indexOf(rBody) > -1) { 129 | $.msg(jsname+` 此时长body已存在,本次跳过`) 130 | } else { 131 | jctqTimeBody = jctqTimeBody + '&' + rBody 132 | $.setdata(jctqTimeBody, 'jctqTimeBody'); 133 | bodyList = jctqTimeBody.split('&') 134 | $.msg(jsname+` 获取第${bodyList.length}个时长body成功`) 135 | } 136 | } else { 137 | $.setdata(rBody, 'jctqTimeBody'); 138 | $.msg(jsname+` 获取第一个时长body成功`) 139 | } 140 | } 141 | 142 | if($request.url.indexOf('v5/nameless/adlickstart.json') > -1) { 143 | rBody = $request.body 144 | if(jctqLookStartbody) { 145 | if(jctqLookStartbody.indexOf(rBody) > -1) { 146 | $.msg(jsname+` 此看看赚body已存在,本次跳过`) 147 | } else { 148 | jctqLookStartbody = jctqLookStartbody + '&' + rBody 149 | $.setdata(jctqLookStartbody, 'jctqLookStartbody'); 150 | bodyList = jctqLookStartbody.split('&') 151 | $.msg(jsname+` 获取第${bodyList.length}个看看赚body成功`) 152 | } 153 | } else { 154 | $.setdata(rBody, 'jctqLookStartbody'); 155 | $.msg(jsname+` 获取第一个看看赚body成功`) 156 | } 157 | } 158 | 159 | if($request.url.indexOf('v5/wechat/withdraw2.json') > -1) { 160 | rBody = $request.body 161 | if(jctqWithdraw) { 162 | if(jctqWithdraw.indexOf(rBody) > -1) { 163 | $.msg(jsname+` 此提现body已存在,本次跳过`) 164 | } else { 165 | jctqWithdraw = jctqWithdraw + '&' + rBody 166 | $.setdata(jctqWithdraw, 'jctqWithdraw'); 167 | bodyList = jctqWithdraw.split('&') 168 | $.msg(jsname+` 获取第${bodyList.length}个提现body成功`) 169 | } 170 | } else { 171 | $.setdata(rBody, 'jctqWithdraw'); 172 | $.msg(jsname+` 获取第一个提现body成功`) 173 | } 174 | } 175 | 176 | if($request.url.indexOf('v5/Weather/giveBoxOnWeather.json') > -1) { 177 | rBody = $request.body 178 | if(jctqGiveBoxBody) { 179 | if(jctqGiveBoxBody.indexOf(rBody) > -1) { 180 | $.msg(jsname+` 此福利页宝箱/翻倍body已存在,本次跳过`) 181 | } else { 182 | jctqGiveBoxBody = jctqGiveBoxBody + '&' + rBody 183 | $.setdata(jctqGiveBoxBody, 'jctqGiveBoxBody'); 184 | bodyList = jctqGiveBoxBody.split('&') 185 | $.msg(jsname+` 获取第${bodyList.length}个福利页宝箱/翻倍body成功`) 186 | } 187 | } else { 188 | $.setdata(rBody, 'jctqGiveBoxBody'); 189 | $.msg(jsname+` 获取第一个福利页宝箱/翻倍body成功`) 190 | } 191 | } 192 | 193 | if($request.url.indexOf('v5/weather/giveTimeInterval.json') > -1) { 194 | rBody = $request.body 195 | if(jctqBubbleBody) { 196 | if(jctqBubbleBody.indexOf(rBody) > -1) { 197 | $.msg(jsname+` 此首页气泡/翻倍body已存在,本次跳过`) 198 | } else { 199 | jctqBubbleBody = jctqBubbleBody + '&' + rBody 200 | $.setdata(jctqBubbleBody, 'jctqBubbleBody'); 201 | bodyList = jctqBubbleBody.split('&') 202 | $.msg(jsname+` 获取第${bodyList.length}个首页气泡/翻倍body成功`) 203 | } 204 | } else { 205 | $.setdata(rBody, 'jctqBubbleBody'); 206 | $.msg(jsname+` 获取第一个首页气泡/翻倍body成功`) 207 | } 208 | } 209 | 210 | if($request.url.indexOf('v5/CommonReward/toDouble.json') > -1) { 211 | rBody = $request.body 212 | if(jctqSignDoubleBody) { 213 | if(jctqSignDoubleBody.indexOf(rBody) > -1) { 214 | $.msg(jsname+` 此签到翻倍body已存在,本次跳过`) 215 | } else { 216 | jctqSignDoubleBody = jctqSignDoubleBody + '&' + rBody 217 | $.setdata(jctqSignDoubleBody, 'jctqSignDoubleBody'); 218 | bodyList = jctqSignDoubleBody.split('&') 219 | $.msg(jsname+` 获取第${bodyList.length}个签到翻倍body成功`) 220 | } 221 | } else { 222 | $.setdata(rBody, 'jctqSignDoubleBody'); 223 | $.msg(jsname+` 获取第一个签到翻倍body成功`) 224 | } 225 | } 226 | 227 | if($request.url.indexOf('v5/Weather/giveReceiveGoldCoin.json') > -1) { 228 | rBody = $request.body 229 | if(jctqGoldBody) { 230 | if(jctqGoldBody.indexOf(rBody) > -1) { 231 | $.msg(jsname+` 此收金币body已存在,本次跳过`) 232 | } else { 233 | jctqGoldBody = jctqGoldBody + '&' + rBody 234 | $.setdata(jctqGoldBody, 'jctqGoldBody'); 235 | bodyList = jctqGoldBody.split('&') 236 | $.msg(jsname+` 获取第${bodyList.length}个收金币body成功`) 237 | } 238 | } else { 239 | $.setdata(rBody, 'jctqGoldBody'); 240 | $.msg(jsname+` 获取第一个收金币body成功`) 241 | } 242 | } 243 | 244 | if($request.url.indexOf('v17/Rvideo/videoCallback.json') > -1) { 245 | rBody = $request.body 246 | if(jctqVideoBody) { 247 | if(jctqVideoBody.indexOf(rBody) > -1) { 248 | $.msg(jsname+` 此资讯页视频奖励body已存在,本次跳过`) 249 | } else { 250 | jctqVideoBody = jctqVideoBody + '@' + rBody 251 | $.setdata(jctqVideoBody, 'jctqVideoBody'); 252 | bodyList = jctqVideoBody.split('@') 253 | $.msg(jsname+` 获取第${bodyList.length}个资讯页视频奖励body成功`) 254 | } 255 | } else { 256 | $.setdata(rBody, 'jctqVideoBody'); 257 | $.msg(jsname+` 获取第一个资讯页视频奖励body成功`) 258 | } 259 | } 260 | } 261 | 262 | //////////////////////////////////////////////////////////////////// 263 | 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) } 264 | -------------------------------------------------------------------------------- /jctq/jctq_rewrite_subscribe.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "晶彩天气重写订阅", 3 | "type": "rewrite", 4 | "note": "仅供参考", 5 | "author": "leaf", 6 | "resource": "jctq_rewrite_subscribe.json", 7 | "mitmhost": [ 8 | "tq.xunsl.com" 9 | ], 10 | "rewrite": [ 11 | { 12 | "match": "https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json", 13 | "stage": "req", 14 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 15 | "enable": true 16 | }, 17 | { 18 | "match": "https://tq.xunsl.com/v5/CommonReward/toGetReward.json", 19 | "stage": "req", 20 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 21 | "enable": true 22 | }, 23 | { 24 | "match": "https://tq.xunsl.com/v5/article/info.json", 25 | "stage": "req", 26 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 27 | "enable": true 28 | }, 29 | { 30 | "match": "https://tq.xunsl.com/v5/article/detail.json", 31 | "stage": "req", 32 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 33 | "enable": true 34 | }, 35 | { 36 | "match": "https://tq.xunsl.com/v5/user/stay.json", 37 | "stage": "req", 38 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 39 | "enable": true 40 | }, 41 | { 42 | "match": "https://tq.xunsl.com/v5/nameless/adlickstart.json", 43 | "stage": "req", 44 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 45 | "enable": true 46 | }, 47 | { 48 | "match": "https://tq.xunsl.com/v5/wechat/withdraw2.json", 49 | "stage": "req", 50 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 51 | "enable": true 52 | }, 53 | { 54 | "match": "https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json", 55 | "stage": "req", 56 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 57 | "enable": true 58 | }, 59 | { 60 | "match": "https://tq.xunsl.com/v5/weather/giveTimeInterval.json", 61 | "stage": "req", 62 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 63 | "enable": true 64 | }, 65 | { 66 | "match": "https://tq.xunsl.com/v5/CommonReward/toDouble.json", 67 | "stage": "req", 68 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 69 | "enable": true 70 | }, 71 | { 72 | "match": "https://tq.xunsl.com/v5/Weather/giveReceiveGoldCoin.json", 73 | "stage": "req", 74 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 75 | "enable": true 76 | }, 77 | { 78 | "match": "https://tq.xunsl.com/v17/Rvideo/videoCallback.json", 79 | "stage": "req", 80 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 81 | "enable": true 82 | } 83 | ], 84 | "task": { 85 | "type": "skip", 86 | "list": [ 87 | { 88 | "name": "晶彩天气看看赚", 89 | "type": "cron", 90 | "time": "30 9,20 * * *", 91 | "job": { 92 | "type": "runjs", 93 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_kkz.js" 94 | } 95 | }, 96 | { 97 | "name": "晶彩天气文章视频", 98 | "type": "cron", 99 | "time": "20 7,18 * * *", 100 | "job": { 101 | "type": "runjs", 102 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_read.js" 103 | } 104 | }, 105 | { 106 | "name": "晶彩天气日常任务", 107 | "type": "cron", 108 | "time": "15,45 * * * *", 109 | "job": { 110 | "type": "runjs", 111 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_daily.js" 112 | } 113 | }, 114 | { 115 | "name": "晶彩天气任务签到", 116 | "type": "cron", 117 | "time": "30 22 * * *", 118 | "job": { 119 | "type": "runjs", 120 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_reward.js" 121 | } 122 | } 123 | ] 124 | } 125 | } -------------------------------------------------------------------------------- /jctq/jctq_rewrite_subscribe.json.bak: -------------------------------------------------------------------------------- 1 | { 2 | "name": "晶彩天气重写订阅", 3 | "type": "rewrite", 4 | "note": "仅供参考", 5 | "author": "leaf", 6 | "resource": "jctq_rewrite_subscribe.json", 7 | "mitmhost": [ 8 | "tq.xunsl.com" 9 | ], 10 | "rewrite": [ 11 | { 12 | "match": "https://tq.xunsl.com/v17/NewTask/getTaskListByWeather.json", 13 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 14 | "enable": true 15 | }, 16 | { 17 | "match": "https://tq.xunsl.com/v5/CommonReward/toGetReward.json", 18 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 19 | "enable": true 20 | }, 21 | { 22 | "match": "https://tq.xunsl.com/v5/article/info.json", 23 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 24 | "enable": true 25 | }, 26 | { 27 | "match": "https://tq.xunsl.com/v5/article/detail.json", 28 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 29 | "enable": true 30 | }, 31 | { 32 | "match": "https://tq.xunsl.com/v5/user/stay.json", 33 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 34 | "enable": true 35 | }, 36 | { 37 | "match": "https://tq.xunsl.com/v5/nameless/adlickstart.json", 38 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 39 | "enable": true 40 | }, 41 | { 42 | "match": "https://tq.xunsl.com/v5/wechat/withdraw2.json", 43 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 44 | "enable": true 45 | }, 46 | { 47 | "match": "https://tq.xunsl.com/v5/Weather/giveBoxOnWeather.json", 48 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 49 | "enable": true 50 | }, 51 | { 52 | "match": "https://tq.xunsl.com/v5/weather/giveTimeInterval.json", 53 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_rewrite.js", 54 | "enable": true 55 | } 56 | ], 57 | "task": { 58 | "type": "skip", 59 | "list": [ 60 | { 61 | "name": "晶彩天气看看赚", 62 | "type": "cron", 63 | "time": "30 9,20 * * *", 64 | "job": { 65 | "type": "runjs", 66 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_kkz.js" 67 | }, 68 | "running": true 69 | }, 70 | { 71 | "name": "晶彩天气文章视频", 72 | "type": "cron", 73 | "time": "20 7,18 * * *", 74 | "job": { 75 | "type": "runjs", 76 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_read.js" 77 | }, 78 | "running": true 79 | }, 80 | { 81 | "name": "晶彩天气日常任务", 82 | "type": "cron", 83 | "time": "15,45 * * * *", 84 | "job": { 85 | "type": "runjs", 86 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_daily.js" 87 | }, 88 | "running": true 89 | }, 90 | { 91 | "name": "晶彩天气任务签到", 92 | "type": "cron", 93 | "time": "30 22 * * *", 94 | "job": { 95 | "type": "runjs", 96 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_reward.js" 97 | }, 98 | "running": true 99 | } 100 | ] 101 | } 102 | } -------------------------------------------------------------------------------- /jctq/jctq_shareRead.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:晶彩天气(v8.3.7) 3 | 4 | 转发和分享阅读,请勿贪心,小心黑号 5 | */ 6 | 7 | const jsname = '晶彩天气分享阅读' 8 | const $ = Env(jsname) 9 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 10 | const logDebug = 0 11 | 12 | //const notify = $.isNode() ? require('./sendNotify') : ''; 13 | let notifyStr = '' 14 | 15 | let rndtime = "" //毫秒 16 | let httpResult //global buffer 17 | 18 | let jctqCookie = ($.isNode() ? process.env.jctqCookie : $.getdata('jctqCookie')) || ''; 19 | let jctqCookieArr = [] 20 | 21 | let userCk = '' 22 | let readCount = 0 23 | 24 | let jctqShareNum = ($.isNode() ? process.env.jctqShareNum : $.getdata('jctqShareNum')) || 0; 25 | 26 | let newsItem = '' 27 | let UserAgent = '' 28 | let si = '' 29 | 30 | /////////////////////////////////////////////////////////////////// 31 | 32 | !(async () => { 33 | 34 | if(typeof $request !== "undefined") 35 | { 36 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 37 | } 38 | else 39 | { 40 | if(!(await checkEnv())){ 41 | return 42 | } 43 | 44 | for(let j=0; j maxWaitTime ? maxWaitTime : seedFactor 62 | let randomTime = Math.floor(Math.random()*factor) + 1000 63 | let second = Math.floor(randomTime/1000) 64 | UserAgent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x1800102c) NetType/WIFI Language/zh_CN' 65 | si = randomString(32) 66 | console.log(`--随机延迟${second}秒后开始模拟第${readCount}次分享阅读`) 67 | await $.wait(randomTime) 68 | console.log(`----模拟第${readCount}次阅读,使用si=${si}`) 69 | await shareReadStep1() 70 | await $.wait(Math.floor(Math.random()*500)+500) 71 | await shareReadStep2() 72 | await $.wait(Math.floor(Math.random()*1000)+2000) 73 | await shareReadStep3() 74 | await $.wait(Math.floor(Math.random()*1000)+2000) 75 | await shareReadStep4() 76 | console.log(`----模拟第${readCount}次阅读完成`) 77 | } 78 | 79 | } 80 | } 81 | } 82 | 83 | 84 | })() 85 | .catch((e) => $.logErr(e)) 86 | .finally(() => $.done()) 87 | 88 | //通知 89 | async function showmsg() { 90 | 91 | notifyBody = jsname + "运行通知\n\n" + notifyStr 92 | 93 | if (notifyFlag != 1) { 94 | console.log(notifyBody); 95 | } 96 | 97 | if (notifyFlag == 1) { 98 | $.msg(notifyBody); 99 | //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} 100 | } 101 | } 102 | 103 | async function checkEnv() { 104 | 105 | if(jctqShareNum == 0) { 106 | console.log('当前分享次数设置为0。如果需要开启分享阅读,请设置环境变量jctqShareNum为要被阅读的次数。') 107 | return false 108 | } 109 | 110 | if(jctqCookie) { 111 | if(jctqCookie.indexOf('@') > -1) { 112 | let jctqCookies = jctqCookie.split('@') 113 | for(let i=0; i { 270 | $.post(url, async (err, resp, data) => { 271 | try { 272 | if (err) { 273 | console.log(caller + ": post请求失败"); 274 | console.log(JSON.stringify(err)); 275 | $.logErr(err); 276 | } else { 277 | if (safeGet(data)) { 278 | httpResult = JSON.parse(data,caller); 279 | if(logDebug) console.log(httpResult); 280 | } 281 | } 282 | } catch (e) { 283 | $.logErr(e, resp); 284 | } finally { 285 | resolve(); 286 | } 287 | }); 288 | }); 289 | } 290 | 291 | async function httpGet(url,caller) { 292 | httpResult = null 293 | return new Promise((resolve) => { 294 | $.get(url, async (err, resp, data) => { 295 | try { 296 | if (err) { 297 | console.log(caller + ": get请求失败"); 298 | console.log(JSON.stringify(err)); 299 | $.logErr(err); 300 | } else { 301 | // 302 | } 303 | } catch (e) { 304 | $.logErr(e, resp); 305 | } finally { 306 | resolve(); 307 | } 308 | }); 309 | }); 310 | } 311 | 312 | function safeGet(data,caller) { 313 | try { 314 | if (typeof JSON.parse(data) == "object") { 315 | return true; 316 | } else { 317 | console.log(`Function ${caller}: 未知错误`); 318 | console.log(data) 319 | } 320 | } catch (e) { 321 | console.log(e); 322 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 323 | return false; 324 | } 325 | } 326 | 327 | function printCaller(){ 328 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 329 | } 330 | 331 | 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) } 332 | -------------------------------------------------------------------------------- /jctq/jctq_task_subscribe.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "晶彩天气重写订阅", 3 | "type": "rewrite", 4 | "note": "仅供参考", 5 | "author": "leaf", 6 | "list": [ 7 | { 8 | "name": "晶彩天气看看赚", 9 | "type": "cron", 10 | "time": "30 9,20 * * *", 11 | "job": { 12 | "type": "runjs", 13 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_kkz.js" 14 | }, 15 | "running": true 16 | }, 17 | { 18 | "name": "晶彩天气文章视频", 19 | "type": "cron", 20 | "time": "20 7,18 * * *", 21 | "job": { 22 | "type": "runjs", 23 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_read.js" 24 | }, 25 | "running": true 26 | }, 27 | { 28 | "name": "晶彩天气日常任务", 29 | "type": "cron", 30 | "time": "15,45 * * * *", 31 | "job": { 32 | "type": "runjs", 33 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_daily.js" 34 | }, 35 | "running": true 36 | }, 37 | { 38 | "name": "晶彩天气任务签到", 39 | "type": "cron", 40 | "time": "30 22 * * *", 41 | "job": { 42 | "type": "runjs", 43 | "target": "https://raw.githubusercontent.com/leafxcy/JavaScript/main/jctq/jctq_reward.js" 44 | }, 45 | "running": true 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /ysm.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DsTansice/leafxcy_JavaScript/f0a40bd438f57f7308354d0c705a4ef311f4c29a/ysm.jpg -------------------------------------------------------------------------------- /zqkd/zqkd_risk.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:中青看点 风险查询+今日收益详情 3 | 4 | 需要用到zqkdCookie,只测试了青龙,理论上V2P也能用 5 | 本脚本没有设置重写,请自己复制zq_cookie到青龙环境下使用,多账号用@隔开 6 | 例子: export zqkdCookie='uid=xxx&zqkey=yyy&zqkey_id=zzz@uid=aaa&zqkey=bbb&zqkey_id=ccc@uid=qqq&zqkey=sss&zqkey_id=ttt' 7 | */ 8 | 9 | const jsname = '中青看点风险查询' 10 | const $ = Env(jsname) 11 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 12 | const logDebug = 0 13 | 14 | const notify = $.isNode() ? require('./sendNotify') : ''; 15 | let notifyStr = '' 16 | 17 | let rndtime = "" //毫秒 18 | let httpResult //global buffer 19 | 20 | let userCookie = ($.isNode() ? process.env.zqkdCookie : $.getdata('zqkdCookie')) || ''; 21 | let userCookieArr = [] 22 | 23 | let nickname = [] 24 | /////////////////////////////////////////////////////////////////// 25 | 26 | !(async () => { 27 | 28 | if(typeof $request !== "undefined") 29 | { 30 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 31 | } 32 | else 33 | { 34 | if(!(await checkEnv())) { 35 | return 36 | } 37 | 38 | await initAccountInfo() 39 | await RunRiskInfo() 40 | await RunUserBalance() 41 | 42 | await showmsg() 43 | } 44 | 45 | 46 | })() 47 | .catch((e) => $.logErr(e)) 48 | .finally(() => $.done()) 49 | 50 | //通知 51 | async function showmsg() { 52 | 53 | notifyBody = jsname + "运行通知\n\n" + notifyStr 54 | 55 | if (notifyFlag != 1) { 56 | console.log(notifyBody); 57 | } 58 | 59 | if (notifyFlag == 1) { 60 | $.msg(notifyBody); 61 | if($.isNode()){await notify.sendNotify($.name, notifyBody );} 62 | } 63 | } 64 | 65 | async function checkEnv() { 66 | if(userCookie) { 67 | if(userCookie.indexOf('@') > -1) { 68 | let userCookies = userCookie.split('@') 69 | for(let i=0; i -1) { 201 | for(let j=0; j { 248 | $.post(url, async (err, resp, data) => { 249 | try { 250 | if (err) { 251 | console.log(caller + ": post请求失败"); 252 | console.log(JSON.stringify(err)); 253 | $.logErr(err); 254 | } else { 255 | if (safeGet(data)) { 256 | httpResult = JSON.parse(data); 257 | if(logDebug) console.log(httpResult); 258 | } 259 | } 260 | } catch (e) { 261 | $.logErr(e, resp); 262 | } finally { 263 | resolve(); 264 | } 265 | }); 266 | }); 267 | } 268 | 269 | async function httpGet(url,caller) { 270 | httpResult = null 271 | return new Promise((resolve) => { 272 | $.get(url, async (err, resp, data) => { 273 | try { 274 | if (err) { 275 | console.log(caller + ": get请求失败"); 276 | console.log(JSON.stringify(err)); 277 | $.logErr(err); 278 | } else { 279 | if (safeGet(data,caller)) { 280 | httpResult = JSON.parse(data); 281 | if(logDebug) console.log(httpResult); 282 | } 283 | } 284 | } catch (e) { 285 | $.logErr(e, resp); 286 | } finally { 287 | resolve(); 288 | } 289 | }); 290 | }); 291 | } 292 | 293 | function safeGet(data,caller) { 294 | try { 295 | if (typeof JSON.parse(data) == "object") { 296 | return true; 297 | } else { 298 | console.log(`Function ${caller}: 未知错误`); 299 | console.log(data) 300 | } 301 | } catch (e) { 302 | console.log(e); 303 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 304 | return false; 305 | } 306 | } 307 | 308 | function printCaller(){ 309 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 310 | } 311 | 312 | 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) } 313 | -------------------------------------------------------------------------------- /zqkd/zqkd_shareRead.js: -------------------------------------------------------------------------------- 1 | /* 2 | 安卓:中青看点 3 | 4 | 转发和分享阅读,请勿贪心,小心黑号 5 | */ 6 | 7 | const jsname = '中青看点分享阅读' 8 | const $ = Env(jsname) 9 | const notifyFlag = 1; //0为关闭通知,1为打开通知,默认为1 10 | const logDebug = 0 11 | 12 | //const notify = $.isNode() ? require('./sendNotify') : ''; 13 | let notifyStr = '' 14 | 15 | let rndtime = "" //毫秒 16 | let httpResult //global buffer 17 | 18 | let zqkdCookie = ($.isNode() ? process.env.zq_cookie : $.getdata('zq_cookie')) || ''; 19 | let zqkdCookieArr = [] 20 | 21 | let userCk = '' 22 | let readCount = 0 23 | 24 | let zqkdShareNum = ($.isNode() ? process.env.zqkdShareNum : $.getdata('zqkdShareNum')) || 0; 25 | 26 | let newsItem = '' 27 | let UserAgent = '' 28 | let si = '' 29 | 30 | /////////////////////////////////////////////////////////////////// 31 | 32 | !(async () => { 33 | 34 | if(typeof $request !== "undefined") 35 | { 36 | $.msg(jsname+': 此脚本不做重写,请检查重写设置') 37 | } 38 | else 39 | { 40 | if(!(await checkEnv())){ 41 | return 42 | } 43 | 44 | for(let j=0; j maxWaitTime ? maxWaitTime : seedFactor 62 | let randomTime = Math.floor(Math.random()*factor) + 1000 63 | let second = Math.floor(randomTime/1000) 64 | UserAgent = `Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.16(0x1800102c) NetType/WIFI Language/zh_CN` 65 | si = randomString(32) 66 | console.log(`--随机延迟${second}秒后开始模拟第${readCount}次分享阅读`) 67 | await $.wait(randomTime) 68 | console.log(`----模拟第${readCount}次阅读,使用si=${si}`) 69 | await shareReadStep1() 70 | await $.wait(Math.floor(Math.random()*500)+500) 71 | await shareReadStep2() 72 | await $.wait(Math.floor(Math.random()*1000)+2000) 73 | await shareReadStep3() 74 | await $.wait(Math.floor(Math.random()*1000)+2000) 75 | await shareReadStep4() 76 | console.log(`----模拟第${readCount}次阅读完成`) 77 | } 78 | 79 | } 80 | } 81 | } 82 | 83 | 84 | })() 85 | .catch((e) => $.logErr(e)) 86 | .finally(() => $.done()) 87 | 88 | //通知 89 | async function showmsg() { 90 | 91 | notifyBody = jsname + "运行通知\n\n" + notifyStr 92 | 93 | if (notifyFlag != 1) { 94 | console.log(notifyBody); 95 | } 96 | 97 | if (notifyFlag == 1) { 98 | $.msg(notifyBody); 99 | //if ($.isNode()){await notify.sendNotify($.name, notifyBody );} 100 | } 101 | } 102 | 103 | async function checkEnv() { 104 | 105 | if(zqkdShareNum == 0) { 106 | console.log('当前分享次数设置为0。如果需要开启分享阅读,请设置环境变量zqkdShareNum为要被阅读的次数。') 107 | return false 108 | } 109 | 110 | if(zqkdCookie) { 111 | if(zqkdCookie.indexOf('@') > -1) { 112 | let zqkdCookies = zqkdCookie.split('@') 113 | for(let i=0; i { 267 | $.post(url, async (err, resp, data) => { 268 | try { 269 | if (err) { 270 | console.log(caller + ": post请求失败"); 271 | console.log(JSON.stringify(err)); 272 | $.logErr(err); 273 | } else { 274 | if (safeGet(data)) { 275 | httpResult = JSON.parse(data,caller); 276 | if(logDebug) console.log(httpResult); 277 | } 278 | } 279 | } catch (e) { 280 | $.logErr(e, resp); 281 | } finally { 282 | resolve(); 283 | } 284 | }); 285 | }); 286 | } 287 | 288 | async function httpGet(url,caller) { 289 | httpResult = null 290 | return new Promise((resolve) => { 291 | $.get(url, async (err, resp, data) => { 292 | try { 293 | if (err) { 294 | console.log(caller + ": get请求失败"); 295 | console.log(JSON.stringify(err)); 296 | $.logErr(err); 297 | } else { 298 | // 299 | } 300 | } catch (e) { 301 | $.logErr(e, resp); 302 | } finally { 303 | resolve(); 304 | } 305 | }); 306 | }); 307 | } 308 | 309 | function safeGet(data,caller) { 310 | try { 311 | if (typeof JSON.parse(data) == "object") { 312 | return true; 313 | } else { 314 | console.log(`Function ${caller}: 未知错误`); 315 | console.log(data) 316 | } 317 | } catch (e) { 318 | console.log(e); 319 | console.log(`Function ${caller}: 服务器访问数据为空,请检查自身设备网络情况`); 320 | return false; 321 | } 322 | } 323 | 324 | function printCaller(){ 325 | return (new Error()).stack.split("\n")[2].trim().split(" ")[1] 326 | } 327 | 328 | 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) } 329 | --------------------------------------------------------------------------------