Skip to content

Commit b098dd2

Browse files
mazhimazhi
authored andcommitted
金榜创造营
1 parent 0fced81 commit b098dd2

3 files changed

Lines changed: 236 additions & 0 deletions

File tree

.vs/script/v16/.suo

0 Bytes
Binary file not shown.

.vs/slnx.sqlite

0 Bytes
Binary file not shown.

jd/jd_jbczy.js

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+

2+
/*
3+
* @Author: qqsdf
4+
* @Date: 2021-05-12
5+
6+
金榜创造营,最高瓜分7亿京豆!
7+
https://h5.m.jd.com/babelDiy/Zeus/2H5Ng86mUJLXToEo57qWkJkjFPxw/index.html?fromName=h5
8+
活动期间2021年5月21日至2021年12月31日,用户每日(0:00-24:00)可通过“京东APP首页-排行榜-金榜创造营”参与当天活动
9+
10+
11+
脚本或许兼容: QuantumultX, Surge, Loon, JSBox, Node.js
12+
13+
===========Quantumultx===============
14+
[task_local]
15+
#金榜创造营
16+
0 8 21-31 5-12 * https://raw.githubusercontent.com/qqsdff/script/main/jd/jd_jbczy.js, tag=金榜创造营, enabled=true
17+
18+
修改自lxk0301大佬,侵删
19+
*
20+
*/
21+
const $ = new Env('金榜创造营');
22+
23+
const notify = $.isNode() ? require('./sendNotify') : '';
24+
//Node.js用户请在jdCookie.js处填写京东ck;
25+
const jdCookieNode = $.isNode() ? require('./jdCookie.js') : '';
26+
27+
let cookiesArr = [],
28+
cookie = '',
29+
message;
30+
if ($.isNode()) {
31+
Object.keys(jdCookieNode).forEach((item) => {
32+
cookiesArr.push(jdCookieNode[item])
33+
})
34+
if (process.env.JD_DEBUG && process.env.JD_DEBUG === 'false') console.log = () => { };
35+
} else {
36+
let cookiesData = $.getdata('CookiesJD') || "[]";
37+
cookiesData = jsonParse(cookiesData);
38+
cookiesArr = cookiesData.map(item => item.cookie);
39+
cookiesArr.reverse();
40+
cookiesArr.push(...[$.getdata('CookieJD2'), $.getdata('CookieJD')]);
41+
cookiesArr.reverse();
42+
cookiesArr = cookiesArr.filter(item => item !== "" && item !== null && item !== undefined);
43+
}
44+
45+
!(async () => {
46+
if (!cookiesArr[0]) {
47+
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {
48+
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
49+
});
50+
return;
51+
}
52+
for (let i = 0; i < cookiesArr.length; i++) {
53+
if (cookiesArr[i]) {
54+
cookie = cookiesArr[i];
55+
$.UserName = decodeURIComponent(cookie.match(/pt_pin=(.+?);/) && cookie.match(/pt_pin=(.+?);/)[1])
56+
$.index = i + 1;
57+
$.isLogin = true;
58+
$.nickName = '';
59+
message = '';
60+
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
61+
if (!$.isLogin) {
62+
$.msg($.name, `【提示】cookie已失效`, `京东账号${$.index} ${$.nickName || $.UserName}\n请重新登录获取\nhttps://bean.m.jd.com/bean/signIndex.action`, {
63+
"open-url": "https://bean.m.jd.com/bean/signIndex.action"
64+
});
65+
continue
66+
}
67+
await doTask();
68+
}
69+
}
70+
})()
71+
.catch((e) => {
72+
$.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')
73+
})
74+
.finally(() => {
75+
$.done();
76+
})
77+
78+
async function doTask() {
79+
try {
80+
var goldCreatorTab = await doGet("https://api.m.jd.com/client.action?functionId=goldCreatorTab&body=%7B%22subTitleId%22%3A%22%22%2C%22isPrivateVote%22%3A%220%22%7D&appid=content_ecology&clientVersion=10.0.0&client=wh5")
81+
if (goldCreatorTab.isSuccess == true) {
82+
var subTitleInfos = goldCreatorTab.result.subTitleInfos;
83+
var stageId = goldCreatorTab.result.mainTitleHeadInfo.stageId;
84+
for (let item of subTitleInfos) {
85+
var detailBody = { "groupId": item.matGrpId, "stageId": stageId, "subTitleId": item.subTitleId, "batchId": item.batchId, "skuId": "", "taskId": item.taskId }
86+
var goldCreatorDetail = await doGet("https://api.m.jd.com/client.action?functionId=goldCreatorDetail&body=" + encodeURIComponent(detailBody) + "&appid=content_ecology&clientVersion=10.0.0&client=wh5")
87+
if (goldCreatorDetail.isSuccess == true) {
88+
var sku = goldCreatorDetail.result.skuList[0];
89+
var taskbody = { "stageId": stageId, "subTitleId": item.subTitleId, "skuId": sku.skuId, "taskId": item.taskId, "itemId": "3", "rankId": sku.rankId, "type": 1, "batchId": item.batchId }
90+
var goldCreatorDoTask = await doGet("https://api.m.jd.com/client.action?functionId=goldCreatorDoTask&body=" + encodeURIComponent(taskbody) + "&appid=content_ecology&clientVersion=10.0.0&client=wh5");
91+
if (goldCreatorDoTask.isSuccess == true) {
92+
console.log(goldCreatorDoTask.msg + "\n");
93+
console.log('result:' + goldCreatorDoTask.result);
94+
message += item.shortTitle + "---" + sku.name + "---" + goldCreatorDoTask.result + "\n"
95+
}
96+
else {
97+
console.log('获取goldCreatorDoTask失败');
98+
}
99+
}
100+
}
101+
} else {
102+
console.log('获取goldCreatorTab失败');
103+
}
104+
await showMsg()
105+
} catch (e) {
106+
$.logErr(e)
107+
}
108+
}
109+
110+
function doGet(url) {
111+
return new Promise(async resolve => {
112+
$.get({
113+
url: url,
114+
headers: {
115+
"Accept": "application/json,text/plain, */*",
116+
"Content-Type": "application/x-www-form-urlencoded",
117+
"Accept-Encoding": "gzip, deflate, br",
118+
"Accept-Language": "zh-cn",
119+
"Connection": "keep-alive",
120+
"Cookie": cookie,
121+
"User-Agent": "jdapp;iPhone;10.0.0;14.4.2;91eaf40b15b21cbc604261ac99c6c7d46e6dcd1c;network/wifi;model/iPhone9,1;addressid/3991000806;appBuild/167671;jdSupportDarkMode/0;Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1",
122+
"Host": "api.m.jd.com",
123+
"Referer": "https://h5.m.jd.com/babelDiy/Zeus/2H5Ng86mUJLXToEo57qWkJkjFPxw/index.html?fromName=main_channel&lng=114.546270&lat=36.547645&sid=db0bfa4a5e643d65b5ed5031f0e1f87w&un_area=5_148_34050_55978"
124+
}
125+
}, (err, resp, data) => {
126+
try {
127+
if (err) {
128+
console.log(`${url}——${JSON.stringify(err)}`);
129+
console.log(`${$.name} API请求失败,请检查网路重试`);
130+
} else {
131+
data = JSON.parse(data);
132+
}
133+
} catch (e) {
134+
$.logErr(e, resp)
135+
} finally {
136+
resolve(data);
137+
}
138+
})
139+
})
140+
141+
}
142+
143+
function doPost(url, headers, body) {
144+
return new Promise(async resolve => {
145+
//console.log(body);
146+
$.post({
147+
url: url,
148+
Body: body,
149+
headers: headers
150+
}, (err, resp, data) => {
151+
try {
152+
if (err) {
153+
console.log(`${url}——${JSON.stringify(err)}`);
154+
console.log(`${$.name} API请求失败,请检查网路重试`);
155+
} else {
156+
data = JSON.parse(data);
157+
}
158+
} catch (e) {
159+
$.logErr(e, resp)
160+
} finally {
161+
resolve(data);
162+
}
163+
})
164+
})
165+
}
166+
function safeGet(data) {
167+
try {
168+
if (typeof JSON.parse(data) == "object") {
169+
return true;
170+
}
171+
} catch (e) {
172+
console.log(e);
173+
console.log(`京东服务器访问数据为空,请检查自身设备网络情况`);
174+
return false;
175+
}
176+
}
177+
function jsonParse(str) {
178+
if (typeof str == "string") {
179+
try {
180+
return JSON.parse(str);
181+
} catch (e) {
182+
console.log(e);
183+
$.msg($.name, '', '请勿随意在BoxJs输入框修改内容\n建议通过脚本去获取cookie')
184+
return [];
185+
}
186+
}
187+
}
188+
function TotalBean() {
189+
return new Promise(async resolve => {
190+
const options = {
191+
"url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
192+
"headers": {
193+
"Accept": "application/json,text/plain, */*",
194+
"Content-Type": "application/x-www-form-urlencoded",
195+
"Accept-Encoding": "gzip, deflate, br",
196+
"Accept-Language": "zh-cn",
197+
"Connection": "keep-alive",
198+
"Cookie": cookie,
199+
"Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
200+
"User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.2.2;14.2;%E4%BA%AC%E4%B8%9C/9.2.2 CFNetwork/1206 Darwin/20.1.0")
201+
}
202+
}
203+
$.post(options, (err, resp, data) => {
204+
try {
205+
if (err) {
206+
console.log(`${JSON.stringify(err)}`)
207+
console.log(`${$.name} API请求失败,请检查网路重试`)
208+
} else {
209+
if (data) {
210+
data = JSON.parse(data);
211+
if (data['retcode'] === 13) {
212+
$.isLogin = false; //cookie过期
213+
return
214+
}
215+
$.nickName = data['base'].nickname;
216+
} else {
217+
console.log(`京东服务器返回空数据`)
218+
}
219+
}
220+
} catch (e) {
221+
$.logErr(e, resp)
222+
} finally {
223+
resolve();
224+
}
225+
})
226+
})
227+
}
228+
function showMsg() {
229+
return new Promise(resolve => {
230+
$.msg($.name, '', `京东账号${$.index}${$.nickName}\n${message}`);
231+
resolve()
232+
})
233+
}
234+
235+
// prettier-ignore
236+
function Env(t, e) { "undefined" != typeof process && JSON.stringify(process.env).indexOf("GITHUB") > -1 && process.exit(0); class s { constructor(t) { this.env = t } send(t, e = "GET") { t = "string" == typeof t ? { url: t } : t; let s = this.get; return "POST" === e && (s = this.post), new Promise((e, i) => { s.call(this, t, (t, s, r) => { t ? i(t) : e(s) }) }) } get(t) { return this.send.call(this.env, t) } post(t) { return this.send.call(this.env, t, "POST") } } return new class { constructor(t, e) { this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `🔔${this.name}, 开始!`) } isNode() { return "undefined" != typeof module && !!module.exports } isQuanX() { return "undefined" != typeof $task } isSurge() { return "undefined" != typeof $httpClient && "undefined" == typeof $loon } isLoon() { return "undefined" != typeof $loon } toObj(t, e = null) { try { return JSON.parse(t) } catch { return e } } toStr(t, e = null) { try { return JSON.stringify(t) } catch { return e } } getjson(t, e) { let s = e; const i = this.getdata(t); if (i) try { s = JSON.parse(this.getdata(t)) } catch { } return s } setjson(t, e) { try { return this.setdata(JSON.stringify(t), e) } catch { return !1 } } getScript(t) { return new Promise(e => { this.get({ url: t }, (t, s, i) => e(i)) }) } runScript(t, e) { return new Promise(s => { let i = this.getdata("@chavy_boxjs_userCfgs.httpapi"); i = i ? i.replace(/\n/g, "").trim() : i; let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout"); r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r; const [o, h] = i.split("@"), n = { url: `http://${h}/v1/scripting/evaluate`, body: { script_text: t, mock_type: "cron", timeout: r }, headers: { "X-Key": o, Accept: "*/*" } }; this.post(n, (t, e, i) => s(i)) }).catch(t => this.logErr(t)) } loaddata() { if (!this.isNode()) return {}; { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e); if (!s && !i) return {}; { const i = s ? t : e; try { return JSON.parse(this.fs.readFileSync(i)) } catch (t) { return {} } } } } writedata() { if (this.isNode()) { this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path"); const t = this.path.resolve(this.dataFile), e = this.path.resolve(process.cwd(), this.dataFile), s = this.fs.existsSync(t), i = !s && this.fs.existsSync(e), r = JSON.stringify(this.data); s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r) } } lodash_get(t, e, s) { const i = e.replace(/\[(\d+)\]/g, ".$1").split("."); let r = t; for (const t of i) if (r = Object(r)[t], void 0 === r) return s; return r } lodash_set(t, e, s) { return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t) } getdata(t) { let e = this.getval(t); if (/^@/.test(t)) { const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : ""; if (r) try { const t = JSON.parse(r); e = t ? this.lodash_get(t, i, "") : e } catch (t) { e = "" } } return e } setdata(t, e) { let s = !1; if (/^@/.test(e)) { const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}"; try { const e = JSON.parse(h); this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i) } catch (e) { const o = {}; this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i) } } else s = this.setval(t, e); return s } getval(t) { return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null } setval(t, e) { return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null } initGotEnv(t) { this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar)) } get(t, e = (() => { })) { t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.get(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => { try { if (t.headers["set-cookie"]) { const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString(); s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar } } catch (t) { this.logErr(t) } }).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) })) } post(t, e = (() => { })) { if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, { "X-Surge-Skip-Scripting": !1 })), $httpClient.post(t, (t, s, i) => { !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i) }); else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, { hints: !1 })), $task.fetch(t).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => e(t)); else if (this.isNode()) { this.initGotEnv(t); const { url: s, ...i } = t; this.got.post(s, i).then(t => { const { statusCode: s, statusCode: i, headers: r, body: o } = t; e(null, { status: s, statusCode: i, headers: r, body: o }, o) }, t => { const { message: s, response: i } = t; e(s, i, i && i.body) }) } } time(t, e = null) { const s = e ? new Date(e) : new Date; let i = { "M+": s.getMonth() + 1, "d+": s.getDate(), "H+": s.getHours(), "m+": s.getMinutes(), "s+": s.getSeconds(), "q+": Math.floor((s.getMonth() + 3) / 3), S: s.getMilliseconds() }; /(y+)/.test(t) && (t = t.replace(RegExp.$1, (s.getFullYear() + "").substr(4 - RegExp.$1.length))); for (let e in i) new RegExp("(" + e + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? i[e] : ("00" + i[e]).substr(("" + i[e]).length))); return t } msg(e = t, s = "", i = "", r) { const o = t => { if (!t) return t; if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? { "open-url": t } : this.isSurge() ? { url: t } : void 0; if ("object" == typeof t) { if (this.isLoon()) { let e = t.openUrl || t.url || t["open-url"], s = t.mediaUrl || t["media-url"]; return { openUrl: e, mediaUrl: s } } if (this.isQuanX()) { let e = t["open-url"] || t.url || t.openUrl, s = t["media-url"] || t.mediaUrl; return { "open-url": e, "media-url": s } } if (this.isSurge()) { let e = t.url || t.openUrl || t["open-url"]; return { url: e } } } }; if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) { let t = ["", "==============📣系统通知📣=============="]; t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t) } } log(...t) { t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator)) } logErr(t, e) { const s = !this.isSurge() && !this.isQuanX() && !this.isLoon(); s ? this.log("", `❗️${this.name}, 错误!`, t.stack) : this.log("", `❗️${this.name}, 错误!`, t) } wait(t) { return new Promise(e => setTimeout(e, t)) } done(t = {}) { const e = (new Date).getTime(), s = (e - this.startTime) / 1e3; this.log("", `🔔${this.name}, 结束! 🕛 ${s} 秒`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t) } }(t, e) }

0 commit comments

Comments
 (0)