autojs----2025淘宝淘金币跳一跳自动化

有概率被淘宝检测脚本,导致奖励变少,本人一概不负责

更新记录

10.30 一次运行5分钟,防止检测有效

使用流程

1.下载autojs,创建文件把脚本代码复制

2.打开淘宝,进入淘金币领体力界面

3.进入搜索任务,替换代码中的挡风披冬季,为任意你的物品即可,随后返回领体力界面

3.返回autojs,启动脚本,打开淘宝,此时在领体力任务界面

代码

js 复制代码
"auto";

auto.waitFor();

var height = device.height;
var width = device.width;
setScreenMetrics(width, height);

toast("开始执行淘宝浏览类任务...");
app.launchApp("淘宝");
sleep(3000);

// ✅ 设置运行时间上限(毫秒)
var maxRunTime = 5 * 60 * 1000; // 5分钟
var startTime = new Date().getTime();

var maxTry = 1000;
var tryCount = 0;

while (tryCount < maxTry) {
    // 检查运行时间
    var now = new Date().getTime();
    if (now - startTime > maxRunTime) {
        toast("运行时间已到5分钟,自动停止");
        exit();
    }

    tryCount++;

    var buttons = text("去完成").find();

    if (buttons.empty()) {
        toast("未找到'去完成',尝试滑动刷新...");
        swipe(width / 2, height * 0.8, width / 2, height * 0.3, 800);
        sleep(3000);
        continue;
    }

    var found = false;

    for (var i = 0; i < buttons.size(); i++) {
        var btn = buttons.get(i);
        var parent = btn.parent();
        var textAll = "";

        if (parent) {
            var textViews = parent.find(className("TextView"));
            var minDist = 10000;
            textViews.forEach(tv => {
                var dist = Math.abs(tv.bounds().centerY() - btn.bounds().centerY());
                if (dist < minDist) {
                    minDist = dist;
                    textAll = tv.text();
                }
            });
        }

        toast("检测到任务文本:" + textAll);

        if (textAll && textAll.match(/浏览.*秒/)) {
            found = true;
            toast("执行任务:" + textAll);

            // 从任务文本提取浏览时间(默认15秒)
            var timeMatch = textAll.match(/(\d+)\s*秒/);
            var browseSeconds = timeMatch ? parseInt(timeMatch[1]) : 15;
            if (browseSeconds < 5) browseSeconds = 5; // 设置最小5秒

            // 点击"去完成"
            try {
                if (btn.clickable()) {
                    btn.click();
                } else {
                    click(btn.bounds().centerX(), btn.bounds().centerY());
                }
            } catch (e) {
                toast("点击异常,尝试坐标点击");
                click(btn.bounds().centerX(), btn.bounds().centerY());
            }

            sleep(2000); // 等待页面加载

            // 检测是否有"搜索"按钮
            var searchBtn = text("搜索").findOne(2000);
            if (searchBtn) {
                toast("发现搜索按钮,先点击挡风披冬季");
                var itemBtn = text("挡风被冬季").findOne(2000);
                if (itemBtn) {
                    itemBtn.click();
                    sleep(1000);
                }
                toast("点击搜索按钮");
                searchBtn.click();
                sleep(2000);
            }

            // 模拟滑动浏览页面(7次)
            for (var j = 0; j < 7; j++) {
                swipe(width / 2, height * 0.8, width / 2, height * 0.2, 800);
                sleep(1500);
            }

            // 模拟浏览时间(动态调整)
            var browseMs = browseSeconds * 1000;
            toast("浏览约 " + browseSeconds + " 秒");
            sleep(browseMs);

            try {
                back();
            } catch (e) {
                toast("返回失败,重试");
                sleep(2000);
                back();
            }

            sleep(4000);
            break;
        }
    }

    if (!found) {
        toast("未找到浏览类任务,继续下滑刷新...");
        swipe(width / 2, height * 0.8, width / 2, height * 0.3, 800);
        sleep(3000);
    }
}

toast("任务循环结束");
相关推荐
2201_75783087几秒前
条件分页查询
java·开发语言
梦想的旅途23 分钟前
探索界面自动化技术在企业微信外部群管理中的应用场景与实现思路
运维·自动化·企业微信
重生之我是Java开发战士4 分钟前
【数据结构】Java对象的比较
java·jvm·数据结构
cc蒲公英10 分钟前
vue nextTick和setTimeout区别
前端·javascript·vue.js
橘子1311 分钟前
Linux线程——一些概念(七)
java·redis·缓存
magic_kid_201015 分钟前
IDEA 复制到 Windows 远程桌面失败的原因与解决方案
java·ide·intellij-idea
风月歌16 分钟前
基于微信小程序的学习资料销售平台源代码(源码+文档+数据库)
java·数据库·mysql·微信小程序·小程序·毕业设计·源码
巴拉巴拉~~20 分钟前
KMP 算法通用步进器组件:KmpStepperWidget 横向 / 纵向 + 匹配进度 + 全样式自定义
java·服务器·开发语言
sinat_3842410921 分钟前
OpenSpeedy 是一款开源免费的游戏变速工具
javascript
weixin_3077791321 分钟前
赋能插件,驱动图表:Jenkins ECharts API插件详解
运维·开发语言·自动化·jenkins·echarts