分享一下基于autojs4的悟空浏览器的代码

该脚本主要实现对悟空浏览器的自动化管理,包括检查执行时间、执行任务、签到、清理缓存和提现等功能。通过随机滑动、关注和点击操作模拟用户行为,同时监控广告和视频菜单。在遇到错误时进行错误提示,并具备一定的异常处理能力。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

function 悟空浏览器(appName, executeCount, execTimes, timesInterval, IsAutoSign, IsAutoComment, IsClearCache, IsCashOut, probability, execAutoBrushDate, CurveBrushScreen, IsCloseApp, isFragmentation, fragmentationTime) {
    setJurisdiction()
    closeAd()
    clickVideoMenu()
    for (var i = 1; i < executeCount; i++) {
        try {
            if (checkTimesIsZeroTime(execAutoBrushDate, 3)) {
                return;
            }
            let exectue_status = computerExctueTime(appName, execTimes, isFragmentation, fragmentationTime)
            if (exectue_status == 1) {
                if (fragmentAutoWeixin) {
                    微信阅读()
                }
                return //执行下一个app
            } else if (exectue_status == 2) {
                if (IsAutoSign) {
                    autoSign()
                }
                if(IsClearCache){
                    clearAppCache() 
                }
                if (IsCashOut) {
                    //autoCashOut()
                }
                toastInfo(appName + "今日薅羊毛时间已到,进入下一个app...");
                return;//今日时间已到
            } else if (exectue_status == 3) {

            }
            var start = new Date().getTime();//App起始时间
            let x1 = random(device.width * 0.7, device.width * 0.8);
            let y1 = device.height - (device.height * 0.2)
            let x2 = random(device.width * 0.7, device.width * 0.8);
            let y2 = device.height * 0.2
            let pressTime = random(600, 700);

            randomHeart('starImage', probability);//随机关注
            randomUpSildeScreen(x1, y2, x1, y1, pressTime, probability);
            randomDownSildeScreen(x1, y1, x2, y2, pressTime, timesInterval, probability);
            slideScreenDown(x1, y1, x2, y2, pressTime, timesInterval, CurveBrushScreen, IsCloseApp, isFragmentation, fragmentationTime);
            appRunTimeRecord(appName, (new Date().getTime() - start))//记录一次时间
        } catch (error) {
            toastError(appName + "刷刷刷时出现错误!" + error);
        }
    }


    function keepBrush() {
        if (text("搞笑").exists()) {
            clickVideoMenu()
        }
    }
    function closeAd() {
        clickControlBounds(id("cancel_action"));
    }
    function clickVideoMenu() {
        if (text("视频").exists()) {
            clickControlBounds(text("视频"))
        }
    }
    function autoCashOut() {
        try {
            if (id("left_button").exists()) {
                clickControlBounds(id("left_button"));
                sleepRandom3()
            }
            if (id("closeButton").exists()) {
                clickControlBounds(id("closeButton"));
            }
            if (clickControl(text("我的"))) {
                if (clickControl(text("提现"))) {
                    sleepRandom0()
                    if (text("确认提现").exists()) {
                        clickControlBounds(text("确认提现"))
                        sleepRandom1()

                        if (id("action_button_left").exists()) {
                            clickControlBounds(id("action_button_left"));
                        }
                    }
                }
            }
        } catch (error) {
            toastError(error);
        }
    }
    function autoSign() {
        toastLog("开始签到")
        let signValue = adengetSignTime(appName);
        if (getDate() == signValue) {
            toastLog("已签到本次签到跳过...");
            return;
        }
        if (clickControlBounds(text("赚钱"))) {
            sleepRandom3() //是个网页加载的慢
            sleepRandom1() //等待弹窗
            recordSignTime(appName);
            sleepRandom1() //等待弹窗
                back()
                sleepRandom1() //等待弹窗
            clickControlBounds(text("短视频"));
        }
    }
    /**
 * 清理缓存
 */
function clearAppCache() {
    toastLog("开始App清理缓存");
    if (clickControlBounds(text("我的"))) {
        sleepRandom3() //是个网页加载的慢
        swipeDown()
        if (clickControlBounds(text("设置"))) {
            sleepRandom1()
            swipeDown()
            if (clickControlBounds(text("清除系统缓存"))) {
                sleepRandom1()
                clickControlBounds(text("清除"))
                sleepRandom1()
                back()
                sleepRandom1()
                clickControlBounds(text("短视频"));
            }
        } else {
            toastLog("未发现settings")
        }
    } else {
        toastLog("未发现我的")
    }
 }

}

没啥难的算是记录吧

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

亚丁号

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值