auto.js 今日头条刷金脚本

本文介绍如何利用auto.js脚本实现对今日头条应用的自动操作,包括刷金任务等,提升用户效率。


"auto";
launchApp("今日头条极速版");
sleep(1000)
var isEnd=false;
let currentText;
let oldText;
function reBack(){
    back();
}
var thread4 =threads.start(function(){
    log('threads.start4');
    while(true){
        if(text('收藏').exists()||text('分享').exists()||textStartsWith('我的现金').exists()){
            if(text('发布').find().size()<=0){
                reBack();
            }     
        }
    }
    sleep(1000)
}); 
var thread1 =threads.start(function(){
    log('threads.start1');
    while(true){
        let v;
    if(className('android.widget.TextView').depth(13).drawingOrder(6).clickable(false).find().size()>0){
        v=className('android.widget.TextView').depth(13).drawingOrder(6).clickable(false).find();
    }else if(packageName('com.ss.android.article.lite').indexInParent(16).clickable().find().size()>0){
        v=packageName('com.ss.android.article.lite').indexInParent(16).clickable().find();
    }else if(className('android.widget.TextView').depth(17).drawingOrder(6).clickable(false).find().size()>0){
        v=className('android.widget.TextView').depth(17).drawingOrder(6).clickable(false).find();
    }else if(className('android.widget.TextView').depth(11).drawingOrder(6).clickable(false).find().size()>0){
        v=className('android.widget.TextView').depth(11).drawingOrder(6).clickable(false).find();
    }else if(className('android.widget.TextView').depth(12).drawingOrder(6).clickable(false).find().size()>0){
        v=className('android.widget.TextView').depth(12).drawingOrder(6).clickable(false).find();
    }
        if(v&&v.size()>0){
            var e2=v[0];
            currentText=e2.text();
            if(!isEnd&&e2&&e2.text()=='5/5'){
                isEnd=true;
                sleep(1000)
                log('000000000000')
                sleep(500);
                click(e2.bounds().centerX(),e2.bounds().centerY());
            }else if(isEnd&&e2&&e2.text()=='1/5'){
                log('-1-1-1-1-1-1')
                isEnd=false;
            }
        }
    }

});

var thread3 =threads.start(function(){
    log('threads.start3');
    while(true){
        let a=null;
        if(textStartsWith('看视频再领').clickable().find().size()>0){
            log('aaaaaaaaaaa');
            a=textStartsWith('看视频再领').clickable().find();
        }else if(textStartsWith('再看一个').clickable().find().size()>0){
           log('bbbbbbbbbbb');
           a=textStartsWith('再看一个').clickable().find();
            
        }else if(textStartsWith('继续观看').clickable().find().size()>0){
            log('cccccccccc');
            a=textStartsWith('继续观看').clickable().find();
        }
        if(a&&a.size()>0){
            log('a.size():'+a.size());
            click(a[0].bounds().centerX(),a[0].bounds().centerY());      
        }
        sleep(5000);
    }
    
});
var thread2 =threads.start(function(){
    //在新线程执行的代码
    log('threads.start2');
    while(true){
        var b=className('com.lynx.tasm.behavior.ui.text.UIText').textEndsWith('s').find();
            if(b&&b.size()==0){
                var c=className('com.lynx.tasm.behavior.ui.text.UIText').desc('关闭').clickable().find();
                if(c&&c.size()>0){
                    // log(c);
                    log('222222222222')
                    log('c.size():'+c.size());
                    sleep(500);
                    click(c[0].bounds().centerX(),c[0].bounds().centerY());
                    sleep(5000);
                }
            }
            var z=className('com.lynx.tasm.behavior.ui.text.UIText').textEndsWith('s后可领取奖励').find();
        // log('b.size():'+b.size());
            if(z&&z.size()==0){
                var d=className('com.lynx.tasm.ui.image.UIImage').depth(8).indexInParent(18).find();
                
                if(d&&d.size()>0){
                        log('333333333333')
                        log('d.size():'+d.size());
                        sleep(500);
                        click(d[0].bounds().centerX(),d[0].bounds().centerY());
                        sleep(5000);
                }
            }  
    }
});
let count=0;
var t=setInterval(() => {
    log(count);
    if(count>=12){
       var a=textEndsWith('热榜').find()
       if(a&&a.size>0){
        count=0;
        click(a[0].bounds().centerX(),a[0].bounds().centerY());
        sleep(1000);
        reBack();
       }
    }

    if(currentText===oldText){
        count++;
    }else{
        count=0;
        oldText=currentText;
    }
    swipe(400,1500,400,800,1000);  
}, 5000);

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值