通过代码实现网购某东的看一看自动领京豆脚本破解。
使用说明
- 京东版本:V9.3.4
- 系统要求:Android 7.0及以上
- 安装Auto.js 并导入js脚本
- 开启无障碍服务并授权给Auto.js后,点击运行脚本即可
- 脚本执行过程中请勿手动点击屏幕,否则脚本执行可能会错乱,导致任务失败
- 在Auto.js App中提前设置音量上键停止所有脚本,以便脚本运行出错时可按音量+键终止
运行实测

脚本源代码:
/*** 淘宝京东双十二活动脚本** Author: YBQ789* Date: 2020/12/31* Versions: 1.0.0* Github: https://github.com/YBQ789/taobao-1212*///全局参数h=device.height;w=device.width;//无障碍判定try {auto();} catch (error) {toast("请手动开启无障碍并授权给Auto.js");sleep(2000);exit();}launchApp("京东");toastLog("等待界面加载完成");sleep(3000);text("领京豆").waitFor();sleep(1500);clickButton(className("android.widget.FrameLayout").depth(7).drawingOrder(3).findOne());text("看一看").waitFor();sleep(2500);clickButton(text("看一看").findOne());sleep(4000);var n = className("android.widget.ImageView").boundsInside(0,h/4,w,h).indexInParent(0).depth(15).clickable(true).findOnce();if(n!=null){clickButton(n);textContains("/40").waitFor();num = textContains("/40").findOne().text().split("/")[0].split("(")[1];if(num==40){try{var taskBtn = text("浏览精选内容").findOnce().parent().child(4);clickButton(taskBtn);}catch(err){toastLog("已经领取过了")}finally{toastLog("任务已完成,退出脚本");exit();}}else{var taskBtn = text("浏览精选内容").findOnce().parent().child(4);clickButton(taskBtn);sleep(4000);}}else{toastLog("任务按钮不存在,退出脚本");exit();}//上边框var t = text("看一看").findOne().parent().bounds().bottom;log("上边框"+t);//下边框var b = className("android.widget.FrameLayout").depth(7).drawingOrder(3).findOne().bounds().top-20;log("下边框"+b);var i = 1;while(true){if(className("android.widget.TextView").drawingOrder(2).depth(19).indexInParent(1).boundsInside(0,t,w,b).findOnce(i)!=null){var video = className("android.widget.TextView").drawingOrder(2).depth(19).indexInParent(1).boundsInside(0,t,w,b).findOnce(i);clickButton(video);sleep(2000);if(textContains("领京豆").exists()){textContains("/40").waitFor();sleep(500);num++;toastLog("看完第"+num+"个视频");back();}else{back();}if(num<40){sleep(2000);i++;}else{sleep(2000)getJD();}}else{i = 1;scrollDown();sleep(2000);}}/*** 坐标点击*/function clickButton(button){var l = button.bounds().left;var t = button.bounds().top;var r = button.bounds().right;var b = button.bounds().bottomvar x = (r-l)/2+l;var y = (b-t)/2+t;click(x,y);}/*** 领京豆*/function getJD(){var m = className("android.widget.ImageView").boundsInside(0,h/4,w,h).indexInParent(0).depth(15).clickable(true).findOnce();if(m!=null){clickButton(m);textContains("/40").waitFor();num = textContains("/40").findOne().text().split("/")[0].split("(")[1];if(num==40){var taskBtn = text("浏览精选内容").findOnce().parent().child(4);clickButton(taskBtn);toastLog("任务已完成,退出脚本");exit();}else{click(w/2,h/2);toastLog("继续任务");}}else{toastLog("任务按钮不存在,退出脚本");exit();}};/** * 淘宝京东双十二活动脚本 * * Author: YBQ789 * Date: 2020/12/31 * Versions: 1.0.0 * Github: https://github.com/YBQ789/taobao-1212 */ //全局参数 h=device.height; w=device.width; //无障碍判定 try { auto(); } catch (error) { toast("请手动开启无障碍并授权给Auto.js"); sleep(2000); exit(); } launchApp("京东"); toastLog("等待界面加载完成"); sleep(3000); text("领京豆").waitFor(); sleep(1500); clickButton(className("android.widget.FrameLayout").depth(7).drawingOrder(3).findOne()); text("看一看").waitFor(); sleep(2500); clickButton(text("看一看").findOne()); sleep(4000); var n = className("android.widget.ImageView").boundsInside(0,h/4,w,h).indexInParent(0).depth(15).clickable(true).findOnce(); if(n!=null){ clickButton(n); textContains("/40").waitFor(); num = textContains("/40").findOne().text().split("/")[0].split("(")[1]; if(num==40){ try{ var taskBtn = text("浏览精选内容").findOnce().parent().child(4); clickButton(taskBtn); }catch(err){ toastLog("已经领取过了") }finally{ toastLog("任务已完成,退出脚本"); exit(); } }else{ var taskBtn = text("浏览精选内容").findOnce().parent().child(4); clickButton(taskBtn); sleep(4000); } }else{ toastLog("任务按钮不存在,退出脚本"); exit(); } //上边框 var t = text("看一看").findOne().parent().bounds().bottom; log("上边框"+t); //下边框 var b = className("android.widget.FrameLayout").depth(7).drawingOrder(3).findOne().bounds().top-20; log("下边框"+b); var i = 1; while(true){ if(className("android.widget.TextView").drawingOrder(2).depth(19).indexInParent(1).boundsInside(0,t,w,b).findOnce(i)!=null){ var video = className("android.widget.TextView").drawingOrder(2).depth(19).indexInParent(1).boundsInside(0,t,w,b).findOnce(i); clickButton(video); sleep(2000); if(textContains("领京豆").exists()){ textContains("/40").waitFor(); sleep(500); num++; toastLog("看完第"+num+"个视频"); back(); }else{ back(); } if(num<40){ sleep(2000); i++; }else{ sleep(2000) getJD(); } }else{ i = 1; scrollDown(); sleep(2000); } } /** * 坐标点击 */ function clickButton(button){ var l = button.bounds().left; var t = button.bounds().top; var r = button.bounds().right; var b = button.bounds().bottom var x = (r-l)/2+l; var y = (b-t)/2+t; click(x,y); } /** * 领京豆 */ function getJD(){ var m = className("android.widget.ImageView").boundsInside(0,h/4,w,h).indexInParent(0).depth(15).clickable(true).findOnce(); if(m!=null){ clickButton(m); textContains("/40").waitFor(); num = textContains("/40").findOne().text().split("/")[0].split("(")[1]; if(num==40){ var taskBtn = text("浏览精选内容").findOnce().parent().child(4); clickButton(taskBtn); toastLog("任务已完成,退出脚本"); exit(); }else{ click(w/2,h/2); toastLog("继续任务"); } }else{ toastLog("任务按钮不存在,退出脚本"); exit(); } };/** * 淘宝京东双十二活动脚本 * * Author: YBQ789 * Date: 2020/12/31 * Versions: 1.0.0 * Github: https://github.com/YBQ789/taobao-1212 */ //全局参数 h=device.height; w=device.width; //无障碍判定 try { auto(); } catch (error) { toast("请手动开启无障碍并授权给Auto.js"); sleep(2000); exit(); } launchApp("京东"); toastLog("等待界面加载完成"); sleep(3000); text("领京豆").waitFor(); sleep(1500); clickButton(className("android.widget.FrameLayout").depth(7).drawingOrder(3).findOne()); text("看一看").waitFor(); sleep(2500); clickButton(text("看一看").findOne()); sleep(4000); var n = className("android.widget.ImageView").boundsInside(0,h/4,w,h).indexInParent(0).depth(15).clickable(true).findOnce(); if(n!=null){ clickButton(n); textContains("/40").waitFor(); num = textContains("/40").findOne().text().split("/")[0].split("(")[1]; if(num==40){ try{ var taskBtn = text("浏览精选内容").findOnce().parent().child(4); clickButton(taskBtn); }catch(err){ toastLog("已经领取过了") }finally{ toastLog("任务已完成,退出脚本"); exit(); } }else{ var taskBtn = text("浏览精选内容").findOnce().parent().child(4); clickButton(taskBtn); sleep(4000); } }else{ toastLog("任务按钮不存在,退出脚本"); exit(); } //上边框 var t = text("看一看").findOne().parent().bounds().bottom; log("上边框"+t); //下边框 var b = className("android.widget.FrameLayout").depth(7).drawingOrder(3).findOne().bounds().top-20; log("下边框"+b); var i = 1; while(true){ if(className("android.widget.TextView").drawingOrder(2).depth(19).indexInParent(1).boundsInside(0,t,w,b).findOnce(i)!=null){ var video = className("android.widget.TextView").drawingOrder(2).depth(19).indexInParent(1).boundsInside(0,t,w,b).findOnce(i); clickButton(video); sleep(2000); if(textContains("领京豆").exists()){ textContains("/40").waitFor(); sleep(500); num++; toastLog("看完第"+num+"个视频"); back(); }else{ back(); } if(num<40){ sleep(2000); i++; }else{ sleep(2000) getJD(); } }else{ i = 1; scrollDown(); sleep(2000); } } /** * 坐标点击 */ function clickButton(button){ var l = button.bounds().left; var t = button.bounds().top; var r = button.bounds().right; var b = button.bounds().bottom var x = (r-l)/2+l; var y = (b-t)/2+t; click(x,y); } /** * 领京豆 */ function getJD(){ var m = className("android.widget.ImageView").boundsInside(0,h/4,w,h).indexInParent(0).depth(15).clickable(true).findOnce(); if(m!=null){ clickButton(m); textContains("/40").waitFor(); num = textContains("/40").findOne().text().split("/")[0].split("(")[1]; if(num==40){ var taskBtn = text("浏览精选内容").findOnce().parent().child(4); clickButton(taskBtn); toastLog("任务已完成,退出脚本"); exit(); }else{ click(w/2,h/2); toastLog("继续任务"); } }else{ toastLog("任务按钮不存在,退出脚本"); exit(); } };
© 版权声明
THE END
暂无评论内容