94的下载地址:http://116.206.92.30/h8/pageController.do?goRegister&key=375010426918
其实94自己在点赞和关注上已经做的很好了,我们也不需要做太多工作,我主要是集成在亚丁号上了。集成的时候为了保障完全自动化就自动点击开启按钮,在开启之前进行了无障碍的开启,这个比较困难,不同的机型需要兼容同时在最后一步点击开启的时候也是怪事点不控件,控件ID明明是存在的可就是点不上。既然点不上就曲线救国.......不废话直接代码
auto.waitFor();//判断和等待开启无障碍 auto.waitFor();//判断和等待开启无障碍 let see_count = 1000;// rawInput('请输入滑动次数','1000');//手动输入滑动次数默认是1000次。 let appName = "94新" app.launchApp(appName);//只有一个快手极速版所以直接Launch就可以,不用包名 console.info(appName); probability=10;//概率自动点赞、评论、关注的概率 CurveBrushScreen=false;//是否曲线滑动true取消滑动false直线滑动 sleep(4000);//等待splash时间手机不好长点 adolescentWindows();//关闭青少年窗口 sleepRandom1() if(!text("运行 音量上/下键停止脚本").exists()){ back() sleepRandom1() } if(text("无障碍服务 关闭").exists()){ toastInfo("关闭") if(clickControlBounds(text("无障碍服务 关闭"))){ let executeResult= findAccessibilityService() if(!executeResult){ let findIndex=1; while(true){ if(findIndex==5){ break } swipeDown() sleepRandom1() let executeResult= findAccessibilityService() if(executeResult){ break } findIndex=findIndex+1; } } }else{ toastWarn("点击失败") } } clickControlBounds(text("运行 音量上/下键停止脚本")) clickControlBounds(text("立即开始")) clickControlBounds(text("允许")) console.show(); //开启日志(悬浮窗权限)d function findAccessibilityService(){ if(text("94新").exists()){ if(clickControlBounds(text("94新"))){ sleepRandom1() let checkBox=className("android.widget.CheckBox"); if(checkBox!=null){ toastLog("存在checkbox") clickControlList(className("android.widget.CheckBox"),0) } let switchBox=className("android.widget.Switch"); if(switchBox!=null){ toastLog("存在Switch") clickControlList(className("android.widget.Switch"),0) } sleepRandom3() clickControlBounds(text("确定")) app.launchApp(appName);//只有一个快手极速版所以直接Launch就可以,不用包名 sleepRandom1() if(!text("运行 音量上/下键停止脚本").exists()){ back() sleepRandom1() } return true; }else{ return false; } }else{ return false; } } /** * 显示控件的坐标 * @param {要查找的元素} element * @index {点击的顺序} index */ function clickControlList(element, index) { try { let controlArray = element.find(); if (controlArray != null) { let controlLength = controlArray.length; for (let i = 0; i < controlLength; i++) { toastLog(controlArray[i].bounds()) } let b = controlArray[index].bounds() return clickBounds(b) } else { return false } } catch (error) { return false } } 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, 600); sleep(3000); } function keepBrush(){ if(!text("视频").exists()){ clickVideoMenu() } if(text("金币收益").exists()){ clickVideoMenu() } } function clickVideoMenu(){ if(textContains("人在看").exists()){ let b=textContains("人在看").findOnce().parent().bounds() clickBounds(b) }else{ clickScreen() } } function clickRedFloat(){ if(id("iv_red_packet_open").exists()){ if(clickControlBounds(id("iv_red_packet_open"))){ sleep(30000) if(clickControlBounds(id("tt_video_ad_close_layout"))){ }else{ back() } sleepRandom3() clickControlBounds(id("iv_award_dialog_close")) } } } function clickCoin() { try { if(text("可领奖").exists()){ if(clickControlBounds(text("可领奖"))){ sleepRandom3() if(clickControlBounds(text("观看视频再领500金币"))){ sleep(30000) if(clickControlBounds(id("tt_video_ad_close_layout"))){ }else{ back() } sleepRandom3() clickControlBounds(id("iv_award_dialog_close")) } } } } catch (error) { toastError(error) } } function closeAD(){ clickControl(id("ares_iv_video_reward_double_close")); clickControl(id("ares_iv_video_reward_egg_close")); } function autoCashOut() { try { if(clickControl(text("我的"))){ if(clickControl(text("提现兑换"))){ if(clickControl(text("立即提现"))){ sleep(random(3000,5000)); } } } } catch (error) { toastError(error); } } function autoSign(){ if(clickControl(text("赚金币"))){ sleep(4000) clickControl(text("立即签到")) clickControl(id("img_close")) } clickControl(id("img_close")) clickVideoMenu() } function autoClearCache(){ try { if(clickControl(text("福利"))){ if(clickControl(id("ares_right"))){ if(clickControl(text("清除缓存"))){ if(text("cw_setting_back_iv").exists()){ if(clickControlBounds(text("cw_setting_back_iv"))){}else{ back() } } } } } clickVideoMenu() } catch (error) { toastError("清理缓存出现错误"+error); } } //id = txt_coin_close /** * 点击屏幕上的坐标 * @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; try { if (element.exists()) { toastLog("准备click:"+element.findOnce().getText()); let clickable=element.findOnce().clickable();//是否可以点击 if(clickable){ clickResult=element.findOnce().click(); sleep(random(1000,1200)); }else{ let b = element.findOnce().bounds(); clickResult=click(b.centerX(),b.centerY()); sleep(random(1000,1200)); } } return clickResult; } catch (error) { toastError(error) return false; } } /** * 元素对象 * @param {ID或name} obj */ function uiSelector(obj){ let element=null; try { if(text(""+obj+"").exists()){ element=text(""+obj+""); return element; } if(desc(""+obj+"").exists()){ element=desc(""+obj+""); return element; } if(id(""+obj+"").exists()){ element=id(""+obj+""); return element; } } catch (error) { return null; } } /** * 随机点赞 * @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) { return; } else { target.click(); sleep(1000); } } } /** * 随机关注 * @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 clickCancle(){ if(text("取消").exists()){ text("取消").findOnce().click(); } } /** * 青少年窗口 */ function adolescentWindows() { if (text("我知道了").exists()) { text("我知道了").findOnce().click(); } if (text("知道了").exists()) { text("知道了").findOnce().click(); } } /** * 直接无视 */ function closeUpgrageTip() { if (text("直接无视").exists()) { text("直接无视").findOnce().click(); } if (text("刷新重试").exists()) { text("刷新重试").findOnce().click(); } } /**随机点赞并休息一秒 */ function randomHeart() { index = random(1, 10); if (index == 1) { var target = id('ic_like').findOnce(); if (target == null) { return; } else { target.click(); sleep(1000); } } } /** * 贝塞尔曲线 * @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); } function curveDown(qx, qy, zx, zy, time,timesInterval){ toastInfo("曲线滑动"); 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); } /** * 屏幕向下滑动并延迟8至12秒 */ function lineDown(startX, startY, endX, endY, pressTime, timesInterval) { toastInfo("屏幕向下滑动"); 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(2000); swipe(startX, startY, endX, endY, pressTime); sleep(timesInterval); } } /** *点击一下屏幕 */ function clickScreen() { var x = device.width - device.width * 0.2; var y = device.height - device.height * 0.2; toastLog("点击屏幕" + x + ":" + y); let clickResult = click(x, y); toastLog(clickResult);} /** * 输出Tosat和Info日志 * @param {日志消息} messagge */ function toastInfo(message) { toast(message) console.info(message) } /** * 输出Tosat和Error日志 * @param {日志消息} messagge */ function toastError(message) { toast(message) console.error(message) } function toastLog(message) { toast(message) console.log(message) } function toastWarn(message) { toast(message) console.warn(message) } /** * 休眠随机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)); }
代码我自己做点公用方法,在下面都有复制过去可以直接使用