This commit is contained in:
Faker 2022-11-14 20:15:54 +08:00
parent 7d269f4fc4
commit 19d5605cff
3 changed files with 43 additions and 41 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,9 @@
/* /*
入口https://prodev.m.jd.com/mall/active/4JVvmjx2XwTx7cB64eAFPds1xCox/index.html 入口https://prodev.m.jd.com/mall/active/4JVvmjx2XwTx7cB64eAFPds1xCox/index.html
22 0-23/3 * * * jd_subject.js 点赞5次抽奖1-5完成后瓜分都池
定时随机
updatetime:2022/11/14
*/ */
const $ = new Env('短视频点赞抽奖'); const $ = new Env('短视频点赞抽奖');
@ -19,19 +21,20 @@ if ($.isNode()) {
} else { } else {
cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item); cookiesArr = [$.getdata('CookieJD'), $.getdata('CookieJD2'), ...jsonParse($.getdata('CookiesJD') || "[]").map(item => item.cookie)].filter(item => !!item);
} }
let fff = Math.random()+1;
!(async () => { !(async () => {
if (!cookiesArr[0]) { if (!cookiesArr[0]) {
$.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" }); $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', { "open-url": "https://bean.m.jd.com/bean/signIndex.action" });
return; return;
} }
for (let i = 0; i < 20; i++) { for (let i = 0; i < 15; i++) {
if (cookiesArr[i]) { if (cookiesArr[i]) {
cookie = cookiesArr[i]; cookie = cookiesArr[i];
$.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1])
$.index = i + 1; $.index = i + 1;
$.isLogin = true; $.isLogin = true;
$.nickName = ''; $.nickName = '';
UA = require('./USER_AGENTS').UARAM(); UA = require('./USER_AGENTS').UARAM();
await TotalBean(); await TotalBean();
console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`); console.log(`\n******开始【京东账号${$.index}${$.nickName || $.UserName}*********\n`);
if (!$.isLogin) { if (!$.isLogin) {
@ -41,29 +44,29 @@ if ($.isNode()) {
} }
continue continue
} }
$.hotflag = false; $.hotnum = 0;
for (let i = 0;i < 2;i++) { for (let i = 0; i < 2; i++) {
if ($.hotflag) break; if ($.hotnum > 1) fff = Math.random()+1;
let x ='recommend'; let x = 'recommend';
(i == 1) ? x = 'joined':''; let y = 0;
(i == 1) ? (x = 'joined', y = 1) : '';
await homepage(x); await homepage(x);
await $.wait(1000); await $.wait(1000);
if ($.listData == null) continue;
for (let item of $.listData) { for (let item of $.listData) {
if ($.hotflag) break; if ($.hotnum > 0) fff = Math.random()+1;
console.log(item.subjectTitle); if ($.hotnum > 1) break;
$.fullflag = false; if (item.remainGradNum == 0) continue;
for (let y = 0 ;y < 1; y++) { console.log('\n开始主题'+item.subjectTitle);
await channelBff_querySubject(y+1,item.subjectId); UA = require('./USER_AGENTS').UARAM();
await $.wait(1000); await channelBff_querySubject(y + 1, item.subjectId);
for (let j of $.contentList) { await $.wait(1000);
if ($.fullflag) break; for (let j of $.contentList) {
if ($.hotflag) break; if ($.hotnum > 0) fff = Math.random()+1;
//console.log(j.contentId, item.subjectId); if ($.hotnum > 1) break;
//await subject_interactive_get(j.contentId, item.subjectId); //console.log(j.contentId, item.subjectId);
//await $.wait(1000); await subject_interactive_done(j.contentId, item.subjectId);
await subject_interactive_done(j.contentId, item.subjectId); await $.wait(parseInt(Math.random() * 3000 + 3000, 10))
await $.wait(parseInt(Math.random() * 2000 + 3000, 10))
}
} }
await $.wait(1000); await $.wait(1000);
} }
@ -81,7 +84,7 @@ if ($.isNode()) {
async function channelBff_querySubject(page,id) { async function channelBff_querySubject(page, id) {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
$.post(taskUrl('channelBff_querySubject', { "page": page, "pageSize": "15", "scene": "", "subjectId": id, "tabId": "-1", "tabType": "2", "topContentId": "", "topContents": "" }), async (err, resp, data) => { $.post(taskUrl('channelBff_querySubject', { "page": page, "pageSize": "15", "scene": "", "subjectId": id, "tabId": "-1", "tabType": "2", "topContentId": "", "topContents": "" }), async (err, resp, data) => {
try { try {
@ -117,7 +120,7 @@ async function subject_interactive_get(cid, sid) {
data = JSON.parse(data) data = JSON.parse(data)
console.log(data); console.log(data);
if (data.busiCode == '0') { if (data.busiCode == '0') {
} else { } else {
console.log(data.message) console.log(data.message)
} }
@ -133,7 +136,7 @@ async function subject_interactive_get(cid, sid) {
async function subject_interactive_done(cid, sid) { async function subject_interactive_done(cid, sid) {
return new Promise(async (resolve) => { return new Promise(async (resolve) => {
$.post(taskUrl('subject_interactive_done', `{"contentId": "${cid}","subjectId":"${sid}"}`), async (err, resp, data) => { $.post(taskUrl('subject_interactive_done', `{"contentId":"${cid}","subjectId":"${sid}"}`), async (err, resp, data) => {
try { try {
if (err) { if (err) {
console.log(`${JSON.stringify(err)}`) console.log(`${JSON.stringify(err)}`)
@ -142,18 +145,17 @@ async function subject_interactive_done(cid, sid) {
data = JSON.parse(data) data = JSON.parse(data)
//console.log(data); //console.log(data);
if (data.busiCode == '0') { if (data.busiCode == '0') {
//(data.data.assignmentInfo.completionCnt % 5 == 0 ) && await $.wait(10000);
(data.data.assignmentInfo.completionCnt == 5) && ($.fullflag = true);
if (data.data.rewardsInfo) { if (data.data.rewardsInfo) {
console.log('获得:' + data.data.rewardsInfo.rewardMsg) console.log('获得:' + data.data.rewardsInfo.rewardMsg)
$.rewardflag = true;
} else { } else {
console.log(data.message) console.log(data.message)
} }
} else if (data.message.indexOf('火爆') > -1){ $.hotnum = 0;
console.log('火爆了,跳出'); } else if (data.message.indexOf('火爆') > -1) {
$.hotflag = true; console.log('火爆了,跳出');
} else { await $.wait(10000);
$.hotnum++;
} else {
console.log(data.message) console.log(data.message)
} }
} }
@ -203,16 +205,16 @@ async function homepage(type) {
} }
function taskUrl(fn, body) { function taskUrl(fn, body) {
body = dylan.getbody(fn, body); body = dylan.getbody(fn, body, fff);
//if (fn == 'subject_interactive_done') body = body+'&joylog=DCE647899FAC6434216F0BEEF18DCAA5*1668326919930%7E2cmqrqro0Dm01ecmEh012.VFVbfVtUWll9WVdWXTsWBE8XaUJJUxNzFhtRKwdRUlJbARY*tbzuX82hwbvbPQwYFhbRjw.e81b17fe%7Ew%2C0%7E7A5F66B9794D40FFCEA90B9BF5586D97%7E%7E21%7ENjc0NTc0NTkhBlmmhwtaA1AB848GBBsGGgX2ggQ3KCkl%7E0pfo0n5' //console.log(body)
return { return {
url: `https://api.m.jd.com/client.action?functionId=${fn}&${body}`, url: `https://api.m.jd.com/client.action?functionId=${fn}&${body}`,
//body,
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/json',
'User-Agent': UA, 'User-Agent': UA,
'Cookie': cookie 'Cookie': cookie
} },
timeout: 10000
} }
} }