分享快手极速版助手APK和源代码

简介: 分享快手极速版助手APK和源代码


快手极速版高级的版本已经开启检测autojs,因此最新的快手极速版是无法用autojs脚本刷刷刷的。我这里提供9.2的下载地址,这个可以刷。地址如下:

https://wwa.lanzoui.com/icST4rzv4kh

本次和大家分享的apk完全免费而且代码开源我先把地址和apk地址给大家。

APK地址:https://wwa.lanzoui.com/iSpfxsumwvi

源代码地址:https://wwa.lanzoui.com/i7YiEsu7gxe

  • 核心功能

无图无真想先给大家晒晒图。

一图知千意,切记用我提供的快手否则无法阅读。

功能我就不一一说了我先说下注意的地方。

一、首先此版本是免费版本,核心技术是AutojsPro开发,所以需要开启安卓系统的无障碍服务。其次本软件【签到】是基于找图技术研发找图技术需要适配分辨率,找图截图是依据OPPOR9SK开发分辨率是1080*1920的,故非此分辨率【签到】将无法运行。谢谢理解!!!最后作者wx18141782993需要购买收费版本的请联系谢谢!

二、本版本就用到几个图片且代码是完全开源的所以大家自己替换对应的图片就行可以了。

把这几个图片用截图工具自己截图替换就行了。

代码如下:

"ui";
var rootUrl = "http://www.yadinghao.com";
var storageSign = "YadinghaoKSFreeAssist"
var softVersion = "1.0.0"
var yadinghaoStorages = storages.create(storageSign);//创建本地存储
ui.layout(
    <vertical>
        <scroll>
            <vertical>
                <vertical>
                    <horizontal  >
                        <text text="快手极速版邀请码:460754595 " textColor="#228B22" paddingLeft="14"/>
                        <button text="复制" id="btnCopyText" style="Widget.AppCompat.Button.Borderless" w="52" textColor="#FF7F50" />
                    </horizontal>
                </vertical>
                <vertical>
                    <horizontal  >
                        <text text="下载快手极速版v9.2.40.1209 " textColor="#228B22" paddingLeft="14"/>
                        <button text="下载" id="btnDownloadApp" style="Widget.AppCompat.Button.Borderless" w="52" textColor="#FF7F50" />
                        <text text="别安装最新的最新的刷不了" textColor="#228B22" paddingLeft="2"/>
                    </horizontal>
                </vertical>
                {/* 是否开启控制台 */}
                <vertical>
                    <horizontal >
                        <img w="50" h="50" padding="16" src="https://ucc.alicdn.com/images/user-upload-01/2022010623454366871.png"></img>
                        <Switch id='switchIsShowConsole' text="是否开启控制台(不建议开启偶尔会遮挡点击事件" paddingTop="16" textColor="black" />
                    </horizontal>
                </vertical>
                {/* 是否强制停止 */}
                <vertical>
                    <horizontal >
                        <img w="50" h="50" padding="16" src="https://ucc.alicdn.com/images/user-upload-01/2022010623454438148.png"></img>
                        <Switch id='switchIsCloseApp' text="是否强制停止(不是所有手机都支持)" paddingTop="16" textColor="black" />
                    </horizontal>
                </vertical>
                {/* 是否自动签到 */}
                <vertical>
                    <horizontal >
                        <img w="50" h="50" padding="16" src="https://ucc.alicdn.com/images/user-upload-01/2022010623454451151.png"></img>
                        <Switch id='switchIsAutoSign' text="是否自动签到 " paddingTop="16" textColor="black" />
                    </horizontal>
                </vertical>
                <vertical>
                    <horizontal >
                        <img w="50" h="50" padding="16" src="https://ucc.alicdn.com/images/user-upload-01/2022010623454460638.png"></img>
                        <Switch id='switchIsAutoComment' text="是否自动评论" paddingTop="16" textColor="black" />
                    </horizontal>
                </vertical>
                {/* 是否自动清理缓存 */}
                <vertical>
                    <horizontal >
                        <img w="50" h="50" padding="16" src="https://ucc.alicdn.com/images/user-upload-01/2022010623454423536.png"></img>
                        <Switch id='switchIsClearCache' text="是否自动清理缓存" paddingTop="16" textColor="black" />
                    </horizontal>
                </vertical>
                {/* 屏幕滑动时间间隔 系统内部加减2秒*/}
                <vertical>
                    <horizontal >
                        <text text="屏幕滑动时间间隔(系统内部加减2秒):" textColor="red" padding="8 8 8 8" />
                        <input id="txtScreenSileTimesInterval" text="10" hint="视频之间的滑动时间间隔" inputType="number" padding="8 8 8 8" />
                    </horizontal>
                </vertical>
                {/* App启动时间 */}
                <vertical>
                    <horizontal >
                        <text text="App启动时间(秒):" textColor="red" padding="8 8 8 8" />
                        <input id="txtAppStartWaiteTime" text="30" hint="App启动时间(秒)" inputType="number" padding="8 8 8 8" />
                    </horizontal>
                </vertical>
                {/* App执行时间 */}
                <vertical>
                    <horizontal >
                        <text text="App执行时间(分):" textColor="red" padding="8 8 8 8" />
                        <input id="txtAppExecuteTime" text="120" hint="App执行时间(分)" inputType="number" padding="8 8 8 8" />
                    </horizontal>
                </vertical>
                <horizontal>
                    <button style="Widget.AppCompat.Button.Colored" id="btnStartApp" text="启动" padding="12dp" w="*" />
                </horizontal>
            </vertical>
        </scroll>
        <frame id="frameSecondTab">
            <scroll>
                <vertical>
                    <text w="auto" color="#111111" size="26" text="相关软件推荐" textColor="black" padding="8 8 8 8" />
                    <list id="reItemList" padding="25 0 8 8"  >
                        <horizontal h="40">
                            <text id="appIndex" text="{{this.ProductIndex}}、" inputType="number" w="40" gravity="center" textColor="#228B22" />
                            <text id="txtSoftName" textSize="18sp" textColor="#000000" text="{{SoftName}}" textColor="#228B22" />
                            <button text="下载" id="btnDownLoad" style="Widget.AppCompat.Button.Borderless" w="52" textColor="#FF7F50" />
                            <button text="访问" id="btnVistorWeb" style="Widget.AppCompat.Button.Borderless" w="52" textColor="#FF7F50" />
                        </horizontal>
                    </list>
                </vertical>
            </scroll>
        </frame>
    </vertical>
)
initializeFrendTipMessage()
initializeReItemList()
var CommentKeyWord = [
    '我是App小助手关注了你你要关注我哦!',
    '山高路远坑深,大军纵横驰奔,谁敢横刀立马?惟有点赞加关注大军!',
    '我的未来不是梦我相信你也是!',
    '身同感受',
    '风雨送春归,飞雪迎春到。',
    '俏也不争春,只把春来报。',
    '天若有情天亦老...',
    '...人间正道是沧桑',
    '...喜欢的人喜欢的事亦不能表达喜欢的心...',
    '三分春色二分愁,更一分风雨',
];
var isShowConsole = yadinghaoStorages.get("isShowConsole");
if (isShowConsole != null && isShowConsole == "true") {
    ui.switchIsShowConsole.setChecked(true);
} else {
    ui.switchIsShowConsole.setChecked(false);
}
var timesInterval = yadinghaoStorages.get("timesInterval");
if (timesInterval != null) {
    ui.txtScreenSileTimesInterval.setText(timesInterval);
}
var IsAutoSign = yadinghaoStorages.get("isAutoSign");
var IsClearCache = yadinghaoStorages.get("isClearCache");
var IsCashOut = yadinghaoStorages.get("isCashOut");
var IsAutoComment = yadinghaoStorages.get("isAutoComment");
if (IsAutoComment != null && IsAutoComment == "true") {
    ui.switchIsAutoComment.setChecked(true);
} else {
    ui.switchIsAutoComment.setChecked(false);
}
if (IsAutoSign != null && IsAutoSign == "true") {
    ui.switchIsAutoSign.setChecked(true);
} else {
    ui.switchIsAutoSign.setChecked(false);
}
if (IsClearCache != null && IsClearCache == "true") {
    ui.switchIsClearCache.setChecked(true);
} else {
    ui.switchIsClearCache.setChecked(false);
}
if (IsCashOut != null && IsCashOut == "true") {
    ui.switchIsCashOut.setChecked(true);
}
var WateForTime = yadinghaoStorages.get("WateForTime");
if (WateForTime != null) {
    ui.txtWateForTime.setText(WateForTime);
}
var exectueTime = yadinghaoStorages.get("exectueTime");
if (exectueTime != null) {
    ui.txtAppExecuteTime.setText(exectueTime);
}
var IsCloseApp = yadinghaoStorages.get("isCloseApp");
if (IsCloseApp != null && IsCloseApp == "true") {
    ui.switchIsCloseApp.setChecked(true);
} else {
    ui.switchIsCloseApp.setChecked(false);
}
ui.btnCopyText.on("click", function () {
    let AppCode = "460754595";
    toast("复制成功: " + AppCode);
    setClip(AppCode);
});
ui.btnDownloadApp.on("click", function () {
    try {
        app.openUrl("https://wwa.lanzoui.com/icST4rzv4kh");
    } catch (e) {
        //悬浮窗爱出错On Windows   Shift + Alt + F 代码格式
        console.show()
        toastLog("执行脚本出错...请将此页面截图联系攻城狮" + e)
    }
});
ui.btnStartApp.on("click", function () {
    let isShowConsole = ui.switchIsShowConsole.isChecked();
    let timesInterval = ui.txtScreenSileTimesInterval.getText();
    let IsAutoSign = ui.switchIsAutoSign.isChecked();
    let IsClearCache = ui.switchIsClearCache.isChecked();
    let IsAutoComment = ui.switchIsAutoComment.isChecked();
    let wateForTime = parseInt(ui.txtAppStartWaiteTime.getText());
    let IsCloseApp = ui.switchIsCloseApp.isChecked();
    let probability = 10;
    let totalTimes = ui.txtAppExecuteTime.getText() //执行时间
    let consoleMessage = "不开启控制台";
    if (isShowConsole) {
        consoleMessage = "开启控制台";
    }
    let totalHour = parseFloat(totalTimes / 60).toFixed(2);//转成小时
    //let havedHour = parseFloat(totalExecTimes / 60).toFixed(2);//转成小时
    let tipMessage = "本次共执行:" + totalHour + "小时." + consoleMessage;
    confirm(tipMessage).then(value => {
        if (value) {
            threads.start(function () {
                auto.waitFor();
                saveConfig()//保存一下配置
                threads.start(function () {
                    if (isShowConsole) {
                        console.show();
                        console.setPosition(0, device.height / 3);
                    }
                    //开启截图功能
                    if (!requestScreenCapture()) {
                        toastLog("请求截图失败");
                        stop();
                    }
                });
                let appName = "快手极速版"
                快手极速版(appName, wateForTime, timesInterval, probability, totalTimes, IsAutoSign, IsAutoComment)
                if (IsClearCache) {
                    clearAppCache()
                }
                if (IsCloseApp) {
                    clearCach(appName)
                }
            });
        } else {
            toastLog("操作被取消了");
        }
    });
});
function 快手极速版(appName, wateForTime, timesInterval, probability, execTimes, isAutoSign, isAutoComment) {
    app.launchApp(appName);//启动App
    toastLog("当前自动阅读程序" + appName + "等待进入");//系统日志提示
    cutDownBySleep(wateForTime)//启动App时候等待时间
    adolescentWindows();//关闭青少年窗口
    closeUpgradetWindows();//关闭升级提示框
    if (isAutoSign)
        autoSign(appName)
    while (true) {
        try {
            var start = new Date().getTime();//App起始时间
            let x1 = random(device.width * 0.8, device.width * 0.9);
            let y1 = device.height - (device.height * 0.15)
            let x2 = random(device.width * 0.8, device.width * 0.9);
            let y2 = device.height * 0.2
            let pressTime = random(700, 800);
            keepBrush()
            randomHeart('like_icon', probability);//随机关注百分之一的概率
            randomFollow('series_follow', probability)
            if (isAutoComment)
                AutoComment(probability)
            randomUpSildeScreen(x1, y2, x1, y1, pressTime, probability);
            randomDownSildeScreen(x1, y1, x2, y2, pressTime, timesInterval, probability);
            slideScreenDown(x1, y1, x2, y2, pressTime, timesInterval, false);
            appRunTimeRecord(appName, (new Date().getTime() - start))//记录一次时间
            computerExctueTime(appName, execTimes)
        } catch (error) {
            toastLog(appName + "刷刷刷时出现错误!" + error);
            sleep(timesInterval * 1000)
        }
    }
}
function keepBrush(){
    if (id("left_btn").exists()) {
        back()
    }
    let return_image_array=["./Image/快手极速版/返回1.png", "./Image/快手极速版/返回2.png", "./Image/快手极速版/返回3.png"]
    let ad_area_coordinate = [0, 0, device.width, device.height * 0.55]
    let threshold = 0.8
    if (clickAreaForFindImage(return_image_array, ad_area_coordinate, threshold)) {
    }
}
/**
 *  自动签到
 */
function autoSign(appName) {
    let signValue = getSignTime(appName);
    if (getDate() == signValue) {
        toastLog("已签到本次签到跳过...");
        return;
    }
    let ad_area_coordinate = [0, 0, device.width, device.height * 0.55]
    let threshold = 0.8
    let get_coin_image = ["./Image/快手极速版/红包1.png", "./Image/快手极速版/红包2.png"]
    let ad_image_array = buildADArray("./Image/AD", 12);
    let sign_image_array=   ["./Image/快手极速版/快手立即签到.png", "./Image/快手极速版/立.png", "./Image/快手极速版/即.png"]
    let return_image_array=["./Image/快手极速版/返回1.png", "./Image/快手极速版/返回2.png", "./Image/快手极速版/返回3.png"]
    if (clickAreaForFindImage(get_coin_image, ad_area_coordinate, threshold)) {
        sleepRandom3() //是个网页加载的慢
        if (clickAreaForFindImage(sign_image_array, ad_area_coordinate, threshold)) {
            clickAreaForFindImage(ad_image_array)
            if (clickAreaForFindImage(return_image_array, ad_area_coordinate, threshold)) {
            }else{
                back()
            }
        }else{
            if (文字去签到()) {
                clickAreaForFindImage(ad_image_array)
                if (clickAreaForFindImage(return_image_array, ad_area_coordinate, threshold)) {
                }else{
                    back()
                }
            }
            swipeDown()
            if (文字去签到()) {
                clickAreaForFindImage(ad_image_array)
                if (clickAreaForFindImage(return_image_array, ad_area_coordinate, threshold)) {
                }else{
                    back()
                }
            }
            swipeDown()
            if (文字去签到()) {
                clickAreaForFindImage(ad_image_array)
                if (clickAreaForFindImage(return_image_array, ad_area_coordinate, threshold)) {
                }else{
                    back()
                }
            }
            swipeDown()
            if (文字去签到()) {
                clickAreaForFindImage(ad_image_array)
                if (clickAreaForFindImage(return_image_array, ad_area_coordinate, threshold)) {
                }else{
                    back()
                }
            }
        }
        if (clickAreaForFindImage(return_image_array, ad_area_coordinate, threshold)) {
        }else{
            back()
        }
    }
    function 文字去签到() {
        if (text("去签到").exists()) {
            console.log("快手极速版去签到");
            if (clickControlBounds(text("去签到"))) {
                recordSignTime(appName);
                return true
            } else {
                return false
            }
        } else {
            return false
        }
    }
}
/**
 * 清理缓存
 */
function clearAppCache() {
    if (className("android.widget.ImageView").id("left_btn").exists()) {
        className("android.widget.ImageView").id("left_btn").findOnce().click();
        sleep(3000);
        if (className("android.widget.TextView").text("设置").exists()) {
            toastLog("点击设置");
            let b = className("android.widget.TextView").text("设置").findOne().bounds();
            click(b.centerX(), b.centerY());
            sleep(3000);
            if (className("android.widget.TextView").text("清除缓存").exists()) {
                let b = className("android.widget.TextView").text("清除缓存").findOnce().bounds();
                let result = click(b.centerX(), b.centerY());
                if (result) {
                    toastLog("清理成功");
                }
            }
        }
    }
}
/**
 * 自动评论
 */
function AutoComment(probability) {
    let randomIndex = random(1, parseInt(probability));
    if (randomIndex == 1) {
        let comment = CommentKeyWord[Math.floor(Math.random() * CommentKeyWord.length)];
        let buttons = className("android.widget.LinearLayout").id("comment_button").find();
        if (buttons.length > 0) {
            let clickResult = buttons[0].click();
            if (clickResult) {
                sleep(3000);
                if (id("comment_editor_holder_text").exists()) {
                    id("comment_editor_holder_text").findOnce().click();
                    sleep(1000);
                    setText(0, comment);
                    sleep(1000);
                    if (text("发送").exists()) {
                        toastLog("开启自动评论");
                        if (text("发送").findOnce().click()) {
                            toastLog("自动评论成功");
                            if (clickControlBounds(id("photo_detail_panel_close"))) {
                            } else {
                                back();
                            }
                        }
                    }
                }
            }
        }
    }
}
function saveConfig() {
    yadinghaoStorages.put("isShowConsole", "" + ui.switchIsShowConsole.isChecked() + "");
    yadinghaoStorages.put("timesInterval", "" + ui.txtScreenSileTimesInterval.getText() + "");
    yadinghaoStorages.put("isAutoSign", "" + ui.switchIsAutoSign.isChecked() + "");
    yadinghaoStorages.put("isClearCache", "" + ui.switchIsClearCache.isChecked() + "");
    yadinghaoStorages.put("isAutoComment", "" + ui.switchIsAutoComment.isChecked() + "");
    yadinghaoStorages.put("wateForTime", "" + ui.txtAppStartWaiteTime.getText() + "");
    yadinghaoStorages.put("isCloseApp", "" + ui.switchIsCloseApp.isChecked() + "");
    yadinghaoStorages.put("exectueTime", "" + ui.txtAppExecuteTime.getText() + "");
}
function initializeFrendTipMessage() {
    try {
        dialogs.build({
            title: "友情提醒",
            positive: "确定",
            negative: "复制微信",
            neutral: "访问官网",
            items: ["首先此版本是免费版本,核心技术是AutojsPro开发,所以需要开启安卓系统的无障碍服务。\r\n其次本软件【签到】是基于找图技术研发找图技术需要适配分辨率,找图截图是依据OPPOR9SK开发分辨率是1080*1920的,故非此分辨率【签到】将无法运行。谢谢理解!!!\r\n最后作者wx18141782993需要购买收费版本的请联系谢谢!"]
        }).on("negative", () => {
            app.openUrl("www.yadinghao.com");
        }).on("neutral", () => {
            app.openUrl("www.yadinghao.com");
        }).on("show", (dialog) => {
        }).show();
    } catch (e) {
        console.show()
        toastLog("initializeFrendTipMessage出错...请将此页面截图联系攻城狮" + e)
    }
}
function initializeReItemList() {
    try {
        var result_threads = threads.disposable();
        threads.start(function () {
            let dict_result = []
            try {
                var url_address = rootUrl + "/api/AppFindRecommendSoft?type=1";
                response = http.post(url_address, { "type": "1" });
                if (response.statusCode == 200) {
                    var product_json = response.body.json();
                    if (product_json.success == "true") {
                        var ProducCloudList = [];
                        let recProductList = JSON.parse(product_json.data)
                        for (let i = 0; i < recProductList.length; i++) {
                            let row = { ProductIndex: (i + 1), SoftName: recProductList[i].PRODUCT_NAME, DownURL: recProductList[i].DOWNLOAD_URL, VistorURL: recProductList[i].VISTOR_URL };
                            ProducCloudList.push(row);
                        }
                        dict_result = [true, ProducCloudList]
                        result_threads.setAndNotify(dict_result);
                    } else {
                        dict_result = [false, "读取云端信息出现问题:" + json.message]
                        result_threads.setAndNotify(dict_result);
                    }
                } else if (response.statusCode == 404) {
                    dict_result = [false, "读取云端信息出现问题访问服务器出现错误404错误请稍后重试"]
                    result_threads.setAndNotify(dict_result);
                } else {
                    dict_result = [false, "读取云端信息出现问题无法连接服务器"]
                    result_threads.setAndNotify(dict_result);
                }
            } catch (error) {
                dict_result = [false, "读取云端脚本出现问题:" + error]
                result_threads.setAndNotify(dict_result);
            }
        });
        result_threads = result_threads.blockedGet()
        if (result_threads[0] == false) {
            toastLog(result_threads[1])
        }
        else {
            ui.reItemList.setDataSource(result_threads[1]);
        }
    } catch (error) {
        toastLog("initializeReItemList构建推荐脚本出现错误:" + error)
    }
    ui.reItemList.on("item_bind", function (itemView, itemHolder) {
        itemView.btnDownLoad.on("click", function () {
            try {
                let item = itemHolder.item;
                let url = item.DownURL
                app.openUrl(url);
            } catch (e) {
                //悬浮窗爱出错On Windows   Shift + Alt + F 代码格式
                console.show()
                toastLog("btnDownLoad执行脚本出错...请将此页面截图联系攻城狮" + e)
            }
        });
        itemView.btnVistorWeb.on("click", function () {
            try {
                let item = itemHolder.item;
                let url = item.VistorURL
                app.openUrl(url);
            } catch (e) {
                //悬浮窗爱出错On Windows   Shift + Alt + F 代码格式
                console.show()
                toastLog("btnVistorWeb执行脚本出错...请将此页面截图联系攻城狮" + e)
            }
        });
    });
}
//#region 公共方法
function buildADArray(ad_path, ad_number) {
    let ad_array = []
    for (let i = 1; i <= ad_number; i++) {
        let ad_full_path = ad_path + "/ad" + (i) + ".png"
        ad_array.push(ad_full_path)
    }
    return ad_array;
}
function clearCach(appName) {
    let deviceModel = device.model
    if (deviceModel == "OPPO R9sk") {
        recents()
        sleep(2000);
        click(device.width / 2, device.height / 1.19)
    } else {
        stopApp(appName)
    }
}
/**
 * 强制停止app
 * @param {应用名称} appName 
 */
function stopApp(appName) {
    try {
        openAppSetting(getPackageName(appName));
        sleep(3000);
        if (className("android.widget.Button").text("强行停止").exists()) {
            className("android.widget.Button").text("强行停止").findOnce().click();
        } else {
            if (text("强行停止").exists()) {
                text("强行停止").findOnce().click();
            }
        }
        sleep(3000);
        if (className("android.widget.Button").text("确定").exists()) {
            className("android.widget.Button").text("确定").findOnce().click();
            toastLog(appName + "已经停止!");
        }
        else {
            if (text("强行停止").exists()) {
                text("强行停止").findOnce().click();
                toastLog(appName + "已经停止!");
            } else {
                if (text("结束运行").exists()) {
                    text("结束运行").findOnce().click();
                    sleep(500);
                    if (text("确定").exists()) {
                        text("确定").findOnce().click();
                        toastLog("MIUI9 Android7" + appName + "已经停止!");
                    }
                }
            }
        }
    } catch (e) {
        toastLog(e);
    }
}
/**
 * 找图,找到并点击
 * @param {可以是数组也可以是字符串,传输数组可以多次找图知道找到为止} img_path_array 
 * @param {找图区域,默认是全屏找图,该参数可以不传输} area_region 
 * @param {相似度,默认是0.8,可以不传输} threshold 
 * @returns true表示执行成功Flase表示失败
 */
function clickAreaForFindImage(img_path_array, area_region, threshold, is_continue) {
    try {
        area_region = area_region || [0, 0, device.width, device.height] //默认的找图区域 全屏找图 前2位是坐标 后面是长度和宽度   千万别理解成是坐标
        threshold = threshold || 0.8 // 默认的相识度0.8
        is_continue = is_continue || false
        if (img_path_array instanceof Array) {
            let arrayLength = img_path_array.length
            for (let i = 0; i < arrayLength; i++) {
                //toastLog("正在进行第" + (i + 1) + "次找图...")
                img_path = img_path_array[i] //小图地址可判断是否存在
                if (!files.exists(img_path)) {
                    toastLog(img_path + "文件不存在因此跳过")
                    continue
                }
                var little_image = images.read(img_path) //小图
                var find_result_bounds = findImage(
                    captureScreen(), little_image, {
                    region: area_region,
                    threshold: threshold
                });
                if (find_result_bounds) {
                    toastLog(img_path + "图找到,准备点击坐标:" + find_result_bounds)
                    click(find_result_bounds.x, find_result_bounds.y)
                    return true
                } else {
                    //toastLog(img_path+"小图存在但是在大图中未找到图片进入下一次循环...")
                }
            }
            return false
        }
        if (typeof (img_path_array) == "string") {
            img_path = img_path_array//小图地址可判断是否存在
            if (!files.exists(img_path)) {
                toastLog(img_path + "文件不存在因此跳过")
                return false
            }
            var little_image = images.read(img_path) //小图
            var find_result_bounds = findImage(
                captureScreen(), little_image, {
                region: area_region,
                threshold: threshold
            });
            if (find_result_bounds) {
                toastLog(img_path + "图找到,准备点击坐标:" + find_result_bounds)
                click(find_result_bounds.x, find_result_bounds.y)
                return true
            } else {
                //toastLog(img_path + "小图存在但是在大图中未找到图片")
                return false
            }
        }
    } catch (error) {
        toastLog("clickAreaForFindImage方法出现错误:" + error)
        return false;
    }
}
/**
 * 启动app
 * @param {*} appName 
 */
function startApp(appName) {
    sleepRandom3()
    app.launchApp(appName);//启动App
    sleep(30000);//启动App时候等待时间
    adolescentWindows();//关闭青少年窗口
    //closeUpgradetWindows();//关闭升级提示框
}
/**
 *  * 判断app今日时间否到达
 * 1、完成部分
 * 2、全部完成
 * 3、继续执行
 * @param {App名称} appName 
 * @param {总共执行时间} execTimes 
 * @param {是否碎片化} isFragmentation 
 * @param {碎片化时间} fragmentationTime 
 */
function computerExctueTime(appName, execTimes) {
    if (appName == app.getAppName(currentPackage())) {
        //toastLog("Run the same app as the task app")
    } else {
        startApp(appName)
    }
    let key = appName + storageSign + getDate();
    let havedRunTimes = yadinghaoStorages.get("" + key + ""); //系统存储已经执行的时间
    let havedMinute = (havedRunTimes / 1000) / 60;//读取到的时间是毫秒需要转换成秒,转换成秒后在转换成分钟
    toastLog(appName + "已经执行" + havedMinute.toFixed(2) + '分' + "总计:" + execTimes + "分");
}
/**
 * 贝塞尔曲线
 * @param {坐标点} ScreenPoint 
 * @param {偏移量} Offset 
 */
function bezier_curves(ScreenPoint, Offset) {
    cx = 3.0 * (ScreenPoint[1].x - ScreenPoint[0].x);
    bx = 3.0 * (ScreenPoint[2].x - ScreenPoint[1].x) - cx;
    ax = ScreenPoint[3].x - ScreenPoint[0].x - cx - bx;
    cy = 3.0 * (ScreenPoint[1].y - ScreenPoint[0].y);
    by = 3.0 * (ScreenPoint[2].y - ScreenPoint[1].y) - cy;
    ay = ScreenPoint[3].y - ScreenPoint[0].y - cy - by;
    tSquared = Offset * Offset;
    tCubed = tSquared * Offset;
    result = {
        "x": 0,
        "y": 0
    };
    result.x = (ax * tCubed) + (bx * tSquared) + (cx * Offset) + ScreenPoint[0].x;
    result.y = (ay * tCubed) + (by * tSquared) + (cy * Offset) + ScreenPoint[0].y;
    return result;
}
/**
 * 滑动(默认概率是百分之三十)
 * @param {*} qx 
 * @param {*} qy 
 * @param {*} zx 
 * @param {*} zy 
 * @param {*} time 
 * @param {*} timesInterval 
 */
function slideScreenDown(qx, qy, zx, zy, time, timesInterval, CurveBrushScreen) {
    if (CurveBrushScreen) {
        curveDown(qx, qy, zx, zy, time, timesInterval); //曲线概率
    } else {
        lineDown(qx, qy, zx, zy, time, timesInterval); //直线概率
    }
}
/**
 * 概率0-9 大于3的时候采用曲线概率 小于3的时候直线概率
 */
function randomFunction() {
    return Math.floor(Math.random() * 10);
}
/**
 * 
 * @param {*} qx 
 * @param {*} qy 
 * @param {*} zx 
 * @param {*} zy 
 * @param {*} time 
 * @param {*} timesInterval 
 */
function curveDown(qx, qy, zx, zy, time, timesInterval) {
    var xxy = [time];
    var point = [];
    var dx0 = {
        "x": qx,
        "y": qy
    };
    var dx1 = {
        "x": random(qx - 100, qx + 100),
        "y": random(qy, qy + 50)
    };
    var dx2 = {
        "x": random(zx - 100, zx + 100),
        "y": random(zy, zy + 50),
    };
    var dx3 = {
        "x": zx,
        "y": zy
    };
    for (var i = 0; i < 4; i++) {
        eval("point.push(dx" + i + ")");
    };
    for (let i = 0; i < 1; i += 0.08) {
        let newPoint = bezier_curves(point, i);
        xxyy = [parseInt(newPoint.x), parseInt(newPoint.y)]
        xxy.push(xxyy);
    }
    gesture.apply(null, xxy);
    let randomMin = timesInterval * 1000;
    let randomMax = (parseInt(timesInterval) + 2) * 1000;
    let delayTime = random(randomMin, randomMax);
    sleep(delayTime);
}
function swipeDown() {
    let x1 = random(device.width * 0.8, device.width * 0.9);
    let y1 = device.height - (device.height * 0.2)
    let x2 = random(device.width * 0.8, device.width * 0.9);
    let y2 = device.height * 0.1
    swipe(x1, y1, x2, y2, 700);
    sleep(3000);
}
/**
 * 屏幕向下滑动并延迟8至12秒
 */
function lineDown(startX, startY, endX, endY, pressTime, timesInterval) {
    swipe(startX, startY, endX, endY, pressTime);
    let randomMin = timesInterval * 1000;
    let randomMax = (parseInt(timesInterval) + 2) * 1000;
    let delayTime = random(randomMin, randomMax);
    sleep(delayTime);
}
/**
 * 按照指定概率随机上滑
 * @param {*} startX 
 * @param {*} startY 
 * @param {*} endX 
 * @param {*} endY 
 * @param {*} pressTime 
 * @param {*} probability 
 */
function randomUpSildeScreen(startX, startY, endX, endY, pressTime, probability) {
    let randomIndex = random(1, parseInt(probability));
    if (randomIndex == 1) {
        swipe(startX, startY, endX, endY, pressTime);
        delayTime = random(12000, 15000);
        sleep(delayTime);
    }
}
/**
 * 连续下滑对上一个无兴趣
 * 其实得和上滑做个排他,既然无兴趣不要在上滑
 */
function randomDownSildeScreen(startX, startY, endX, endY, pressTime, timesInterval, probability) {
    let randomIndex = random(1, parseInt(probability));
    if (randomIndex == 1) {
        swipe(startX, startY, endX, endY, pressTime);
        sleep(3500);
        swipe(startX, startY, endX, endY, pressTime);
        sleep(timesInterval);
    }
}
/**
 * 随机点赞
 * @param {点赞ID}} view_id 
 */
function randomHeart(view_id, probability) {
    index = random(1, parseInt(probability));
    if (index == 1) {
        var target = id(view_id).findOnce();
        if (target == null) {
            doubleClick() //双击加关注
            return;
        } else {
            target.click();
        }
    }
}
/**
 * 随机关注
 * @param {控件ID} follow_view_id 
 * @param {概率} probability 
 */
function randomFollow(follow_view_id, probability) {
    index = random(1, parseInt(probability));
    if (index == 1) {
        var target = id(follow_view_id).findOnce();
        if (target == null) {
            return;
        } else {
            target.click();
            sleep(1000);
        }
    }
}
/**
 * 双击屏幕(很多视频其实就是点赞)
 */
function doubleClick() {
    //增加个随机概念 最多敲击三次
    click(200, 200)
    sleep(100)
    click(202, 210)
}
/**
 * 记录App一次运行的时间
 * @param {appName} appName 
 * @param {本次运行时间} recordTimes 
 */
function appRunTimeRecord(appName, recordTimes) {
    let key = appName + storageSign + getDate();
    var havedRunTimes = yadinghaoStorages.get("" + key + "");
    let value = "";
    if (havedRunTimes == null) {
        yadinghaoStorages.put(key, parseInt(recordTimes));
    } else {
        value = parseInt(havedRunTimes) + parseInt(recordTimes);
        yadinghaoStorages.put(key, value);
    }
}
/**
 * 获取当前时间格式yyyyMMdd
 */
function getDate() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    if (month < 10) {
        month = "0" + month;
    };
    var day = date.getDate();
    if (day < 10) {
        day = "0" + day;
    };
    return year + "-" + month + "-" + day;
}
/**
 * 
 */
function getTime() {
    var date = new Date();
    var year = date.getFullYear();
    var month = date.getMonth() + 1;
    if (month < 10) {
        month = "0" + month;
    };
    var day = date.getDate();
    if (day < 10) {
        day = "0" + day;
    };
    var hour = date.getHours();
    if (hour < 10) {
        hour = "0" + hour;
    };
    var minute = date.getMinutes();
    if (minute < 10) {
        minute = "0" + minute;
    };
    var seconds = date.getSeconds();     //获取当前秒数(0-59)
    var millisecond = date.getMilliseconds();    //获取当前毫秒数(0-999)
    return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + seconds + ":" + millisecond;
}
/**
 * 青少年窗口
 */
function adolescentWindows() {
    if (text("我知道了").exists()) {
        text("我知道了").findOnce().click();
    }
    if (text("知道了").exists()) {
        text("知道了").findOnce().click();
    }
    if (text("同意").exists()) {
        clickControlBounds(text("同意"));
    }
}
/**
 * 升级窗口
 */
function closeUpgradetWindows() {
    clickControlBounds(text("以后再说"))
    clickControlBounds(text("直接无视"))
    clickControl(text("我在想想"))
    clickControl(text("稍候再说"))
    clickControl(text("以后"))
    clickControl(text("以后更新"))
    clickControl(text("回头再说"))
    clickControl(text("回头在说"))
    clickControl(text("先去看看"))
    clickControl(text("先去逛逛"))
    clickControl(text("以后再说"))
    clickControl(text("忽略该版本"))
    clickControl(text("游客逛逛"))
    clickControl(text("暂不更新"))
}
/**
 * 倒计时方法适用于脚本
 * @param {倒计时时间} lasterTime 
 */
function cutDownBySleep(lasterTime, message) {
    message = message || ""
    for (let i = lasterTime; i => 0; i--) {
        console.info(message + "剩余" + i + "秒...")
        sleep(1000)
        if (i == 1) {
            return
        }
    }
}
/**
 * 休眠随机0.1秒至0.5秒
 */
function sleepRandom0() {
    sleep(random(100, 500));
}
/**
 * 休眠随机1秒至3秒
 */
function sleepRandom1() {
    sleep(random(1000, 3000));
}
/**
 * 休眠随机3秒至5秒
 */
function sleepRandom3() {
    sleep(random(3000, 5000));
}
/**
 * 休眠随机5秒至7秒
 */
function sleepRandom5() {
    sleep(random(5000, 7000));
}
/**
 * 休眠随机7秒至9秒
 */
function sleepRandom7() {
    sleep(random(7000, 9000));
}
/**
 * 休眠随机11秒至9秒
 */
function sleepRandom9() {
    sleep(random(9000, 11000));
}
/**
 * 点击屏幕上的坐标
 * @param {坐标} b 
 */
function clickBounds(b) {
    return clickResult = click(b.centerX(), b.centerY());
}
/**
 * 点击屏幕上的坐标
 * @param {坐标} b 
 */
function clickControlBounds(element) {
    let clickResult = false;
    if (element == null) {
        return false;
    }
    try {
        if (element.exists()) {
            toastLog("准备click:" + element);
            let b = element.findOnce().bounds();
            clickResult = click(b.centerX(), b.centerY());
            sleep(random(2000, 3200));
        } else {
        }
        return clickResult;
    } catch (error) {
        toastError("clickControlBounds方法出现错误:" + error)
        return false;
    }
}
/**
 * 点击UI上的控件
 * @param {UI上的元素} element 
 */
function clickControl(element) {
    let clickResult = false;
    if (element == null) {
        return false;
    }
    try {
        if (element.exists()) {
            toastLog("准备click:" + element);
            let b = element.findOnce().bounds();
            clickResult = click(b.centerX(), b.centerY());
            sleep(random(2000, 3200));
        } else {
        }
        return clickResult;
    } catch (error) {
        toastError("clickControlBounds方法出现错误:" + error)
        return false;
    }
}
/**
 * 记录App签到时间
 * @param {App名称} appName 
 */
function recordSignTime(appName) {
    let key = appName + storageSign;
    let value = getDate();
    yadinghaoStorages.put(key, value);
}
/**
 * 记录App签到时间
 * @param {App名称} appName 
 */
 function getSignTime(appName) {
    let key = appName + storageSign;
    let value = yadinghaoStorages.get(key);
    return value;
}
//#endregion

上面是完整代码不过要运行得依赖图片因此大家下载项目能更好点。

三、核心技术

此次用的是autojsPro7 主要使用了找图功能。友情提醒autojs4支持找图但是会宕掉,而autojsPro8不支持快手无法进行元素分析。

  • 机型选择

我开发采用的是OppoR9SK 分辨率是1920*1080的。所以大家尽量和我机器一样,如果不一样分辨率一样也行,实在不一样就自己截图替换一下图片就行了。

我封装了几个NB的找图方法还算NBA大家可以看看。

http://www.yadinghao.com/article/details/202108190001

主要是有自媒体和自动化的东西总有一个是你喜欢的。

目录
相关文章
|
3月前
|
编解码 Android开发
分享电音极速版助手APK和源代码
分享电音极速版助手APK和源代码
42 0
|
XML Java 数据安全/隐私保护
反编译APK获取代码&资源
"反编译Apk",看上去好像好像很高端的样子,其实不然,就是通过某些反编译软件,对我们的APK进行反编译,从而获取程序的源代码,图片,XML资源等文件;不知道你有没有这样做过,看到一个别人的一个APP界面做得很精美,或者你看上别人的图片素材,简单点的,我们可以下载别人的APK,然后改下后缀名,改成xxx.zip,然后解压。
209 0
|
安全 Java Android开发
安卓APK及framework代码反编译过程
本文仅是实验使用,并不支持商业用途! 最近想做一下反编译。
145 0
|
XML IDE 开发工具
安卓减小apk的体积,整体优化代码
安卓减小apk的体积,整体优化代码
198 0
安卓减小apk的体积,整体优化代码
|
缓存 数据库 Android开发
【Android 逆向】APK 文件格式 ( Android 应用安装 | Zip 文件格式 | 使用 Python 代码提取 APK 文件 )
【Android 逆向】APK 文件格式 ( Android 应用安装 | Zip 文件格式 | 使用 Python 代码提取 APK 文件 )
541 1
【Android 逆向】APK 文件格式 ( Android 应用安装 | Zip 文件格式 | 使用 Python 代码提取 APK 文件 )
|
Android开发
【Android 插件化】VirtualApp 接入 ( 安装 APK 插件应用 | 启动插件 APK 应用 | MainActivity 安装启动插件完整代码 )
【Android 插件化】VirtualApp 接入 ( 安装 APK 插件应用 | 启动插件 APK 应用 | MainActivity 安装启动插件完整代码 )
387 0
|
安全 Java 数据安全/隐私保护
【Android 安全】DEX 加密 ( Java 工具开发 | 解压 apk 文件 | 加密生成 dex 文件 | 打包未签名 apk 文件 | 文件解压缩相关代码 )(一)
【Android 安全】DEX 加密 ( Java 工具开发 | 解压 apk 文件 | 加密生成 dex 文件 | 打包未签名 apk 文件 | 文件解压缩相关代码 )(一)
200 0
【Android 安全】DEX 加密 ( Java 工具开发 | 解压 apk 文件 | 加密生成 dex 文件 | 打包未签名 apk 文件 | 文件解压缩相关代码 )(一)
|
安全 算法 Java
【Android 安全】DEX 加密 ( Java 工具开发 | 解压 apk 文件 | 加密生成 dex 文件 | 打包未签名 apk 文件 | 文件解压缩相关代码 )(一)
【Android 安全】DEX 加密 ( Java 工具开发 | 解压 apk 文件 | 加密生成 dex 文件 | 打包未签名 apk 文件 | 文件解压缩相关代码 )(一)
211 0
|
Java Linux Android开发
反编译 android apk 文件看看java源代码
1,关于apk 想要做android开发,要做的一个事情就是学习别人的代码。 先研究下别人的代码,看看咋写的有啥漏洞。学开源的项目也行。 开源项目不如真实的项目有代表性。同时开能看看别人的服务器接口是咋设计的。 比如你弄到一个apk文件。 apk首先是一个压缩文件,只要解压缩就好了。 2,解开xxx.apk 假设在服务器上面直接解压缩就行了。 un
11014 0