前言
在闲鱼上看到有关视频号福袋的脚本,决定自己学习实现一个,脚本测试了一下,确实抢到了东西,但感觉里面东西不咋样。
毕竟创作不易,就不提供全部代码了,实现还是很简单的。
文章代码仅为学习参考,不可用于商业目的
其他
douyin 自动参与福袋-普通版文章链接
Autojs 实践-自动参与福袋-云控版文章链接
成果
![](https://img-blog.csdnimg.cn/direct/b5ef827e162b4c47a9fc7eb611344f90.png)
脚本UI实现效果及成果
![](https://img-blog.csdnimg.cn/direct/ba04068175304d8e833fe6a6effa0528.jpeg)
测试工具
手机:小米11
开发工具:AutoXJS
主要方法
判断当前是否在直播间
function D935740 () {
if (className("android.widget.TextView").id("ify").checked(false).clickable(true).findOne(1000) ||
className("android.widget.RelativeLayout").desc("点赞按钮").findOne(1000)) {
O431320()
} else if (className("android.widget.TextView").text("发现").findOnce()) {
click("发现")
sleep(1000)
let OOOOOOOOO00O0O0O = className("android.widget.TextView").checked(false).clickable(false).text("直播").find()
console.log(OOOOOOOOO00O0O0O);
if ((OOOOOOOOO00O0O0O && OOOOOOOOO00O0O0O.length > 1) && O431321(OOOOOOOOO00O0O0O[1])) {
sleep(1000)
if (OOO00OOO000OOO00OO = classNameContains("Button").textContains("我知道了").findOne(500)) {
OOO00OOO000OOO00OO.click();
}
if (className("android.widget.TextView").id("ify").findOne(1000)) {
O431320()
} else {
D935739();
}
}
}
}
进入直播间
function D935739 () {
if (O431321(className("android.widget.ImageView").id("b1h").findOne(1000))) {
if (O431321(textContains("购物").findOne(500))) {
}
} else {
let OOOOOOOOO00O0O0O = className("android.widget.TextView").id("fuv").find()
if ((OOOOOOOOO00O0O0O && OOOOOOOOO00O0O0O.length > 0) && O431321(textContains("购物").findOne(500))) {
sleep(2000)
let OOOOOOOOO00O0O0O0OO = text("购物").checked(false).clickable(true).findOnce()
let O0O0O0O = null;
if (OOOOOOOOO00O0O0O0OO) {
O0O0O0O = OOOOOOOOO00O0O0O.length;
} else {
O0O0O0O = 0;
}
if (OOOOOOOOO00O0O0OO0O = className("android.widget.TextView").id("fuv").find()) {
let OOO00O0O0 = OOOOOOOOO00O0O0OO0O[O0O0O0O]
if (OOO00O0O0) {
console.log(OOO00O0O0);
click(OOO00O0O0.bounds().centerX(), OOO00O0O0.bounds().centerY() - 50)
O431320()
}
}
}
}
}
滑动
直播间比较难以滑动,建议将时间调久一点。
function O431324 () {
if (id("fo5").findOnce() || text("演唱歌单").findOnce()) {
console.log(device.width / S287859.D252837 + "," + device.height * S287859.J193048);
console.log(device.width / S287859.D252837 + "," + device.height * S287859.G877429);
swipe(parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.J193048), parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.G877429), 1200)
swipe(parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.J193048), parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.G877429),1200)
} else {
console.log(device.width / S287859.D252837 + "," + device.height * S287859.J193048);
console.log(device.width / S287859.D252837 + "," + device.height * S287859.G877429);
swipe(parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.J193048), parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.G877429), 1200)
swipe(parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.J193048), parseInt(device.width / S287859.D252837), parseInt(device.height * S287859.G877429), 1200)
}
}
总结
后续会继续完善。