2020京东618叠蛋糕js脚本(亲测好用)
程序员文章站
2022-03-20 17:48:50
一年一度的618就要到了,购物车已经装满,今年京东618叠蛋糕活动非常吸引人,怎么个玩法呢,大家不妨打开京东尝试下。那么今天小编给大家分享一篇教程关于2020京东618叠蛋糕js脚本的实现代码,刚兴趣...
一年一度的618就要到了,购物车已经装满,今年京东618叠蛋糕活动非常吸引人,怎么个玩法呢,大家不妨打开京东尝试下。那么今天小编给大家分享一篇教程关于2020京东618叠蛋糕js脚本的实现代码,刚兴趣的朋友一起看看吧。
京东618叠蛋糕脚本,亲测好用,auto.js打开
var generalsleep = 2000;//一般任务的浏览时间(非8秒任务) var intervalsleep = 800;//任务间的间隔时间 var checktimes = 2000;//每个任务需要检查有没有跳转成功 var randomval = 500; //随机睡眠的区间跨度,比如generalsleep,则generalsleep随机睡眠为random(generalsleep,generalsleep+randomval) //如果想让上面三个参数不使用随机睡眠,randomval请设置为0 function gettasklist() { 返回任务中心(); var tasklist = textmatches(/.+\([0-9]+\/[0-9]+\).*/).untilfind(); return tasklist; } function getgobutton(task) { var father = task.parent(); if(father == null) return null; father = father.parent(); if(father == null) return null; var selector = text("去完成"); var goon = father.findone(selector); return goon; } function getselectedtask(keywordlist) { var tasklist = gettasklist(),found; for(var i = 0; i < tasklist.length; i ++){ found = true; for(var j = 0; j < keywordlist.length; j ++){ if(tasklist[i].text().indexof(keywordlist[j]) == -1){ found = false; break; } } if(found) return tasklist[i]; } return null; } function 返回() { var goback = clickable(true).desc("返回").findone(1000); goback == null ? back() : goback.click(); } function 返回任务中心() { var 任务中心 ; while(true){ 任务中心 = textcontains("任务每日0点刷新,记得每天都来看看哦~").findone(1000); if(任务中心 != null) break; 返回(); sleep(1000); } } function 逛店铺(秒数) { textmatches(/.+人关注/).waitfor(); var 完成 = textcontains("恭喜完成").findone(秒数*1000); 返回任务中心(); sleep(random(intervalsleep,intervalsleep+randomval)); } function 浏览商品(次数) { var goodslist = textmatches(/¥[0-9]+\.[0-9]+/).untilfind(),cnt = 0,finished = false; for(var i = 0; i < goodslist.length; i ++){ if(cnt >= 次数){ finished = true; break; } if(forceclick(goodslist[i])) { log("准备浏览价格为 %s 的商品",goodslist[i].text()); cnt ++; textmatches(/(?:加入购物车|立即购买|立即抢购|支付定金|购物车|客服)/).waitfor(); sleep(random(1500,2000)); back(); textmatches(/.*浏览.*商品.*/).waitfor(); sleep(random(300,500)); } } sleep(random(500,1000)); 返回任务中心(); sleep(random(intervalsleep,intervalsleep+randomval)); return finished; } function 加购商品() { var goodslist = textmatches(/¥[0-9]+\.[0-9]+/).untilfind(),finished = false,已完成,father,selector; for(var i = 0; i < goodslist.length; i ++){ 已完成 = text("已完成").findonce(); if(已完成!=null) { log("已完成本轮加购"); break; } father = goodslist[i].parent().parent(); selector = clickable(true).filter(function(w){ var b = w.bounds(),b_ = father.bounds(); return math.abs(b.bottom - b_.bottom) <= 150 && math.abs(b.right - b_.right) <= 150 && b.width() <= 150 && b.height() <= 150; }); 加购 = father.findone(selector); if(加购!=null){ 加购.click(); log("正在加购 %s 的商品",goodslist[i].text()); sleep(random(1000,1500)); } } sleep(random(500,1000)); 返回任务中心(); sleep(random(intervalsleep,intervalsleep+randomval)); return finished; } function 浏览任务自动化() { log("准备进行 浏览 任务!!!"); var isrun,tasklist,goon,txt,reg = /(?:浏览8秒|逛8秒|去玩|浏览可得|8秒得)/,恭喜完成,任务首页; while(true){ tasklist = gettasklist(); isrun = false; for(var i = 0; i < tasklist.length; i ++){ txt = tasklist[i].text(); if(reg.test(txt)){ if(txt.indexof("ar") != -1) continue; goon = getgobutton(tasklist[i]); if(goon != null){ log(txt); goon.click(); sleep(checktimes); 任务首页 = textcontains("任务每日0点刷新,记得每天都来看看哦~").findone(200); if(任务首页 == null){ if(txt.indexof("8秒")!= null) { 恭喜完成 = textcontains("恭喜完成").findone(random(12000,15000)); if(恭喜完成 != null){ sleep(random(300,600)); } } else sleep(random(generalsleep,generalsleep+randomval)); 返回任务中心(); sleep(random(intervalsleep,intervalsleep+randomval)); isrun = true; break; } else{ log("任务跳转不成功..."); sleep(500); } } } } if(!isrun) break; } log("浏览 任务完成~~~"); return isrun; } function 任务自动化(keywordlist) { log("准备进行 %s 任务!!!",keywordlist); var task,last_rate=-1,curr_rate,tag_rate,reg_rate = /\([0-9]+\/[0-9]+\)/,reg,arr,sec; var isrun = false,任务首页,maxtrytimes = 10,trytimes = 0,goon,isfail; while(true){ task = getselectedtask(keywordlist); if(task == null) break; arr = task.text().match(reg_rate); arr = tointarr(arr[0]); curr_rate = parseint(arr[0]); tag_rate = parseint(arr[1]); if(curr_rate == tag_rate) break; if(curr_rate != last_rate){ log("当前已完成 %d 次任务,目标是完成 %d 次任务,准备进行下一轮任务",curr_rate,tag_rate); log(task.text()); isfail = false; if(keywordlist[0] == "店铺"){ reg = /[0-9]+秒/; arr = task.text().match(reg); sec = toint(arr[0]); log("逛店铺 %s 秒",sec); goon = getgobutton(task); if(goon != null) goon.click(); sleep(checktimes); 任务首页 = textcontains("任务每日0点刷新,记得每天都来看看哦~").findone(200); if(任务首页 == null){ 逛店铺(sec); } else isfail = true; } else if (keywordlist[0] == "浏览" && keywordlist[1] == "商品") { reg = /[0-9]+个商品/; arr = task.text().match(reg); times = toint(arr[0]); log("本轮需要浏览 %s 个商品",times); goon = getgobutton(task); if(goon != null) goon.click(); sleep(checktimes); 任务首页 = textcontains("任务每日0点刷新,记得每天都来看看哦~").findone(200); if(任务首页 == null){ 浏览商品(times); } else isfail = true; } else if (keywordlist[0] == "加购" && keywordlist[1] == "商品"){ reg = /[0-9]+个商品/; arr = task.text().match(reg); times = toint(arr[0]); log("本轮需要加购 %s 个商品",times); goon = getgobutton(task); if(goon != null) goon.click(); sleep(checktimes); 任务首页 = textcontains("任务每日0点刷新,记得每天都来看看哦~").findone(200); if(任务首页 == null ){ 加购商品(times); } else isfail = true; } if(isfail){ log("任务跳转不成功..."); trytimes++; if(trytimes >= maxtrytimes){ log("超过尝试次数,放弃本轮任务"); break; } sleep(500); } else{ isrun = true; last_rate = curr_rate; trytimes = 0; } sleep(300); } else{ sleep(2000); last_rate = curr_rate - 1; } sleep(300); } log("%s 任务完成~~~",keywordlist); if(isrun) sleep(random(2000,2500)); return isrun; } function clickobj(obj) { if(obj != null && obj != undefined){ if(obj.clickable()){ obj.click(); } else{ click(obj.bounds().centerx(),obj.bounds().centery()); } return true; } return false; } function tointarr(str) { return str.match(/[0-9]+/g); } function toint(str) { var res = str.match(/[0-9]+/g); return parseint(res[0]); } function forceclick(obj) { for(var i = 0 ; i < 8; i ++){ if(obj == null) return false; if(obj.clickable()){ obj.click(); return true; } else obj = obj.parent(); } return false; } function openjd() { app.startactivity({ data: "openapp.jdmobile://virtual?params=%7b%22des%22%3a%22m%22%2c%22url%22%3a%22https%3a%2f%2fbunearth.m.jd.com%2fbabeldiy%2fzeus%2f3xau77dgipodvhdbxuzb95a7u71x%2findex.html%22%2c%22category%22%3a%22jump%22%2c%22sourcetype%22%3a%22jshop_source_type%22%2c%22sourcevalue%22%3a%22jshop_source_value%22%2c%22m_sourcefrom%22%3a%22lkyl%22%2c%22msf_type%22%3a%22click%22%2c%22m_param%22%3a%7b%22m_source%22%3a%220%22%2c%22event_series%22%3a%7b%7d%2c%22jda%22%3a%22177095863.1664140455.1538579865.1572975960.1572979455.472%22%2c%22usc%22%3a%22androidapp%22%2c%22ucp%22%3a%22t_335139774%22%2c%22umd%22%3a%22appshare%22%2c%22utr%22%3a%22copyurl%22%2c%22jdv%22%3a%22177095863%7candroidapp%7ct_335139774%7cappshare%7ccopyurl%7c1572882675599%22%2c%22ref%22%3a%22https%3a%2f%2fbunearth.m.jd.com%2fbabeldiy%2fzeus%2f3xau77dgipodvhdbxuzb95a7u71x%2findex.html%22%2c%22psn%22%3a%221664140455%7c472%22%2c%22psq%22%3a5%2c%22pc_source%22%3a%22%22%2c%22mba_muid%22%3a%221664140455%22%2c%22mba_sid%22%3a%221572979455588510925986537476%22%2c%22std%22%3a%22mo-j2011-1%22%2c%22par%22%3a%22%22%2c%22event_id%22%3a%22mnpm_componentapplied%22%2c%22mt_xid%22%3a%22%22%2c%22mt_subsite%22%3a%22%22%7d%2c%22se%22%3a%7b%22mt_subsite%22%3a%22%22%2c%22__jdv%22%3a%22177095863%7candroidapp%7ct_335139774%7cappshare%7ccopyurl%7c1572882675599%22%2c%22__jda%22%3a%22177095863.1664140455.1538579865.1572975960.1572979455.472%22%7d%7d", }); } function signin() { var 立即签到 = textmatches(/(?:立即签到|签到)/).findone(25*1000); clickobj(立即签到); } function gotohall() { var hall = text("做任务领金币").findone(25*1000); clickobj(hall); } var notifyclose = textcontains("通知权限"); var continuefloaty = text("继续叠蛋糕"); var cakenotify = textcontains("继续叠蛋糕 分红包"); var closelist = [[notifyclose,false],[continuefloaty,true],[cakenotify,true]];//true表示直接点击 function closefloaty() { var i,obj,cancel; while(true){ for(i in closelist){ obj = closelist[i][0].findonce(); if(obj != null){ if(closelist[i][1]){ clickobj(obj); }else{ cancel = textmatches(/(?:取消|关闭)/).findonce(); if(cancel != null){ cancel.click(); } } } } sleep(100); } } // function closehall() // { // sleep(500); // var menu = desc("更多菜单").classname("imageview").clickable(true).findone(); // var 中心 = textcontains("任务每日0点刷新,记得每天都来看看哦~").findone(); // var closebtn = clickable(true).depth(中心.depth()+1).filter(function(w){ // var b = w.bounds(),b_ = menu.bounds(),b__ = 中心.bounds(); // return w.text().length == 0 && b_.left <= b.centerx() && b.centerx() <= b_.right && // b.centery() < b__.top-50 && b.centery() > b_.bottom+50; // }).findone(); // closebtn.click() // } function closehall() { back(); sleep(1500); openjd(); text("做任务领金币").waitfor(); } function collectcoin() { log("开始点击小精灵!!!"); text("做任务领金币").waitfor(); var elf; while(true){ elf = text("点我得金币").findone(3500); if(elf == null) break; // click(elf.bounds().centerx(),elf.bounds().top - 50); forceclick(elf); sleep(random(350,550)); } log("完成小精灵收集金币"); } function makecake() { log("开始自动叠蛋糕!!!"); var make,closebtn,arr,property,need,obj; while(true){ obj = textmatches(/[0-9]+\/[0-9]+/).findone(); arr = tointarr(obj.text()); property = parseint(arr[0]), need = parseint(arr[1]); if(property >= need){ log("当前拥有 %d 个金币,下一层蛋糕需要 %d 个金币,可以继续叠蛋糕",property,need); make = textmatches(/当前金币[0-9]+.*叠蛋糕/).clickable(true).findone(); sleep(200); make.click(); sleep(1500); closebtn = textcontains("继续叠蛋糕 分红包").findone(); sleep(200); closebtn.click(); sleep(1500); } else { log("当前拥有 %d 个金币,下一层蛋糕需要 %d 个金币,已经不能继续叠蛋糕了",property,need); break; } } log("叠蛋糕完成!!!"); } function keylisten() { events.observekey(); events.onkeydown("volume_down", function(event){ exit(); }); } function main() { console.show(); textcontains("任务每日0点刷新,记得每天都来看看哦~").waitfor(); var flag,ret; while(true){ flag = false; ret = 任务自动化(["店铺"]); sleep(500); if(ret) flag = true; ret = 任务自动化(["浏览","商品"]); sleep(500); if(ret) flag = true; ret = 任务自动化(["加购","商品"]); sleep(500); if(ret) flag = true; ret = 浏览任务自动化(); sleep(500); if(ret) flag = true; if(!flag) break; } closehall(); collectcoin(); makecake(); threads.start(function(){ log("所有自动化任务已完成"); alert("所有自动化任务已完成"); }); sleep(500); exit(); } openjd(); threads.start(signin); threads.start(gotohall); threads.start(closefloaty); threads.start(keylisten); main();
总结
到此这篇关于2020京东618叠蛋糕js脚本(亲测好用)的文章就介绍到这了,更多相关京东618叠蛋糕js脚本内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!
上一篇: R语言字符串知识点总结及实例分析