AutoJS4.1.0 combat tutorial --- Today's headlines Extreme Edition

Today's headlines are mainly to do the task, the task is fixed daily news reading, reading novels, as well as the search key and other games and other tasks. I am here is to achieve a 3 to read the news, reading novels, retrieve the key. Code is nothing more difficult is that sometimes fail. Also brush personally do not recommend this, unless did not have fooled. I 16 000 gold conversion 0.5RMB. People speechless ......

In addition you have to pay attention to what tab tab to configure today's headlines. Historically, advertising columns is relatively small, the probability of failure is very low, another column is not very good.

auto.waitFor();
app.launchApp('今日头条极速版');
sleep(10000);
if (id("f2").exists()) {
    back();
    id("f2").findOnce().click();
}
/**
 * 今日头条读新闻
 */
for (var i = 1; i <= 15; i++) {
    sleep(3000);//保障一下
    jinRiTouTiaoClickReturnButton();
    toast("今日头条极速版读新闻第" + i + "次");
    if (className("android.widget.TextView").text("历史").exists()) {
        let tabMenu = className("android.widget.TextView").text("历史").findOnce();//推荐里面容易有广告
        click(tabMenu.bounds().centerX(), tabMenu.bounds().centerY());//进入到栏目
        sleep(6000);//保障一下
        let news = id("bz").findOnce();//第二条新闻
        if (news != null) {
            click(news.bounds().centerX(), news.bounds().centerY());//点击第二条新闻
            for (var x = 1; x <= 30; x++) {
                toast("今日头条极速版读新闻第" + i + "次" + "滑动第" + x + "次");
                swipe(303, 1000, 335, 50, 500);
                sleep(1500);
            }
        }
        jinRiTouTiaoClickReturnButton();
    }
}
sleep(1000);//歇一会
/**
 * 今日头条读小说
 */
if (className("android.widget.TextView").text("小说").exists()) {
    let storyMenu = className("android.widget.TextView").text("小说").findOnce();
    click(storyMenu.bounds().centerX(), storyMenu.bounds().centerY());
    sleep(6000);
    if (className("android.view.View").text("更多").depth(9).exists()) {
        className("android.view.View").text("更多").depth(9).findOnce().click();
    }
    sleep(4000);
    let views = className("android.view.View").depth(9).find();
    if (views.length > 0) {
        let book = views[views.length - 2].bounds();
        click(book.centerX(), book.centerY());
        //权且算20片是一章
        for (let i = 1; i <= 400; i++) {
            toast("今日头条极速版小说滑动" + i + "次");//这个有点难 一章才给50金币 多少片算一章这个不知道啊
            swipe(750, 1000, 100, 1000, 500);
            sleep(1000);//加速阅读1S读一篇
            if (className("android.view.View").text("恭喜获得50金币").exists()) {
                let viewViews = className("android.view.View").find();
                viewViews[viewViews.length - 1].click();
            }
        }
        back();
        sleep(2200);
        back();
        if (id("a_8").exists()) {
        }
    }
}
sleep(1000);//歇一会

/**
 * 今日头条检索关键字
 */
var searchKeyWord = [
    'AutoJs教程',
    'RNN',
    'CNN',
    'HMM',
    'LSTM',
    '人工智能的出路',
    'Java的出路',
    'AI的出路',
    'DOTNET未来',
    'C#的出路',
    'Android教程',
    'IOS教程',
    'MAC教程',
    'XCODE教程',
    'IOS还有未来吗',
    'uniapp教程',
    '编辑距离',
    '欧式距离',
    '隐马尔可夫链',
    '云计算',
    '云存储',
    'Iaas',
    'AI',
    'AI和教育',
];
let searchInput = id('at5').findOnce();
if (searchInput != null) {
    searchInput.click(); //点击输入框
}
for (i = 0; i < 5; i++) {
    let inputSearchButton = id('gj').findOne();
    if (inputSearchButton != null) {
        let keyWord = searchKeyWord[Math.floor(Math.random() * searchKeyWord.length)];
        setText(keyWord)
        inputSearchButton.click();
        sleep(3000);
    }
}
sleep(1000);//歇一会
back();//返回到搜索页面
sleep(2200);
back();//返回到首页为下一个任务准备
sleep(2200);
home();//返回到首页
exit();

function jinRiTouTiaoClickReturnButton(){
    let back = className("android.widget.ImageView").id("kx");
        if (back.exists()) {
            let b = back.findOnce().bounds();
            click(b.centerX(), b.centerY());//点击返回按钮,这个是点击屏幕
        }
}

 

Published 41 original articles · won praise 9 · views 8497

Guess you like

Origin blog.csdn.net/zy0412326/article/details/105011375