1.购买服务器阿里云:服务器购买地址https://t.aliyun.com/U/W9mv4W若失效,可用地址
阿里云:
服务器购买地址
https://t.aliyun.com/U/W9mv4W若失效,可用地址
https://www.aliyun.com/minisite/goods?source=5176.29345612&userCode=49hts92d腾讯云:
https://curl.qcloud.com/wJpWmSfU若失效,可用地址
https://cloud.tencent.com/act/cps/redirect?redirect=2446&cps_key=ad201ee2ef3b771157f72ee5464b1fea&from=console华为云
https://activity.huaweicloud.com/cps.html?fromacct=64b5cf7cc11b4840bb4ed2ea0b2f4468&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=2019052.部署教程
3.代码如下
(function () {"use strict";if (typeof unsafeWindow === "undefined") {if (typeof globalThis.unsafeWindow !== "undefined" &&globalThis.unsafeWindow != null) {var unsafeWindow = globalThis.unsafeWindow;} else {var unsafeWindow = globalThis || window || self;}}const utils = Utils.noConflict();let config = {score: 1566 /* 分数 */,scoreMax: 1600 /* 设置随机分数-最高 */,scoreMin: 1400 /* 设置随机分数-最低 */,credit: 20 /* 金币 */,delaytime: 6000 /* 延时时间 */,delaytimeMax: 6000,delaytimeMin: 4000,runCount: 5 /* 执行次数 */,shareCount: 5 /* 分享执行次数 */,loadingMsg: null,};/*** 游戏开始* @param play_key* @param score 分数* @param credit 赚的金币数* @returns*/function gameEnd(play_key) {if (play_key == null) {console.error("play_key不能为空");Qmsg.error("play_key不能为空");return;}let eggkidInfo = window.localStorage.getItem("EggKid_INFO");if (!eggkidInfo) {console.error("获取蛋仔本地信息失败");Qmsg.error("获取蛋仔本地信息失败");return;}eggkidInfo = JSON.parse(eggkidInfo);let login_id = eggkidInfo["login_id"];let login_token = eggkidInfo["login_token"];GM_xmlhttpRequest({url: `https://u5game.webapp.163.com/game_end?play_key=${play_key}&score=${config.score}&credit=${config.credit}&login_id=${login_id}&login_token=${login_token}&callback=game_end`,method: "get",async: false,timeout: 5000,responseType: "json",onload: function (response) {let result = response.responseText.replace("game_end(", "").replace(/\)$/gi, "");console.log(result);},onerror: function (response) {console.error("请求失败", response);Qmsg.error("请求失败");},ontimeout: function () {console.error("请求超时");Qmsg.error("请求超时");},});}/*** 游戏开始* @returns play_key*/function gameStart() {return new Promise((resolve) => {let eggkidInfo = window.localStorage.getItem("EggKid_INFO");if (!eggkidInfo) {console.error("获取蛋仔本地信息失败");Qmsg.error("获取蛋仔本地信息失败");resolve(false);return;}eggkidInfo = JSON.parse(eggkidInfo);let login_id = eggkidInfo["login_id"];let login_token = eggkidInfo["login_token"];GM_xmlhttpRequest({url: `https://u5game.webapp.163.com/game_start?login_id=${login_id}&login_token=${login_token}&callback=game_start`,method: "get",async: false,timeout: 5000,responseType: "json",onload: function (response) {let result = response.responseText.replace("game_start(", "").replace(/\)$/gi, "");result = eval(`(${result})`);console.log(result);let play_key = result["play_key"];Qmsg.success(`play_key ===> ${play_key}`);resolve(play_key);},onerror: function (response) {console.error("请求失败", response);Qmsg.error("请求失败");resolve(false);},ontimeout: function () {console.error("请求超时");Qmsg.error("请求超时");resolve(false);},});});}/*** 游戏分享,用于获取游戏次数*/function gameShare() {return new Promise((resolve) => {let eggkidInfo = window.localStorage.getItem("EggKid_INFO");if (!eggkidInfo) {console.error("获取蛋仔本地信息失败");Qmsg.error("获取蛋仔本地信息失败");resolve(false);return;}eggkidInfo = JSON.parse(eggkidInfo);let login_id = eggkidInfo["login_id"];let login_token = eggkidInfo["login_token"];GM_xmlhttpRequest({url: `https://u5game.webapp.163.com/sharing?login_id=${login_id}&login_token=${login_token}&callback=sharing`,method: "get",async: false,timeout: 5000,onload: function (response) {let result = response.responseText.replace(/^sharing\(/gi, "").replace(/\)$/gi, "");result = eval(`(${result})`);console.log(result);let success = result["success"];if (success) {Qmsg.success(`成功分享`);} else {if (result.hasOwnProperty("msg")) {Qmsg.error(result["msg"]);} else {Qmsg.error(`分享失败`);}}resolve(success);},onerror: function (response) {console.error("请求失败", response);Qmsg.error("请求失败");resolve(false);},ontimeout: function () {console.error("请求超时");Qmsg.error("请求超时");resolve(false);},});});}/*** 获取弹出内容* @param {number} runCount* @returns*/function getQmsgLoadingText(runCount = 1) {return `<div style="text-align: left;"><div style="margin-bottom: 4px;">当前运行: <i style="color: red">${runCount}次</i></div><div style="margin-bottom: 4px;">延时时间: <i style="color: red">${config.delaytime / 1000}秒</i></div><div style="margin-bottom: 4px;">每局分数: <i style="color: red">${config.score}</i></div><div style="margin-bottom: 4px;">每局金币: <i style="color: red">${config.credit}个</div><div><i style="color: green">执行中...</div></div>`;}/*** 设置随机值*/function setRandValue() {config.delaytime = utils.getRandomValue(config.delaytimeMin,config.delaytimeMax);config.score = utils.getRandomValue(config.scoreMin, config.scoreMax);}async function auto() {config.loadingMsg = Qmsg.loading(getQmsgLoadingText(1), {html: true,autoClose: false,});for (let i = 0; i < config.runCount; i++) {console.log(`第 ${i + 1} 次执行`);Qmsg.success(`第 ${i + 1} 次执行`);try {setRandValue();config.loadingMsg.setHTML(getQmsgLoadingText(i + 1));let play_key = await gameStart();gameEnd(play_key);await utils.sleep(config.delaytime);} catch (error) {Qmsg.error("执行失败 " + error);}}Qmsg.success("执行完毕");config.loadingMsg?.close();console.log("执行结束");}new utils.GM_Menu({run: {text: "启动",enable: false,showText: (_text_, _enable_) => {return "⚙ " + _text_;},callback: () => {let inputRunCount = prompt("请输入需要执行的次数", 5);config.runCount = isNaN(inputRunCount)? config.runCount: parseInt(inputRunCount);let inputDelaytime = prompt("请输入每次执行后延时的时间区间,单位(秒)","40-60");inputDelaytime = inputDelaytime.split("-");config.delaytimeMin = parseInt(inputDelaytime[0]) * 1000;config.delaytimeMax = parseInt(inputDelaytime[1]) * 1000;let inputScore = prompt("请输入需要获得的分数区间",`${config.scoreMin}-${config.scoreMax}`);inputScore = inputScore.split("-");config.scoreMin = parseInt(inputScore[0]);config.scoreMax = parseInt(inputScore[1]);setRandValue();let inputCredit = prompt("请输入每局获取的金币数量", 20);config.credit = isNaN(inputCredit)? config.credit: parseInt(inputCredit);Qmsg.success("开始执行");auto();},},share: {text: "一键分享",enable: false,showText: (_text_, _enable_) => {return "⚙ " + _text_;},callback: async () => {config.shareCount = parseInt(prompt("请输入需要分享的次数", 5));for (let i = 0; i < config.shareCount; i++) {Qmsg.info(`第 ${i + 1} 次分享`);await gameShare();await utils.sleep(500);}Qmsg.success("执行完毕");},},},false,GM_getValue,GM_setValue,GM_registerMenuCommand,GM_unregisterMenuCommand);Qmsg.config({position: "bottom",timeout: 3000,showReverse: true,});})();
解析
该脚本为蛋仔乐任务脚本,脚本主要作用
在页面
https://party.163.com/h5/20250816/xxl/player/*上,通过菜单一键执行:自动开始并结束一局游戏,向后端上报自定义分数与金币(可设置区间随机),从而完成"赚金币"相关任务;
批量分享以获取额外游戏次数;
提供可视化提示(Qmsg)与随机化参数(分数、延时),并可多次循环执行。
说明:脚本从
localStorage读取EggKid_INFO(含login_id/login_token),再调用官方接口game_start/game_end/sharing完成上报与分享。
主要方法
config | score/scoreMin/scoreMax(分数与随机范围)、credit(金币)、delaytime 与范围、runCount(执行局数)、shareCount(分享次数)等。 |
gameStart() | https://u5game.webapp.163.com/game_start?...&callback=game_start(JSONP),从响应取 play_key,作为一局开始标识。 |
gameEnd(play_key) | .../game_end?play_key=...&score=...&credit=...&login_id=...&login_token=...(JSONP),上报一局的分数与金币。 |
gameShare() | .../sharing?login_id=...&login_token=... 完成一次分享,通常用于获取额外次数。 |
setRandValue() | |
getQmsgLoadingText(runCount) | |
auto() | runCount 次数 → gameStart() → gameEnd() → sleep(delaytime);期间实时更新弹窗与错误提示。 |
new utils.GM_Menu({...}) | 菜单run:交互式设置执行次数 / 延时范围 / 分数范围 / 金币后启动 auto(); - share:输入分享次数,循环调用 gameShare();均带 Qmsg 反馈。 |
QmsgUtils(sleep、getRandomValue)、GM_xmlhttpRequest(跨域请求)、localStorage.EggKid_INFO(登录态)。 |
执行流程
用户在菜单点击"启动",输入执行参数;
每局:
gameStart()拿play_key→gameEnd(play_key)上报随机分数/金币 → 等待随机延时;若执行分享:循环调用
gameShare();全程通过 Qmsg 弹窗显示进度与结果。
小提示:脚本依赖
localStorage的EggKid_INFO(login_id与login_token)可用;若接口或校验策略更新,game_start/game_end/sharing的入参或 JSONP 包装可能需要同步调整。
注意:
本文部分变量已做脱敏处理,仅用于测试和学习研究,禁止用于商业用途,不能保证其合法性,准确性,完整性和有效性,请根据情况自行判断。技术层面需要提供帮助,可以通过打赏的方式进行探讨。
没有评论:
发表评论