"ui";
ui.layout(
<vertical>
<appbar>
<toolbar title="翻页吧!"/>
</appbar>
<frame height="100" gravity="center">
<text text="相关配置如下👇" gravity="center"/>
</frame>
<vertical>
<button id="shuab" text="刷宝短视频:开刷" />
<button id="kuais" text="快手极速版:开刷" />
<button id="jrtt" text="今日头条:开刷" />
<button id="douy" text="抖音极速版:开刷" />
</vertical>
</vertical>
);
// 事件绑定
ui.kuais.on("click", function(){
runkais(1000);
});
ui.jrtt.on("click", function(){
runjstt(1000);
});
ui.douy.on("click", function(){
rundouyin(1000);
});
ui.shuab.on("click", function(){
runShuaBao(1000);
});
auto.waitFor();
auto.setMode('normal');
// 启动刷宝
function runShuaBao(set_count){
threads.start(function() {
console.show();
launchApp("刷宝短视频");
sleep(2000);
var width = device.width;
var height = device.height;
setScreenMetrics(width,height);
waitForActivity("com.jm.video.ui.main.MainActivity");
toastLog("开始刷视频");
sleep(1000);
var current = 0,
maxNum = set_count;//滑动次数
function huaping(){
//随机等待时间random(最小值,最大值)根据需要更改数值(单位秒)
var time_random=random(5,10);
// 点击
try {
click("首页");
} catch (error) {
console.log(error)
}
if (text("查看广告").findOne(1000) != null){
sleep(1000);
back();
}
if(current > maxNum){
toastLog("退出中...");
exit();
home();
}
//提示等待时间。
toastLog(time_random+'秒后刷新'+','+'还有'+(maxNum-current)+'次');
sleep(time_random * 1000);
current+=1;
}
// 开始循环上滑
while(true){
huaping();
}
})
}
//启动快手
function runkais(set_count) {
threads.start(function() {
console.show();
launchApp("快手极速版");
sleep(3000);
var width = device.width;
var height = device.height;
setScreenMetrics(width,height);
while (true) {
if (id("redFloat").findOne(1000) != null)
break;
}
ks_sign();
toastLog("开始刷视频");
sleep(1000);
var timer = 0;
var error_time = 0;
var current = 0,
maxNum = set_count;//滑动次数
function huaping(){
//随机等待时间random(最小值,最大值)根据需要更改数值(单位秒)
var time_random=random(5,10);
timer += time_random;
print("还剩" + (300 - timer) + "秒准备开箱");
if(timer >= 300){
open_box();
}
//滑动视频
swipe(width / 2, height * 3 / 4, width / 2, height / 10, 500);
current+=1;
if(current > maxNum){
toastLog("退出中...");
exit();
home();
}
//提示等待时间。
toastLog(time_random+'秒后刷新'+','+'还有'+(maxNum-current)+'次');
sleep(time_random * 1000);
}
//开宝箱
function open_box() {
if (id("redFloat").findOne(1000) != null){
timer = 0;
if (error_time > 10) return;
click(id("redFloat").findOne(1000).bounds().centerX(),id("redFloat").findOne(1000).bounds().centerY());
sleep(random(1000,2000));
if (text("开宝箱得金币").findOne(1000) != null) {
text("开宝箱得金币").findOne(1000).click();
}else{
error_time ++;
}
sleep(random(1000,2000));
if(text("看精彩视频赚更多").findOne(1000) != null){
error_time = 0;
text("看精彩视频赚更多").findOne(1000).parent().click();
sleep(45 * 1000);
back();
sleep(random(1000,2000));
}
}
back();
sleep(random(1000,2000));
}
//签到
function ks_sign() {
if (id("redFloat").findOne(1000) != null){
click(id("redFloat").findOne().bounds().centerX(),id("redFloat").findOne().bounds().centerY());
toastLog("开始签到");
sleep(3000);
if(text("立即签到").findOne(1000) != null){
text("立即签到").findOne().click();
if(text("今天已签").findOne(1000) != null){
toastLog("签到成功");
}else{
toastLog("签到失败");
}
sleep(random(1000,2000));
back();
}else {
toastLog("今天好像签到了");
sleep(random(1000,2000));
back();
}
}
}
while(true){
huaping();
}
})
}
// 启动抖音
function rundouyin(set_count){
threads.start(function() {
launchApp("抖音极速版");
sleep(2000);
var width = device.width;
var height = device.height;
setScreenMetrics(width,height);
toastLog("开始刷视频");
sleep(1000);
var current = 0,
maxNum = set_count;//滑动次数
function huaping(){
//随机等待时间random(最小值,最大值)根据需要更改数值(单位秒)
var time_random=random(5,10);
// 点击
try {
click("首页");
} catch (error) {
console.log(error)
}
if(current > maxNum){
toastLog("退出中...");
exit();
home();
}
//提示等待时间。
toastLog(time_random+'秒后刷新'+','+'还有'+(maxNum-current)+'次');
sleep(time_random * 1000);
current+=1;
}
// 开始循环上滑
while(true){
huaping();
}
})
}
//启动今日头条极速版
function runjstt(set_count){
threads.start(function() {
console.show();
launchApp("今日头条极速版");
sleep(2000);
var width = device.width;
var height = device.height;
setScreenMetrics(width,height);
while(true){
if(id("k2").findOne(1000) != null) break;
}
toastLog("开始");
sleep(1000);
var timer = 0;
var current = 0,
maxNum = set_count;//滑动次数
function huaping(){
//随机等待时间random(最小值,最大值)根据需要更改数值(单位秒)
var time_random=random(5,10);
timer += time_random;
print("还剩" + (300 - timer) + "秒准备开箱");
if(timer >= 300){
open_box();
}
// 点击
try {
click("首页");
} catch (error) {
console.log(error)
}
if(current > maxNum){
toastLog("退出中...");
exit();
home();
}
//提示等待时间。
toastLog(time_random+'秒后刷新'+','+'还有'+(maxNum-current)+'次');
sleep(time_random * 1000);
current+=1;
}
function open_box() {
click("任务")
timer = 0;
sleep(random(1000,2000));
if(text("开宝箱得金币").findOne(1000) != null){
text("开宝箱得金币").findOne(1000).parent().click();
if(text("看完视频再领").findOne(1000) != null){
text("看完视频再领").findOne(1000).parent().click();
sleep(30 * 1000);
back();
click("坚持退出")
print("视频结束退出!")
}
}
else
print("时间未到,返回首页!")
sleep(random(1000,2000));
click("首页");
}
// 开始循环上滑
while(true){
huaping();
}
})
}