131 lines
4.9 KiB
JavaScript
131 lines
4.9 KiB
JavaScript
const axios = require('axios');
|
|
const qs = require('qs');
|
|
const { stringify } = require('querystring');
|
|
const headers = {
|
|
'Host': 'huodong3.3839.com',
|
|
'Accept': 'application/json, text/javascript, */*; q=0.01',
|
|
'X-Requested-With': 'XMLHttpRequest',
|
|
'User-Agent': 'Mozilla/5.0 (Linux; Android 13; RMX3562 Build/TP1A.220905.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/103.0.5060.129 Mobile Safari/537.36Androidkb/1.5.6.903(android;RMX3562;13;1080x2316;4G);@4399_sykb_android_activity@',
|
|
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
|
'Origin': 'https://huodong3.3839.com',
|
|
'Sec-Fetch-Site': 'same-origin',
|
|
'Sec-Fetch-Mode': 'cors',
|
|
'Sec-Fetch-Dest': 'empty',
|
|
'Referer': 'https://huodong3.3839.com/n/hykb/grow/daily.php',
|
|
'Accept-Encoding': 'gzip, deflate',
|
|
'Accept-Language': 'zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7',
|
|
'Cookie': 'UM_distinctid=188f5301bb07e-0b3fe772707e02-12155723-61ed0-188f5301bb16c; Hm_lvt_f1fb60d2559a83c8fa1ee6125a352bd7=1690692437; Hm_lpvt_f1fb60d2559a83c8fa1ee6125a352bd7=1691470971'
|
|
};
|
|
const api = 'https://huodong3.3839.com/n/hykb/grow/ajax.php';
|
|
const daily_list_api = 'https://huodong3.3839.com/n/hykb/grow/daily.php';
|
|
|
|
const share_callback_action = 'DailyShareCallb';
|
|
const share_daily_action = 'DailyShare';
|
|
// bbs.forEach((id,index) => {
|
|
// console.log("sign to bbsId => " + id);
|
|
// let data = qs.stringify({
|
|
// 'gameId': id
|
|
// });
|
|
// config['data'] = data;
|
|
|
|
// axios.request(config)
|
|
// .then((response) => {
|
|
// console.log(JSON.stringify(response.data));
|
|
// })
|
|
// .catch((error) => {
|
|
// console.log(error);
|
|
// });
|
|
// });
|
|
|
|
/**
|
|
* random
|
|
* @returns
|
|
*/
|
|
function generateRandom() {
|
|
const randomNum = Math.random();
|
|
return randomNum.toFixed(17);
|
|
}
|
|
|
|
/**
|
|
* 获取数据
|
|
* @param {*} action DailyShareCallb-分享回调
|
|
* @param {*} id
|
|
*/
|
|
function getApiData(action, id) {
|
|
let data = qs.stringify({
|
|
'ac': action,
|
|
'id': id,
|
|
'mode': 'weixin',
|
|
'r': generateRandom(),
|
|
'scookie': '5|0|38524686|cmFpbmVyb3Npb24=|kb2318B047E13AB3BAC4C9E36B388B6260|7vcwpJVjplVWoJIUpl6xITZO7j9c7lIn7v7OGv6Aov6=%1|2f18a0f2283ce7f6804281632ccdef22',
|
|
'device': 'kb2318B047E13AB3BAC4C9E36B388B6260'
|
|
});
|
|
let config = {
|
|
method: 'post',
|
|
maxBodyLength: Infinity,
|
|
url: api,
|
|
headers: headers,
|
|
data: data
|
|
};
|
|
let json_data = null;
|
|
axios.request(config)
|
|
.then((response) => {
|
|
// console.log(JSON.stringify(response.data));
|
|
let json_data = JSON.stringify(response.data);
|
|
if (action === share_callback_action && json_data && json_data['key'] === "501") {
|
|
config['data']['ac'] = share_daily_action;
|
|
axios.request(config)
|
|
.then((res) => {
|
|
let daily_json = JSON.stringify(res.data);
|
|
if (daily_json && daily_json['key'] === "503") {
|
|
let csd = daily_json['reward_csd_num'];
|
|
let today_csd = daily_json['day_rw_csd'];
|
|
console.log("分享获得成熟度 " + csd + " 今日总共获取成熟度 " + today_csd);
|
|
} else {
|
|
console.log(JSON.stringify(data));
|
|
console.log("执行领取任务失败,原始数据 => " + JSON.stringify(res.data) + " id => " + id);
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
console.log(err);
|
|
});
|
|
} else {
|
|
console.log(JSON.stringify(data));
|
|
console.log("执行分享任务失败,原始数据 => " + JSON.stringify(response.data) + " id => " + id);
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
console.log(error);
|
|
});
|
|
return json_data;
|
|
}
|
|
function sleep(ms) {
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
}
|
|
|
|
async function main() {
|
|
let config = {
|
|
method: 'get',
|
|
url: daily_list_api,
|
|
headers: headers,
|
|
};
|
|
let id_list = [];
|
|
let response = await axios.request(config);
|
|
let html = response.data;
|
|
// console.log(html);
|
|
//DailyGameLing、DailyAppLing、DailyGameCateLing、DailyDati、DailyFriendLing、DailyJiaoHu
|
|
const regexPattern = /DailyShare\((\d+)\)/g;
|
|
let matches = [...html.matchAll(regexPattern)]; // 进行全局匹配
|
|
if (matches.length > 0) {
|
|
let values = matches.map(match => match[1]); // 获取所有匹配的数值部分
|
|
console.log('Found values:', values); // 输出所有匹配到的数值
|
|
for (const id of values) {
|
|
console.log("执行分享任务 id => " + id);
|
|
getApiData(share_callback_action, id);
|
|
await sleep(15000);
|
|
}
|
|
} else {
|
|
console.log('Values not found.');
|
|
}
|
|
}
|
|
main(); |