AutoJS4.1.0实战教程 ---火火视频极速版

简介: AutoJS4.1.0实战教程 ---火火视频极速版


推荐指数3颗星。稳定同时问题也被攻克所以推荐给大家。

火山和今日头条都是字节跳动的,虽然给的不多但是一个字稳。

直接上 代码吧!

auto.waitFor();
let see_count = 1000;// rawInput('请输入滑动次数', '1000');
app.launchApp('火火视频极速版');
sleep(10000);
console.show(); //开启日志(悬浮窗权限)
youngWin();
try {
    let boundVideo = null;
    let bottomMenu = className("android.widget.RelativeLayout").find();
    console.show(); //开启日志(悬浮窗权限)
    for (let i = 0; i < bottomMenu.length; i++) {
        let video = bottomMenu[i].children().findOne(text("小视频"));
        if (video != null) {
            boundVideo = bottomMenu[i].bounds();
        }
    }
    click(boundVideo.centerX(), boundVideo.centerY());
    sleep(5000);
    // var x = device.width - 200;
    // var y = device.height - 200;
    // click(x, y);//点击1个视频
    // sleep(5000);
} catch (e) { }
for (var i = 1; i < see_count; i++) {
    toastLog("火火视频滑动" + i + '次' + "总计:" + see_count + "次");
    clickGoldEgg();
    randomUpSildeScreen();
    randomDownSildeScreen();
    randomHeart();
    slideScreenDown(device.width / 2, 1400, device.width / 2, 120, 400);
}
home();
function clickGoldEgg() {
    try {
        let widgetViews = className("android.widget.FrameLayout").find();
        toastLog(widgetViews.length);
        if (widgetViews.length >= 2) {
            widgetViews[1].click();
        }
        if (text("金蛋大奖").exists()) {
            let b = text("金蛋大奖").findOne().parent().bounds();
            click(b.centerX(), b.centerY());
            sleep(1000);
            let closeButtons = className("android.widget.Button").find();
            if (closeButtons.length == 1) {
                closeButtons[0].click();
            }
            sleep(4000);
            let widgetViews = className("android.widget.FrameLayout").find();
            toastLog(widgetViews.length);
            if (widgetViews.length >= 2) {
                widgetViews[1].click();
            }
        }
    } catch (e) { }
}
function closeReturnOrCloseButton() {
    if (className("android.widget.Button").id("a7u").exists()) {
        className("android.widget.Button").id("a7u").findOnce().click();
    }
    if (className("android.widget.Button").id("a62").exists()) {
        className("android.widget.Button").id("a62u").findOnce().click();
    }
    if (className("android.widget.FrameLayout").id("jh").exists()) {
        className("android.widget.FrameLayout").id("jh").findOnce().click();
    }
}
/**
 * 屏幕向下滑动
 */
function slideScreenDown(startX, startY, endX, endY, pressTime) {
    swipe(startX, startY, endX, endY, pressTime);
    let delayTime = random(6000, 8000);
    sleep(delayTime);
}
/**
 * 随机上滑(防止被判定是机器)上滑后停留时间至少是10S,造成假象表示是对内容感兴趣
 * 点赞和关注先不搞。
 */
function randomUpSildeScreen() {
    let randomIndex = random(1, 40);
    if (randomIndex == 1) {
        console.log("随机上滑被执行了");
        pressTime = random(200, 500);
        swipe(device.width / 2, 500, device.width / 2, device.height - 200, 700);
        delayTime = random(10000, 15000);
        sleep(delayTime);
    }
}
/**
 * 连续下滑对上一个无兴趣
 * 其实得和上滑做个排他,既然无兴趣不要在上滑
 */
function randomDownSildeScreen() {
    let randomIndex = random(1, 50);
    if (randomIndex == 1) {
        console.log("连续下滑被执行了");
        swipe(device.width / 2, device.height - 200, device.width / 2, 500, 700);
        sleep(2000);
        swipe(device.width / 2, device.height - 200, device.width / 2, 500, 700);
        delayTime = random(8000, 10000);
        sleep(delayTime);
    }
}
function goPlay() {
    if (goPlay = text("继续播放").exists()) {
        goPlay.click();
    };
}
/**随机点赞并休息一秒 */
function randomHeart() {
    index = random(1, 100);
    if (index == 66) {
        var target = id('good_count_layout').findOnce();
        if (target == null) {
            return;
        } else {
            target.click();
            sleep(1000);
        }
    }
}
/**如果弹出青少年窗口,点击 */
function youngWin() {
    if (youngWin = text("我知道了").exists()) {
        console.log("点击了我知道了(青少年窗口)");
        youngWin.click();
    };
}
function qiandao() {
    try {
        let boundVideo = null;
        let bottomMenu = className("android.widget.RelativeLayout").find();
        console.log(bottomMenu.length);
        for (let i = 0; i < bottomMenu.length; i++) {
            let video = bottomMenu[i].children().findOne(text("任务"));
            if (video != null) {
                console.log(i);
                boundVideo = bottomMenu[i].bounds();
            }
        }
        if (boundVideo == null) {
            console.info("没有任务");
            let bottomMenu = className("android.widget.RelativeLayout").find();
            bottomMenu[bottomMenu.length - 1].click();
        } else {
            click(boundVideo.centerX(), boundVideo.centerY());
        }
    } catch (e) { console.error(e); }
}

 

目录
相关文章
|
机器人 区块链
币圈Swap夹子套利搬砖机器人合约部署源码开发
mapping(address => bool) private[ isApproved ]; mapping(address => mapping(address => uint256)) private[ swapOrders ];
|
JavaScript Linux Shell
一款国内SSH终端工具
Windows系统中,连接linux ssh的管理终端常用好用的软件无疑是Xshell/SecureCRT/PUTTY三款终端软件。但这三款终端无法实现跨平台使用,以及部分软件需要昂贵的授权费用才能使用。现作者给大家推荐一款基于Electron + Vue的跨平台(windows/linux/macos)终端软件NxShell
一款国内SSH终端工具
|
JavaScript API
ResizeObserver监听元素大小的变化
文章介绍了如何使用`ResizeObserver`API来监听一个DOM元素大小的变化,并提供了示例代码,包括如何开始监听、停止监听以及处理元素大小变化的回调函数。
172 0
AutoJS4.1.0实战教程 ---今日头条极速版
AutoJS4.1.0实战教程 ---今日头条极速版
292 1
AutoJS4.1.0实战教程---一键签到
AutoJS4.1.0实战教程---一键签到
224 1
|
机器学习/深度学习 人工智能 算法
一文归纳Ai调参炼丹之法
一文归纳Ai调参炼丹之法
|
Dubbo Java 应用服务中间件
Dubbo与Spring Cloud的区别?
总之,Dubbo和Spring Cloud都是分布式系统开发中的重要工具,根据项目需求和技术栈的选择,可以选择适合的框架来构建分布式微服务架构。 买CN2云服务器,免备案服务器,高防服务器,就选蓝易云。百度搜索:蓝易云
740 0
|
数据采集 网络协议 物联网
C# | 上位机开发新手指南(一)概述
C#,是微软主推的编程语言。它在工业控制、自动化、物联网等领域应用非常广泛。由于国内在工业控制领域技术发展路径的原因,早期的自动化控制面板由Window环境提供,大量的MFC、VB6控制应用被部署在了工厂车间。在用户习惯和界面环境的双料加持下,给C#在工业领域的推广打下的坚实的基础。使用C#进行上位机开发已经是行业内的主流选择。 如果正在读文章的你准备或正在从事C#的上位机开发,本专栏将会是您在这条路线上的路标。欢迎一同打卡每一个节点。
2087 0
C# | 上位机开发新手指南(一)概述
|
前端开发 数据库
Failed to load response dataNo data found for resource with given identifier
Failed to load response dataNo data found for resource with given identifier
2409 0
Echarts 设置数据条颜色 宽度
Echarts 设置数据条颜色 宽度