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("任务循环结束");
相关推荐
zhanghaofaowhrql2 小时前
Cursor+GitOps:自动化运维新姿势
运维·自动化
2501_947575803 小时前
计算机毕业设计之jsp开山车行二手车交易系统
java·开发语言·hadoop·python·信息可视化·django·课程设计
骑士雄师3 小时前
java面试题 4:鉴权
java·开发语言
帅次5 小时前
Android 高级工程师面试:Java 基础知识 近1年高频追问 22 题
android·java·面试
蓝胖的四次元口袋5 小时前
Java集合(4)
java·哈希算法
2501_948106915 小时前
计算机毕业设计之基于jsp教科研信息共享系统
java·开发语言·信息可视化·spark·课程设计
TanYYF5 小时前
spring ai入门教程二
java·人工智能·spring
SeeYa-J5 小时前
Spring IOC(Inversion of Control)
java·spring·rpc
不会c+6 小时前
02-SpringBoot配置文件
java·spring boot·后端
anOnion6 小时前
Agentic 前端开发之 实时显示 AI Agent 终端输出
前端·javascript·人工智能