加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ks.js 11.57 KB
一键复制 编辑 原始数据 按行查看 历史
zxr_xiaoha 提交于 2022-02-09 15:25 . first commit
"ui";
ui.layout(
<frame w="*" h="*">
<vertical>
<horizontal marginLeft="10" marginTop="10" gravity="center" >
<text textSize="40" textStyle="bold" textColor="black" text="快手极速版">
</text>
</horizontal>
<horizontal marginLeft="10" marginTop="10" gravity="center">
<text textSize="20" textColor="#33a3dc" text="红包x坐标:">
</text>
<input w="150" inputType="number" hint="只能输入数字" id="x" text="110">
</input>
</horizontal>
<horizontal marginLeft="10" marginTop="10" gravity="center">
<text textSize="20" textColor="#33a3dc" text="红包y坐标:">
</text>
<input w="150" inputType="number" hint="只能输入数字" id="y" text="427">
</input>
</horizontal>
<horizontal marginLeft="10" marginTop="10" gravity="center">
<text textSize="20" textColor="#33a3dc" text="广告间隔(s):">
</text>
<input w="150" inputType="number" hint="只能输入数字" id="time" text="2">
</input>
</horizontal>
<horizontal marginLeft="10" marginTop="20" gravity="center">
<button marginRight="10" style="Widget.AppCompat.Button.Colored" id="start" text="启动">
</button>
<button marginLeft="10" style="Widget.AppCompat.Button.Colored" id="stop" text="关闭">
</button>
</horizontal>
<horizontal marginLeft="10" marginTop="10" gravity="center">
<checkbox text="看完广告是否关闭脚本" id='che' checked='true' />
</horizontal>
<horizontal marginLeft="10" marginTop="10" gravity="left" paddingRight="20" paddingLeft="20">
<vertical>
<text textColor="red" textSize="12" text="注意:本脚本仅支持Android7.0以上">
</text>
<text textColor="red" textSize="12" text="需要打开无障碍模式,如果没打开会自动跳转到打开页面">
</text>
<text textColor="red" textSize="12" text="默认坐标为(110,427),请获得红包坐标后自己设置">
</text>
<text textColor="red" textSize="12" text="否则该坐标可能不适应你的手机">
</text>
<text textColor="red" textSize="12" text="点击启动后会自动打开快手极速版">
</text>
<text textColor="red" textSize="12" marginBottom="10" text="如果打开失败请手动打开">
</text>
<text textColor="blue" textSize="12" text="如何获取坐标呢?">
</text>
<text textColor="blue" textSize="12" text="打开‘开发者模式’下的‘指针位置’">
</text>
<text textColor="blue" textSize="12" text="移动到红包位置,即可获取坐标">
</text>
<text textColor="blue" textSize="12" marginBottom="10" text="我自己是在电话键盘输入‘*#*#7777#*#*’">
</text>
<text textColor="#33a3dc" textSize="12" text="作者:小哈">
</text>
<text textColor="#33a3dc" textSize="12" marginBottom="10" text="联系QQ:2474399329">
</text>
<text textColor="red" textSize="12" text="本脚本会自动签到,自动刷视频,自动领宝箱,一旦开启,即可释放双手,将手机放一边">
</text>
</vertical>
</horizontal>
</vertical>
</frame>
);
ui.start.click(() => {
let hbx = ui.x.getText();
let hby = ui.y.getText();
let AdvertisingInterval = ui.time.getText();
if (hbx === "" || hby === "" || AdvertisingInterval === "") {
toast("请输入数值");
return;
}
toast("脚本启动成功,即将自动打开快手极速版");
home();
let ksApp = launchApp("快手极速版");
if (!ksApp) {
toast("找不到软件,请先下载或自己打开")
}
threads.start(function() {
zixiancheng(hbx, hby, AdvertisingInterval);
});
})
ui.stop.click(() => {
toast("脚本以关闭");
exit();
})
function zixiancheng(hbx, hby, AdvertisingInterval) {
auto.waitFor();
waitForPackage("com.kuaishou.nebula"); //如果是快手就运行
let time = 0;
let reg = /^\d{2}\d{2}秒$/;
let text1 = null;
let hbx1 = hbx - 0;
let hby1 = hby - 0;
let AdvertisingInterval1 = AdvertisingInterval * 1000; //10个广告等几秒
linHonBao(hbx1, hby1, AdvertisingInterval1);
function linHonBao(hbx1, hby1, AdvertisingInterval1) {
waitForActivity("com.yxcorp.gifshow.HomeActivity", 1000); //视频页面
while (true) {
let hb = className("android.widget.FrameLayout").clickable(true).depth(1).findOnce(1) //找红包
let hb2 = id("redFloat").findOnce();
if (hb != null || hb2 != null) {
click(hbx1, hby1); //红包位置
break; //找到跳出循环
} else {
//没找到,滑动一下
swipe(542, 1300, 543, 100, 100); //滑动
sleep(1500);
}
}
sleep(1000);
waitForActivity("com.yxcorp.gifshow.webview.KwaiYodaWebViewActivity", 1000); //领奖页面
sleep(12000); //防止还没加载出来
if(className("android.view.View").text("立即签到").exists()){
className("android.view.View").text("立即签到").click();
sleep(1500);
let advertising = className("android.view.View").textStartsWith("看广告").findOnce();
if (advertising != null) {
advertising.click();
let zxr_time = getRandomIntInclusive(40000, 45000);
sleep(zxr_time - 0); //看视频
back();
sleep(2000);
}
}else if(className("android.view.View").textStartsWith("签到").exists()){
className("android.view.View").textStartsWith("签到").click();
sleep(1500);
let advertising = className("android.view.View").textStartsWith("看广告").findOnce();
if (advertising != null) {
advertising.click();
let zxr_time = getRandomIntInclusive(40000, 45000);
sleep(zxr_time - 0); //看视频
back();
sleep(2000);
}
}
let kbxdjb = text("开宝箱得金币").findOnce();
//let kbxdjb2 = textStartsWith
let mrzl = text("明日再来").findOnce();
if (kbxdjb != null) { //找到了开宝箱得金币
sleep(1000)
kbxdjb.click();
// click("开宝箱得金币");
sleep(2000);
let kjcspzgd = textStartsWith("看精彩视频赚更多").findOnce();
let kjcspzgd2 = textStartsWith("看精彩视频多赚金币").findOnce();
let kjcspzgd3 = textStartsWith("去看视频").findOnce();
let kjcspzgd4 = textEndsWith("看视频就赚").findOnce();
if (kjcspzgd != null || kjcspzgd2 != null || kjcspzgd3 != null || kjcspzgd4 != null) {
sleep(1000);
if (kjcspzgd != null) {
kjcspzgd.click();
log(1)
} else if (kjcspzgd2 != null) {
kjcspzgd2.click();
log(2)
} else if (kjcspzgd3 != null) {
kjcspzgd3.click();
log(3)
}else if(kjcspzgd4 != null){
kjcspzgd4.click()
log(4)
}
let zxr_time1 = getRandomIntInclusive(40000, 45000);
log(zxr_time1);
sleep(zxr_time1 - 0); //看视频
back();
sleep(1000)
let zkygd = textStartsWith("再看一个得").findOnce();
if (zkygd != null) {
zkygd.click();
sleep(zxr_time1 - 0);
back();
} else if (text("坚持退出").findOnce() != null) {
text("坚持退出").click();
}
sleep(2000);
text1 = className("android.view.View").textMatches(reg).findOnce(); //时间
//假如最后一次看完广告后,没有宝箱了,怎么办
if (text1 != null) {
//这里面是有冷却时间
sleep(500);
back();
} else {
swipe(542, 1300, 543, 1000, 500); //
sleep(2000);
//没有宝箱了
fuli(AdvertisingInterval1);
}
} else {
back();
}
} else if (mrzl != null) { //今天的宝箱全部开完了
swipe(542, 1300, 543, 1000, 500); //
sleep(2000);
fuli(AdvertisingInterval1);
}
else if(kbxdjb == null){
back();
}
else { //还有冷却时间
sleep(1000);
text1 = className("android.view.View").textMatches(reg).findOnce(); //找到时间
sleep(500);
back();
}
}
function fuli(AdvertisingInterval1) {
let fl = null;
let one = true;
while (true) {
if (one) {
sleep(2000);
one = false;
} else {
toast(AdvertisingInterval1 / 1000 + "秒后继续看广告");
sleep(AdvertisingInterval1);
}
fl = textStartsWith("福利").findOnce();
if (fl != null) {
fl.click();
let zxr_time2 = getRandomIntInclusive(40000, 45000);
sleep(zxr_time2 - 0);
back();
} else if (ui.che.checked) {
back();
back();
home();
exit();
} else {
back();
break;
}
}
}
function getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min; //含最大值,含最小值
}
let flag = true;
let fen, miao;
let zonTime;
while (true) {
//waitForActivity("com.yxcorp.gifshow.HomeActivity"); //视频页面
//sleep(1000);
swipe(542, 1400, 582, 200, 100); //滑动
sleep(1000);
if (textContains("点击打开").exists() || textContains("点击查看").exists()) {
continue
}
if (text1 != null && flag == true) {
flag = false;
time = text1.text();
fen = time.substr(0, 2);
miao = time.substr(3, 2);
zonTime = fen * 60 + miao * 1; //总的秒数,乘以一是隐式转为number类型
}
let sjs = getRandomIntInclusive(5000, 7000)
sleep(sjs - 0);
log(sjs)
if (zonTime > 0) {
zonTime = zonTime - (sjs / 1000 + 1); //
console.log(zonTime)
if (zonTime <= 0) {
flag = true;
linHonBao(hbx1, hby1, AdvertisingInterval1);
}
}
} //
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化