From 0a492861afe1041ad36d6a920342b153aff48697 Mon Sep 17 00:00:00 2001 From: Wenmoux Date: Sat, 2 Mar 2024 05:16:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8B=E6=8B=89=E6=BC=AB=E6=92=AD=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=20=E6=9B=B4=E5=A4=9A=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + scripts/kilamanbo.js | 51 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 15d244e8..39c835b2 100644 --- a/README.md +++ b/README.md @@ -140,6 +140,7 @@ ql repo https://github.com/Wenmoux/checkbox.git "checkbox|install" "old" "module
更新日志 +- 2024-03-02 克拉漫播增加更多任务 - 2024-02-15 - 新增[pdg2pdf](https://www.pdg2pdf.com/)每日签到 - 新增[高清mp4](https://mp4fan.org/)每日登录 diff --git a/scripts/kilamanbo.js b/scripts/kilamanbo.js index c885ed84..538579f2 100644 --- a/scripts/kilamanbo.js +++ b/scripts/kilamanbo.js @@ -3,15 +3,16 @@ const md5 = require("crypto-js").MD5; const BASE_URL = 'https://api.kilamanbo.com/api'; let klmsg = "【克拉漫播】:\n" const headers = { - 'Content-Type': 'application/x-www-form-urlencoded', ua: config.kilamanbo.ua, "_c": 20, "x-auth-token": config.kilamanbo.authtoken }; - -const makeRequest = async (method, endpoint, data = '') => { +let sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); +const makeRequest = async (method, endpoint, data = '',json=null) => { const url = `${BASE_URL}${endpoint}`; try { + if(json) headers["Content-Type"] = "application/json" + else headers["Content-Type"] = 'application/x-www-form-urlencoded' const response = await axios({ method: method, url: url, @@ -40,19 +41,44 @@ const checkIn = async () => { } }; +const ft = async () => { + const endpoint = '/v433/imgtxt/new/add'; + let msg = await axios.get("https://v1.hitokoto.cn/"); + const data = {"groupActivityId":0,"imgList":[],"introduce":msg.data.hitokoto,"source":1} + try { + const response = await makeRequest('post', endpoint, data,true); + const msg = response?.h?.msg; + console.log(msg); + if(response.b){ id = response.b.imgTxtResp.id + console.log(`发帖 ${id}`) + await sleep(3000) + let data = `dynamicId=${id}&type=38` + let signedData = `${data}&sign=${getSign(data)}`; + let rss =await makeRequest('post','/v435/dynamic/info/delete',signedData) + console.log(signedData) + console.log(rss) + } + // return msg; + } catch (error) { + const msg = error.response?.data?.h?.msg || error.message; + console.error(msg); + // return msg; + } +}; const getSign = (data) => { var str = data.split("&").sort().join("&"); return md5("nJi9o;/" + str).toString(); }; const cx = async () => { - const endpoint = '/v433/user/level/info?uid=3100350001213'; - const data = 'uid=3100350001213'; + const endpoint = '/v433/user/level/info?uid='; + const data = 'uid='; try { const response = await makeRequest('get', endpoint); const msg = response.b; console.log("获取个人信息成功") - klmsg +=` 昵称:${msg.nickname}\n 等级:Lv${msg.level}(${msg.levelInfo.thisExp}/${msg.levelInfo.nextExp})\n 签到:` + klmsg +=` 昵称:${msg.nickname}\n 等级:Lv${msg.level}(${msg.levelInfo.exp}/${msg.levelInfo.nextExp})\n 签到:` + // console.log(msg) } catch (error) { const msg = error.response?.data?.h?.msg || error.message; console.error("获取个人信息失败:" + msg); @@ -73,15 +99,26 @@ const getVideo = async () => { const response = await makeRequest('get', endpoint); return response.b.data; }; +const getExp = async (id) => { +console.log("去领宝箱:",id) +const data = `giftPackType=${id}` + const endpoint = `/v435/user/gift/pack/get?giftPackType=${id}&sign=${getSign(data)}`; + const response = await makeRequest('get', endpoint); + console.log(response?.h?.msg); +}; const task = async () => { - let checkinMsg = await checkIn(); + let checkinMsg = await checkIn(); let vList = await getVideo(); for (let i = 0; i < 5; i++) { console.log(`看视频:${vList[i].videoResp.introduce}`) await complete("21", vList[i].videoResp.idStr); await complete("4", vList[i].videoResp.idStr); } + for ( k of [1,2,3]){ +await ft() + } + for (c of [1,2,3]) await getExp(c) await cx() klmsg+=checkinMsg return klmsg