z0ow / tb618 Goto Github PK
View Code? Open in Web Editor NEW淘宝618领喵币Auto.js脚本
淘宝618领喵币Auto.js脚本
首先声明我不会任何编程
当这个脚本运行浏览的时候,默认时间经常因淘宝的小霸王服务器延迟原因,导致一开始不计时,几秒后(俩号测试,几秒都有)才弹出计时窗口,实际需要时长超过15s,这个脚本就不能完成浏览了
我xjb调整了那个sleep打头,括号内的时长(应该是吧,纯属瞎试),就减少了失败率
感觉大佬应该延长下时间,就能保证成功,而不用重复了
我autojs无障碍权限已开。并且昨天运行(eval方式)该脚本可以正常。我尝试重新开关autojs无障碍权限,运行脚本后还是会自动跳转设置界面。
exit 有两处拼写成了 eixt
20:39:56.750/E: TypeError: Cannot find function waitFor in object
function (mode) {...}. (#2)
at script(:2)
是咋回事啊
eval(http.get('https://raw.githubusercontent.com/ZehuanZhang/tb618/master/tb618.js').body.string());
貌似获取不了js
在搜索栏输入"618列车"搜索,就会进入到活动界面了。建议逻辑修改成这样
我的机型是小米 8,MIUI11 开发版对应安卓 10,已 ROOT。
不知道是否是系统或特殊机型导致的问题,我在打开淘宝后进入首页时会无法进入 618 页面,日志如下:
06:04:13.061/D: 检测无障碍模式是否开启
06:04:16.075/D: 欢迎来到领喵币脚本
Github项目: tb618
设备宽: 1080
设备高: 2248
手机型号: MI 8
安卓版本: 10
06:04:19.339/D: 打开手机淘宝
06:04:28.991/D: 当前在主界面
06:04:31.996/D: 尝试进入618列车界面
06:04:44.772/D: 进入主互动界面失败!
跟代码感觉是在首页“寻找 618 活动按钮”或者“寻找搜索框,尝试搜索入口进入活动”两个环节失败了。手动测试确认,如果我进入淘宝后,手动点击搜索,进入搜索页,可以继续后边的进程。
代码中,这个首页的活动点击块和搜索框都是根据 depth 和 index 来查找的,这块不太懂。如果方便的话,能否透露下这两个属性在 AutoJs 怎么确认,我继续排查看看。
另外有个关于搜索块定位的想法,如 Readme 中提到,淘宝“界面经常变动”。。。depth 和 index 这种属性大概也是随着首页布局调整,所以才会导致诸如 2020/06/13 这种首页层次变化就得更新代码的情况。
或许在定位搜索框的时候,可以根据 text 和 desc 来定位。比如搜索框的搜索按钮,点击会进入搜索页,和点击搜索框效果一致,这个搜索按钮是有 desc="搜索" 可以来定位的。且搜索按钮的“搜索”字段在小版本更新中变化的可能性较小。
感觉进入搜索页的代码如果用这个来做,可能会更通用
var searchButton = desc("搜索").findOnce();
click(searchButton.bounds().centerX(), searchButton.bounds().centerY()); sleep(3000);
或者这样处理效果可能会更好,页面微调后比较好处理:
// x,y 表示找到对应 text&desc 点击时的偏移量
// way 查找 text&desc 的方式,默认 equals,要求字段完全符合
// key 就是关键字段
function clickByKey (x, y, way, key) {
switch (way) {
case "matches":
if (textMatches(key).exists()) {
var keyBounds = textMatches(key).findOnce().bounds();
click(keyBounds.centerX() + x, keyBounds.centerY() + y);
} else if (descMatches(key).exists()) {
var keyBounds = descMatches(key).findOnce().bounds();
click(keyBounds.centerX() + x, keyBounds.centerY() + y);
}
break;
default:
if (textEndsWith(key).exists()) {
var keyBounds = textEndsWith(key).findOnce().bounds();
click(keyBounds.centerX() + x, keyBounds.centerY() + y);
} else if (descEndsWith(key).exists()) {
var keyBounds = descEndsWith(key).findOnce().bounds();
click(keyBounds.centerX() + x, keyBounds.centerY() + y);
}
}
};
clickByKey(0, 0, "equals", "搜索"); sleep(3000);
如果改动影响稳定性,还请忽略,打扰了。
很赞的代码,感谢作者。
浏览618精选榜单,去天猫农场收菜(这个大概不能完成),浏览天猫榜单频道,浏览618爆款合集
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.