开源顶(ID:开源顶)猿女综合整理
这几天,双十一的活动有没有折腾到你?如果没有,只有两种可能:第一,你没有女朋友;第二,你没有女性朋友,否则你一定会收到下面这条信息。
要知道阿里每年都会发放大量的红包、优惠券和互助游戏.....但是这两天马爸的“ATM”都沉迷在这些互助游戏里,我天天三省:你签到了吗?你完成任务了吗?升级了吗?:
一般我们程序员对这种游戏都不是很感兴趣。毕竟每天都有说不完的bug,上不完的课,但是如果你的女神这个时候找你帮忙,以你的水平能怎么办?
那么,程序员怎么能错过这样一个在女神面前展示自己专业能力的时机呢?这不,今天猿女在GitHub上发现一个程序员写了一个小脚本,可以每天自动做任务,拿到钱。这有助于女神盖楼,再也不用担心水平低了:
可以看出,这个小脚本目前并没有引起程序员的重视,也没有获得一星半点(GitHub地址:https://github.com/sleepybear1113/taobaoVisitingVenues)
其实这个剧本并不难。基于auto.js的框架实现,auto.js是Android平台上支持无障碍服务的JavaScript IDE。基于控件,它可以自动运行一些操作来记录和运行浮动窗口。所以这个脚本只支持Android。
的详细脚本代码如下:
设deviceWidth = device.width
let device height = device . height;
function openbeginningtnitem(delay){
let items = text starts with(" gif;base64”)。深度(19)。find();
console.log ("Find-get喵币");
if(items . length & gt;0){
let item = items[items . length-1];
console.log("点击-获取喵币");
clickItemInCenter(item);
睡眠(延时);
return 1;
}
return-1;
}
函数是open beginning(){
let sign in = text contains(" sign in ")。find once();
if(签到!= null) {
console.log("成功-打开收集中心");
return 1;
}
return-1;
}
function ensureopenbeging(wait delay){
if(isOpenBeginning()= = =-1){
openbeginningtnitem(wait delay);
}
if(isOpenBeginning()= = = 1)返回1;
console.error("失败-打开收集中心");
toast("失败-打开收藏中心");
return-1;
}
函数clickItemInCenter(item,time){
if(time = = null)time = 50;
if(item = = null)return;
设x = item.bounds()。centex();
设y = item.bounds()。centerY();
按(x,y,time);
}
function go shopping(){
let shopping = text(" browse ")。findOne(1000);
if(shopping = = null){
toast log(" end-unknown question ");
return-1;
}
console.log("开始浏览...");
clickItemInCenter(购物);
return 1;
}
function swipeUp(){
let x = parse int(device width/2);
let duration = 500;
设y = [parseInt(deviceHeight * 0.75),parse int(device height * 0.25)];
swipe(x,y[0],x,y[1],时长);
swipe(x,y[0],x,y[1],时长);
}
function is full(){
for(设I = 0;我& lt10;++) {
if (desc包含(“已达到上限”)。findOnce() || textContains("已达到上限")。findOnce()) {
console.log("今日已达到上限");
return 1;
}
睡眠(1000);
}
return 0
}
函数wait swipe(){
let swipe pear;
let shopping full;
for(设I = 0;我& lt3;i++){
swipe apparent = desc(" swipe browsed ")。findOne(1000);
if (swipeAppear!= null)break;
shoppingFull = descContains("已达到上限")。findOne(1000);
if (shoppingFull!= null)返回0;
console . log(" I "+I);
}
睡眠(1000);
if (swipeAppear!= null) {
console.log("开始滑动");
swipeUp();
console.log("等待15s ");
睡眠(1000 * 16);
} else {
console . log(" slow ");
console.log("等待20s ");
睡眠(1000 * 20);
}
让购物完成= desc(“任务完成”)。findOne(2000年);
if (shoppingFinish!= null) {
console.log("购物完毕,准备退货");
} else {
toastLog("未知,返回");
}
return 1;
}
function browse finish(){
for(设I = 0;我& lt10;I+){
let normalfinishdesc = desc包含(“获得”)。find once();
let normalfinishtext = text contains(" obtained ")。find once();
let swipeFinish = desc(“任务完成”)。find once();
if (normalFinishDesc!= null || swipeFinish!= null || normalFinishText!= null) {
console.log("浏览结束");
返回0;
}
睡眠(250);
}
console.log("未知浏览");
return-1;
}
function judgeWay(){
let time out = 1000 * 7;
设延迟= 250;
let loops = parseInt(超时/延迟);
for(设I = 0;我& lt循环;I+){
Let SwipeappeardESC = desc contains(" for sliding browsing ")。find once();
Let Swipeappeartext = text contains("用于滑动浏览")。find once();
if (swipeAppearDesc!= null || swipeAppearText!= null) {
console.log("已获取滑动浏览模式");
返回0;
}
let directbrowsedesc = desc(" browse ")。find once();
let directBrowseText = text(" browse ")。find once();
if (directBrowseDesc!= null || directBrowseText!= null){
if(desc contains(" 00喵币")。findOnce()!= null || textContains("00喵币")。findOnce()!= null) {
console.log("已获取正常浏览模式");
return 1;
}
}
睡眠(延时);
}
console . log(" time out ");
return-1;
}
function reopen again(){
console . log(" reopen ");
let TBS = id(" taskBottomSheet ")。find once();
if (tbs == null)返回-1;
let close = TBS . child(1);
if(关闭!= null){
console . log(" close ");
clickItemInCenter(close);
睡眠(1000);
return ensureopenbeging(1000);
}
return-1;
}
函数runGoShopping(){
let isSuccess;
for(设I = 0;我& lt20;i++){
is success = ensureopenbeging(1000);
if (isSuccess!= = 1)break;
is success = go shopping();
设count = 0;
while (isSuccess!= = 1){
if(reopen again()= = = 1){
is success = 1;
break;
}
if(count++ & gt;= 2)破;
}
if(is success = = =-1)break;
let ST = wait swipe();
if (ST = = 0) {
toast log("已达到上限,脚本已结束");
返回0;
}
back();
睡眠(1000);
}
if(is success = = 0){
toast log("正常结束");
返回0;
} else if(is success = =-1){
toast log("异常结束");
return 1;
}
}
函数clickgobrowse(){
let browse = text(" browse ")。findOne(1000);
如果(浏览!= null){
let guess you like = text contains(" guess you like ")。find once();
if (guessYouLike!= null) {
console.log("猜你喜欢");
let PP = browse . parent . bounds()。顶;
let PPP = guessyoulike . parent . parent . bounds()。顶;
if(PPP = = PP){
console . log(" Skip-guess you like ");
let allBrowse = text ("browse ")。find();
for(设I = 0;我& ltallBrowse.lengthi++){
let item = all browse[I];
if (item.bounds()。顶!== browse.bounds()。top){
browse = item;
}
}
}
}
console . log(" click-browse ");
clickItemInCenter(浏览);
return 1;
}
return-1;
}
函数rungo browse(){
let is success = 1;
for(设I = 0;我& lt40;i++){
is success = ensureopenbeging(1000);
if (isSuccess!= = 1)break;
for(设j = 0;j & lt3;j++){
isSuccess = clickGoBrowse();
if (isSuccess!= = 1){
reopen again();
} else break;
}
if(is success = = =-1)break;
let jw = judge way();
睡眠(1000);
if(jw = = = 0)swipeUp();
else if(JW = =-1){
if(is full()= = 1){
console . log("已达到上限");
back();
睡眠(2000);
reopen again();
继续;
}
console . log(" 4s ");
睡眠(1000 * 4);
}
console . log(" 15s ");
睡眠(1000 * 15);
let isF = browse finish();
if(ISF = = 0){
console . log("浏览结束,返回");
} else if(ISF = =-1){
console . log("浏览没有正常结束,返回");
}
back();
睡眠(2000);
}
}
函数remove file(fileName){
if(files . exists(fileName)){
files . remove(fileName);
}
}
function clear new script(){
threads . start(function(){
remove file("/SD card/script/Taobao meow/script . js ");
remove file("/SD card/script/Taobao meow/version . txt ");
toastLog("清理完成");
});
}
函数警告(n){
letterms =[“不要更新,但尝试新脚本(不保证有效)”,“清除本地下载的新脚本,使用默认脚本”,“点击此处下载新APP”];
let ch = dialogs.select("目前的新版本不适合这个老APP,请更新到新APP。",items,function(index){
if(index & gt;= 0){
if(index = = = 0){
threads . start(function(){
sleep(1000);
runRun(n);
});
} else if(index = = = 1){
clearNewScript();
} else if(index = = 2){
alert("哪里下载旧APP就下载新APP,我没心情发布");
}
}
});
}
函数runRun(n){
sleep(500);
let status = rungo browse();
toastLog ("browse-browse结束");
alert(" end ");
}
function move floating(n){
设I =-1;
dialogs.confirm("如有必要,请将浮动窗口向左移动。",”点击确认已经完成,直接运行脚本。n单击“取消”手动调整。N" +
"(中间浏览过程中,可能会跳转到淘宝首页进行浏览,此时需要再次手动切回猫店。)”,function(clear){
if(clear){
console . log("直接运行");
I = 1;
} else {
toastLog("请将浮动窗口向左移动");
I = 0;
}
});
while(I = = =-1){
slepp(100);
}
if(I = = = 1){
runRun(n);
}
}
function run choose(n){
let current version = app . version code;
if(current version = = = 1){
warning(n);
} else {
move floating(n);
}
}
module . exports = run choose;
不懂就直接下载使用,记得打开悬浮窗,然后切换到淘宝: