commit ba665285120c472eb642f27d38cb8fbc98f91d25 Author: luming Date: Tue Aug 8 17:42:56 2023 +0800 first commit diff --git a/daliy.js b/daliy.js new file mode 100644 index 0000000..9bcbb9b --- /dev/null +++ b/daliy.js @@ -0,0 +1,131 @@ +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(); \ No newline at end of file diff --git a/day.html b/day.html new file mode 100644 index 0000000..652f000 --- /dev/null +++ b/day.html @@ -0,0 +1,344 @@ + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..76182af --- /dev/null +++ b/package-lock.json @@ -0,0 +1,133 @@ +{ + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, + "axios": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.4.0.tgz", + "integrity": "sha512-S4XCWMEmzvo64T9GfvQDOXgYRDJ/wsSZc7Jvdgx5u1sd0JwsuPLqb3SYmusag+edF6ziyMensPVqLTSc1PiSEA==", + "requires": { + "follow-redirects": "^1.15.0", + "form-data": "^4.0.0", + "proxy-from-env": "^1.1.0" + } + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==" + }, + "follow-redirects": { + "version": "1.15.2", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", + "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==" + }, + "form-data": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", + "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==", + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "mime-types": "^2.1.12" + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "get-intrinsic": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-proto": "^1.0.1", + "has-symbols": "^1.0.3" + } + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", + "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==" + }, + "has-symbols": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", + "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==" + }, + "mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==" + }, + "mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "requires": { + "mime-db": "1.52.0" + } + }, + "object-inspect": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", + "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==" + }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" + }, + "qs": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "requires": { + "side-channel": "^1.0.4" + } + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + } + } +}