推荐指数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); } }