史上最全面得抖音极速版实战代码分享:
1、自动滑动
2、自动签到
3、自动点赞
4、自动评论
5、曲线直线滑动区分
6、自动概率设定
7、滑动次数限制
8、时间间隔限制并随机4S
9、增加各类行日志如toastlError等
10、依据概率随机上滑
11、依据概率随机下滑
12、关闭青少年窗口
13、关闭广告
14、自动清理内存
auto.waitFor();//判断和等待开启无障碍 let see_count = 1000;// rawInput('请输入滑动次数','1000');//手动输入滑动次数默认是1000次。 let appName = "抖音极速版" app.launchApp(appName);//只有一个快手极速版所以直接Launch就可以,不用包名 console.show(); //开启日志(悬浮窗权限) console.info(appName); sleep(12000);//等待splash时间手机不好长点 probability=10;//概率自动点赞、评论、关注的概率 timesInterval=8;//间隔时间 CurveBrushScreen=false;//是否曲线滑动true取消滑动false直线滑动 adolescentWindows();//关闭青少年窗口 douYiSign(appName); for (var i = 1; i < see_count; i++) { toastLog(appName + "滑动" + i + "次" + "总计:" + see_count + "次");//系统自带目前我huweinova不显示还不知道为啥 let x1 = device.width / 2; let y1 = device.height - (device.height * 0.2) let x2 = device.width / 2; let y2 = device.height * 0.1 let pressTime = 300; douYinCloseFriendTip(); douYinAutoComment(parseInt(probability)); douYinRandomHeart(probability);//随机关注百分之一的概率 douYinRandomFollow(probability);//随机关注百分之一的概率 randomUpSildeScreen(x1, y2, x1, y1, pressTime, probability); randomDownSildeScreen(x1, y1, x2, y2, pressTime, timesInterval, probability); slideScreenDown(x1, y1, x2, y2, pressTime, timesInterval, CurveBrushScreen); } //关闭当前程序 home();//回到首页 var CommentKeyWord = [ '我是App小助手关注了你你要关注我哦!', '山高路远坑深,大军纵横驰奔,谁敢横刀立马?惟有点赞加关注大军!', '我的未来不是梦我相信你也是!', '身同感受', '风雨送春归,飞雪迎春到。', '俏也不争春,只把春来报。', '天若有情天亦老...', '...人间正道是沧桑', '...喜欢的人喜欢的事亦不能表达喜欢的心...', '三分春色二分愁,更一分风雨', ]; /** * 青少年窗口 */ function adolescentWindows() { if (text("我知道了").exists()) { text("我知道了").findOnce().click(); } if (text("知道了").exists()) { text("知道了").findOnce().click(); } } /** * 关闭好友红包提示 */ function douYinCloseFriendTip() { if (className("android.widget.ImageViewid").id("baq").exists()) { className("android.widget.ImageViewid").id("baq").findOnce().click(); } } /** * 抖音签到 */ function douYiSign(appName) { try { let ImageView = className("android.widget.ImageView").depth(3).find(); if (ImageView.length == 3) { ImageView[0].click(); sleep(3000); swipe(device.width / 2, device.height - 200, device.width / 2, 500, 700); sleep(3000); if (text("明日签到").exists()) { console.log("抖音明日签到"); let b = text("明日签到").findOnce().bounds(); if (click(b.centerX(), b.centerY())) { sleep(1000); back();//返回到视频页面 } else { back();//返回到视频页面 } } if (desc("明日签到").exists()) { console.log("desc抖音明日签到"); let b = desc("明日签到").findOnce().bounds(); if (click(b.centerX(), b.centerY())) { sleep(1000); back();//返回到视频页面 } else { back();//返回到视频页面 } } } sleep(500); } catch (error) { console.error(error); } } /** * 清理缓存 */ function douYinClearAppCache() { if (className("android.widget.TextView").text("我").exists()) { let b = className("android.widget.TextView").text("我").findOnce().bounds(); let clickResult = click(b.centerX(), b.centerY()); sleep(3000); if (clickResult) { if (className("android.widget.ImageView").desc("更多").exists()) { let b = className("android.widget.ImageView").desc("更多").findOnce().bounds(); let clickResult = click(b.centerX(), b.centerY()); if (clickResult) { sleep(5000); if (className("android.widget.TextView").text("设置").exists()) { toastLog("Click设置"); let b = className("android.widget.TextView").text("设置").findOnce().bounds(); click(b.centerX(), b.centerY()); } sleep(3000); swipe(303, 1328, 335, 71, 300); if (className("android.widget.TextView").text("清理缓存").exists()) { let b = className("android.widget.TextView").text("清理缓存").findOnce().bounds(); click(b.centerX(), b.centerY()); } sleep(3000); if (className("android.widget.TextView").text("清理").exists()) { let b = className("android.widget.TextView").text("清理").findOnce().bounds(); let result = click(b.centerX(), b.centerY()); if (result) { toastLog("清理成功"); if (className("android.widget.ImageView").exists()) { className("android.widget.ImageView").findOnce().click(); } else { back(); } } } } } } else { toastLog("点击我的失败"); } } } /** * 自动评论 * 这个费劲 * 1、首先回答按钮不好点击,用ID经常找不到(所以采用遍历的方法) * 2、答复框点击不上因为Autojs分析的一团乱根本点不上输入库的区域,只能在周围做文章,以为@和表情的父亲是输入框结果也不行。 * 后来发现点击表情也弹出评论输入框,就是多了表情,于是乎赋值。赋值直接setText也不行,最后加了个顺序号解决。 * 3、目前用的是提交按钮的ID,这个ID可能是个坑。 */ function douYinAutoComment(probability) { try { let randomIndex = random(1, parseInt(probability)); if (randomIndex == 1) { let comment = CommentKeyWord[Math.floor(Math.random() * CommentKeyWord.length)]; if (className("android.widget.FrameLayout").id("pn").exists()) { let clickResult = className("android.widget.FrameLayout").id("pn").findOnce().click(); if (clickResult) { sleep(3000); if (className("android.widget.ImageView").desc("表情").exists()) { let b = className("android.widget.ImageView").desc("表情").findOnce().bounds();//获取评论按钮的rect if (click(b.centerX(), b.centerY())) { sleep(1000); setText(0, comment); if (className("android.widget.ImageView").id("q1").exists()) { className("android.widget.ImageView").id("q1").findOnce().click(); 3 } back(); sleep(1000); } } } } } } catch (error) { console.error(error); } } function douYinRandomHeart(probability) { index = random(1, parseInt(probability)); if (index == 1) { let frameLayouts = className("android.widget.FrameLayout").depth(7).selected(false).clickable(true).find(); toastLog("FrameLayout" + frameLayouts.length); if (frameLayouts.length == 9) { frameLayouts[frameLayouts.length - 6].click(); } } } function douYinRandomFollow(probability) { try { index = random(1, parseInt(probability)); if (index == 1) { let followMes = className("android.widget.Button").desc("关注").find(); if (followMes.length > 0) { followMes[followMes.length - 1].click(); } } } catch (error) { console.error(error); } } function autoCashOut() { if (className("android.view.View").text("元").exists()) { toastLog("现金收益"); let b = className("android.view.View").text("元").findOne().parent().bounds(); let clickResult = click(b.centerX(), b.centerY()); sleep(3000); if (clickResult) { if (className("android.view.View").text("去提现").exists()) { let b = className("android.view.View").text("去提现").findOne().bounds(); let clickResult = click(b.centerX(), b.centerY()); sleep(3000); if (clickResult) { if (className("android.view.View").text("提现30.00元").exists()) { toastLog("提现30"); let b = className("android.view.View").text("提现30.00元").findOnce().parent().bounds(); let clickResult = click(b.centerX(), b.centerY()); if (clickResult) { if (text("立即提现").exists()) { toastLog("立即提现"); let clickResult = text("立即提现").findOnce().click(); toastLog(clickResult); } } } } } } } } /** * 贝塞尔曲线 * @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); } } /** * 输出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) }
测试机型华为Mate10和华为荣耀V8.
郑重声明技术交流,脚本如何使用本人概不负责。
另外AutoJs脚本不兼容所有机型,不兼容的别在评论区和私信里面说我是骗子,希望各位道友成熟点。