加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
lua.js 48.08 KB
一键复制 编辑 原始数据 按行查看 历史
鹤鸣悠香 提交于 2020-09-13 23:51 . update lua.js.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
"ui";
var STORAGE = storages.create("chx32239231");
var color = "#009688";
var 软件版本 = app.versionCode
//获取脚本的版本,xml里的哪个
var 安卓版本 = device.release
//获取安卓版本
var 仿评论
var 自定义话术
var ic = 0;
var sleeptime
var toppage;
var path_homg="main.js"
var arr = ["time0", "time1", "time2", "keytext", "like", "shouc", "zuangf", "backdv", "comment", "followhost", "comment1", "like2","liveroomtime"]
//输入框数组
var arr1 = ["nokey", "customtext", "customtext1","liveroom1","liveroom2"]
//复选框数组
ui.layout(
<ScrollView>
<vertical bg="#e8eaba" >
<appbar>
<horizontal>
<toolbar title="抖音不适宜-高级版" />
<text id="ok1" textColor="#fff000" padding="120 15 1 0" text="返回" />
</horizontal>
</appbar>
<Switch id="autoService" text="开启无障碍服务" checked="{{auto.service != null}}" padding="8 8 8 0" textSize="15sp" />
<horizontal padding="18 0 8 0" h="40">
<text text="抖音客户端:" />
<input id="app1" text="抖音短视频" />
</horizontal>
<card w="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<vertical>
<horizontal padding="28 5 8 -3" h="40" >
<text padding="0 5 8 0" text="直播间养号:" w="auto" />
<checkbox id="liveroom2" text="直播广场" />
<checkbox id="liveroom1" checked="true" text="推荐直播间" />
</horizontal>
<horizontal padding="28 -3 8 0" >
<text text="停留时长:" />
<input id="liveroomtime" gravity="center" text="30" w="100" />
<text text="" />
</horizontal>
</vertical>
<View bg="#eaf01c" h="*" w="8" />
</card>
<card w="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 -3 8 0" >
<text padding="0 5 8 0" text="刷视频养号:" />
<text text="运行总时长:" />
<input id="time0" gravity="center" text="30" w="100" />
<text text="" />
</horizontal>
<View bg="#eaf01c" h="*" w="8" />
</card>
<card w="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 0 8 0" h="40" >
<text text="浏览作品时长:" />
<input id="time1" gravity="center" text="20" w="50" />
<text text="----" />
<input id="time2" gravity="center" text="45" w="50" />
<text text="" />
</horizontal>
<View bg="#ebda1c" h="*" w="10" />
</card>
<card w="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 0 8 0" h="40">
<text padding="0 10 12 0" text="关注作者概率:" />
<input id="followhost" gravity="center" text="20" w="50" />
<text padding="0 0 10 0" text="" />
<text text="喜欢作品概率:" />
<input id="like" gravity="center" text="20" w="50" />
<text text="" />
</horizontal>
<View bg="#ebb022" h="*" w="12" />
</card>
<card w="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 0 8 0" h="40">
<text text="收藏作品概率:" />
<input id="shouc" gravity="center" text="20" w="50" />
<text text="∝ 转发作品概率:" />
<input id="zuangf" gravity="center" text="20" w="50" />
<text text="" />
</horizontal>
<View bg="#eb9928" h="*" w="14" />
</card>
<card w="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 0 8 0" h="40" >
<text text="随机倒退视频概率:" />
<input id="backdv" gravity="center" hint="填1-100整数" text="10" w="auto" />
<text text="" />
</horizontal>
<View bg="#ea802f" h="*" w="16" />
</card>
<card w="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 0 8 0" h="40" >
<text padding="0 10 12 0" text="评论设置:" />
<text text="评论作品概率:" />
<input id="comment" gravity="center" hint="填1-100整数" text="20" w="50" />
<text text="" />
</horizontal>
<View bg="#ea802f" h="*" w="16" />
</card>
<card w="*" h="auto" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 0 8 0" h="40">
<text text="评论区点赞:" />
<text text=" 点赞数:随机数量" />
<text text=" 点赞概率:" />
<input id="like2" gravity="center" text="20" w="50" />
<text text="" />
</horizontal>
<View bg="#ea6039" h="*" w="16" />
</card>
<card w="*" margin="10 5 5 5" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<horizontal padding="28 0 8 0" h="40">
<text padding="0 5 8 0" text="评论方式: " w="auto" />
<radiogroup orientation="horizontal">
<radio id="customtext" checked="true" text="自定义文案" />
<radio id="customtext1" text="智能仿评论" />
</radiogroup>
</horizontal>
<View bg="#e84143" h="*" w="18" />
</card>
<card w="*" h="*" margin="10 2 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<vertical>
<horizontal padding="28 0 8 0" >
<text text="养号关键词:" />
<input id="keytext" gravity="center" hint="请勿留空" text="" w="*" />
</horizontal>
<text padding="50 -3 8 5" text="关键词用','号隔开,如:南宁,好味齐饭店,古典鸡" />
<horizontal padding="18 -3 8 0" >
<checkbox id="nokey" gravity="center" text="忽略关键词/不会去判断关键词,会随机点赞,关注,评论转发收藏 ,如果测试功能勾选该项.并且概率填100" textSize="14sp" />
</horizontal>
</vertical>
<View bg="#e83447" h="*" w="20" />
</card>
<card w="*" h="*" margin="10 5 5 0" bg="#f7f7f4" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical" >
<vertical padding="28 0 8 0" >
<text w="auto" padding="0 8 8 0" text="自定义评论文案:" />
<input id="comment1" gravity="center" hint="多条文案可用','号分隔" w="*" />
<text padding="30 0 8 0" textColor="#c1c1bc" text="多条文案可用','号隔开,如:大家好!,这个视频必火,666" />
</vertical>
<View bg="#e51950" h="*" w="20" />
</card>
<text padding="10 15 8 0" textColor="red" textSize="20sp" text="温馨提示:" />
<text padding="10 0 8 0" text="1.可设置多个关键词,用','号分隔 " />
<text padding="10 0 8 0" text="2.例如:剪辑,电影,影视.符合后才会有概率去点赞什么的" />
<text padding="10 0 8 0" text="3.关键词尽可能多而精准,测试时候选择忽略" />
<text padding="10 0 8 0" text="4.所有概率设置,请填写1以上的正整数.数字越大,概率越大!100是一定" />
<horizontal padding="10 0 8 5">
<text text="当前软件版本:" />
<text textColor="red" id="codesn" text="" />
<text text="" w="20" />
<text text="本机安卓版本:" />
<text textColor="red" id="codean" text="" />
<text text="" w="20" />
</horizontal>
<horizontal padding="10 15 10 5" gravity="center" >
<button bg="#FF5151" textColor="#FCFCFC" w="150" id="start1" text="开始运行" />
</horizontal>
</vertical >
</ScrollView>
);
//=======================以下为执行====
//=========================允许检测是否打开无障碍=========================
ui.autoService.on("check", function (checked) {
if (checked && auto.service == null) {
app.startActivity({
action: "android.settings.ACCESSIBILITY_SETTINGS"
});
}
if (!checked && auto.service != null) {
auto.service.disableSelf();
}
});
ui.emitter.on("resume", function () {
ui.autoService.checked = auto.service != null;
});
//=======================以下为执行====
//=========================允许检测是否打开无障碍=========================
ui.autoService.on("check", function (checked) {
if (checked && auto.service == null) {
app.startActivity({
action: "android.settings.ACCESSIBILITY_SETTINGS"
});
}
if (!checked && auto.service != null) {
auto.service.disableSelf();
}
});
ui.emitter.on("resume", function () {
ui.autoService.checked = auto.service != null;
});
//=========================允许检测是否打开无障碍=========================
// 以下为执行函数
if (软件版本) {
ui.codesn.setText(''+(软件版本));
}
if (安卓版本) {
ui.codean.setText(''+(安卓版本));
}
读取设置()
//===以下为本函数==
//===以下为线程执行===
ui.start1.on("click", function () {
device.vibrate(200)
// toastLog("开台")
if (auto.service == null) {
toast("请先开启无障碍服务!");
return;
}
保存设置()
读取设置()
threads.start(function () {
log("开始任务")
停止窗()
var app1 = ui.app1.text()
launchApp(app1)
console.show()
console.setTitle("运行日志")
等待打开首页()
养号()
})
threads.start(function () {
while (true) {
弹窗检测()
sleep(5000)
//log("检测")
}
})
})
ui.ok1.click(function () {
device.vibrate(100);//震动一下
engines.execScriptFile(path_homg); //打开导航页
ui.finish();
});
//================================
function 养号() {
var keytext = ui.keytext.text().toString();
//确保转化为字符
var time0 = Number(ui.time0.text())
var time1 = Number(ui.time1.text())
var time2 = Number(ui.time2.text())
var like = Number(ui.like.text())
//这个值是0或者1.对应真假
var t1 = new Date().getTime();
var t3 = 0
var b = "null";
var b1 = 0
var arr = keytext.split(/,|,/);
//数组用","分割split
log(ui.liveroom2.checked)
if(ui.liveroom2.checked){
log("直播养号_直播广场")
直播广场()
}
if (typeof arr == "undefined" || arr == null || arr == "") {
log("没有设置关键词,请前往设置再重新开启")
sleep(2000)
alert("提示", "没有设置关键词,请前往设置再重新开启," + "\n" + "软件已停止运行")
console.hide()
exit()
} else {
log("本次关键词:" + arr)
log("本次养号时长:" + time0 + "")
}
while (t3 < time0 * 1000 * 60) {
b1 = 0
// log("开始")
//log("arr"+arr[0])
if (ui.nokey.checked) {
b = "忽略关键词"
//这里是设置了忽略关键字nokey的话(选中了)
} else {
for (var i = 0; i < arr.length; i++) {
var a = arr[i];
//循环数组
var b = "";
//log("a" + a);
let object = textContains(a).find();
//寻找包含关键字
if (!object.empty()) {
//empty()#
/* 返回 <Boolean>
返回控件集合是否为空。 */
//如果返回不为空
//log("找到啦");
//遍历数组
//要定义toppage
object.forEach(function (currentValue, index) {
if (currentValue.bounds().bottom > device.height / 2
&& currentValue.bounds().bottom < toppage
&& currentValue.bounds().top < toppage) {
log(currentValue.bounds(), index)
log(currentValue.text())
b = a
}
});
break;
} else {
console.verbose("NULL没有关键字:" + a)
/* console.verbose([data][, ...args])#
data <any>
...args <any>
与console.log类似,但输出结果以灰色字体显示。输出优先级低于log,用于输出观察性质的信息。 */
sleep(200)
};
}
}
if (b) {
var inlivetop = device.height - 50
if (textContains("点击进入直播间").exists()) {
try {
var inlive = textContains("点击进入直播间").findOnce().bounds()
} catch (error) {
}
if (textContains("点击进入直播间").exists() && inlive.top < inlivetop && inlive.bottom < inlivetop && inlive.bottom > 200) {
sleep(500)
if(ui.liveroom1.checked){
推荐直播间()
}else{
log("有直播间,划走")
sleep(500)
}
b1 = 1
}
}
if (textContains("广告").exists()) {
try {
var inlive1 = textContains("广告").findOnce().bounds()
} catch (error) {
}
if (textContains("广告").exists() && inlive1.top < inlivetop && inlive1.bottom < inlivetop && inlive1.bottom > 200) {
sleep(500)
log("有广告,划走")
sleep(500)
b1 = 1
}
}
if (b1 !== 1) {
sleeptime = random(time1, time2);//视频停留时间
console.info("有关键字:【" + b + "】。");
console.info("本次停留时长:" + sleeptime + "");
var thread = threads.start(function () {
// 心跳计时
心跳显示() //开始心跳进程
})
sleep(sleeptime * 1000)
console.info("停留已结束");
thread.interrupt(); //停止线程
var vslike = random(1, 101 - (Number(ui.like.text()))) //点赞
// log(Number(ui.like.text()))
if (Number(ui.like.text()) !== 0) {
if (vslike == 1) {
多击点赞();
console.info("喜欢:本条视频已点赞")
sleep(random(1000, 2000))
} else {
log("喜欢:不需要点击")
}
} else {
log("喜欢关闭")
}
var vscomment = random(1, 101 - (Number(ui.comment.text()))) //评论
//log(Number(ui.comment.text()))
if (Number(ui.comment.text()) !== 0) {
if (vscomment == 1) {
发表评论();
console.info("评论:本条视频已发送评论")
sleep(random(1000, 2000))
} else {
log("评论:不需要评论")
}
} else {
log("评论关闭")
}
var vslike2 = random(1, 101 - (Number(ui.like2.text()))) //评论区点赞
if (Number(ui.like2.text()) !== 0) {
if (vslike2 == 1) {
评论区点赞();
console.info("点赞评论区:已点赞")
sleep(random(1000, 2000))
} else {
log("点赞评论区:不需要点击")
}
} else {
log("点赞评论区关闭")
}
var vsshouc = random(1, 101 - (Number(ui.shouc.text()))) //收藏
if (Number(ui.shouc.text()) !== 0) {
if (vsshouc == 1) {
收藏();
console.info("收藏:本条视频已发收藏")
sleep(random(1000, 2000))
} else {
log("收藏:不需要收藏")
}
} else {
log("收藏关闭")
}
var vsfollowhost = random(1, 101 - (Number(ui.followhost.text()))) //关注作者
if (Number(ui.followhost.text()) !== 0) {
if (vsfollowhost == 1) {
关注作者();
console.info("关注:已关注作者")
sleep(random(1000, 2000))
} else {
log("关注:不需要关注,等待下次随机")
}
} else {
log("关注关闭")
}
var vsbackdv = random(1, 101 - (Number(ui.backdv.text())))
if (Number(ui.backdv.text()) !== 0) {
if (vsbackdv == 1) {
//log("vscomment"+vscomment)
console.info("随机倒退一条视频")
向下曲线滑动()
sleep(random(2000, 5000))
向上曲线滑动()
sleep(random(1000, 2000))
}
} else {
log("倒退关闭")
}
}
} else {
console.verbose("**跳过:没有关键字")
sleep(random(1000, 6000))
}
var t2 = new Date().getTime();
var t3 = t2 - t1
log("总耗时:" + Math.trunc(t3 / 60000) + "分/设置时长" + time0 + "")
向上曲线滑动()
sleep(500)
// log("结束")
}
log("本次养号结束");
关闭应用("抖音短视频")
alert("本次养号结束,点击确认停止脚本");
console.hide()
exit();
}
function 心跳显示() {
while (true) {
sleeptime = Number(sleeptime) - 1
//log(sleeptime)
sleeptime1 = '' + sleeptime
//log(sleeptime1)
if (sleeptime !== 0) {
var window1 = floaty.window(
<linear gravity="center" bg="#ffff00" w="80" h="50">
<text id="倒计时" gravity="center" textColor="red" textStyle="bold" textSize="30sp" text="11" />
</linear>
);
window1.setPosition(device.width / 2 - 100, device.height * 0.4);
//setInterval(function () { }, 500);
window1.倒计时.setText(sleeptime1)
sleep(980)
window1.close()
} else {
break;
}
}
}
function 停止窗() {
var window = floaty.window(
<linear w="30" h="30" >
<img id="stop" src="file:///sdcard/vip/stop.png" />
</linear>
);
window.setPosition(10, device.height * 0.4);
setInterval(function () { }, 1000);
var execution = null;
//记录按键被按下时的触摸坐标
var x = 0, y = 0;
//记录按键被按下时的悬浮窗位置
var windowX, windowY;
//记录按键被按下的时间以便判断长按等动作
var downTime;
window.stop.setOnTouchListener(function (view, event) {
switch (event.getAction()) {
case event.ACTION_DOWN:
x = event.getRawX();
y = event.getRawY();
windowX = window.getX();
windowY = window.getY();
downTime = new Date().getTime();
return true;
case event.ACTION_MOVE:
//移动手指时调整悬浮窗位置
window.setPosition(windowX + (event.getRawX() - x),
windowY + (event.getRawY() - y));
//如果按下的时间超过1.5秒判断为长按,退出脚本
// if (new Date().getTime() - downTime > 1500) {
// exit();
// }
return true;
case event.ACTION_UP:
//手指弹起时如果偏移很小则判断为点击
if (Math.abs(event.getRawY() - y) < 5 && Math.abs(event.getRawX() - x) < 5) {
toastLog("用户停止软件");
device.vibrate(100);
log("用户停止软件")
device.vibrate(100);
console.hide()
exit();
}
return true;
}
return true;
});
window.stop.click(function () {
toastLog("用户停止软件");
device.vibrate(100);
log("用户停止软件")
device.vibrate(100);
console.hide()
exit();
});
}
function 关闭应用(packageName) {
var name = getPackageName(packageName);
if (!name) {
if (getAppName(packageName)) {
name = packageName;
} else {
return false;
}
}
app.openAppSetting(name);
text(app.getAppName(name)).waitFor();
let is_sure = textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne();
if (is_sure.enabled()) {
textMatches(/(.*强.*|.*停.*|.*结.*|.*行.*)/).findOne().click();
textMatches(/(.*确.*|.*定.*)/).findOne().click();
log(app.getAppName(name) + "应用已被关闭");
sleep(1000);
back();
} else {
log(app.getAppName(name) + "应用不能被正常关闭或不在后台运行");
back();
}
}
function 多击点赞() {
j = random(4, 10)
//log(j);
for (i = 0; i < j; i++) {
press(device.width * 0.7 + random(-100, 50), device.height / 2 + random(-100, 100), 1);
sleep(random(50, 150));
}
sleep(random(500, 1000));
}
function 读取设置() {
//输入框
for (let i = 0; i < arr.length; i++) {
var 内容 = STORAGE.get(arr[i]); //取数据
if (内容) {
ui[arr[i]].setText(内容);
}
}
//复选框
for (let i = 0; i < arr1.length; i++) {
if (STORAGE.get(arr1[i]) == "true") {
eval("ui." + arr1[i]).setChecked(true);
} else {
eval("ui." + arr1[i]).setChecked(false);
}
}
}
function 保存设置() {
//输入框
for (let i = 0; i < arr.length; i++) {
var 内容 = ui[arr[i]].text();
if (typeof 内容 == "undefined" || 内容 == null || 内容 == "") {
continue;
}
// log(内容);
STORAGE.put(arr[i], 内容);
}
//复选框
for (let i = 0; i < arr1.length; i++) {
if (eval("ui." + arr1[i]).isChecked()) {
STORAGE.put(arr1[i], "true");
} else {
STORAGE.put(arr1[i], "false");
}
}
}
function 发表评论() {
for (var plbsi = 0; plbsi < 5; plbsi++) {
//log(plbsi) //plbs=评论本身
try {
var plbs = descContains("评论").findOnce(plbsi).bounds();//
} catch (e) {
continue;
// 错误处理代码片段
}
var plbstop = plbs.top
var plbsbottom = plbs.bottom
var y = device.height
//log(plbstop)
//log(plbsbottom)
//log(y)
if (plbstop < y && plbsbottom > 1 && plbstop > 1) {
//log("找到了:" + plbs);
press(plbs.centerX() + random(1, 10), plbs.centerY() + random(1, 10), 1)
sleep(random(3000, 5500));
if (textContains("留下你的精彩评论吧").exists() && !textContains("条评论").exists()) {
log("评论区无评论")
sleep(500)
back();
sleep(1000)
if (textContains("条评论").exists() || textContains("暂无评论").exists()) {
sleep(500)
back();
}
} else {
向上曲线滑动()
sleep(random(1000, 2500));
if (ui.customtext.checked) {
自定义文案()
// log("自定义话术:"+自定义话术)
var 评论内容 = 自定义话术
//log("评论内容:"+评论内容 )
} else {
仿评论内容() //在点输入框前先执行获取函数
sleep(500)
var 评论内容 = 仿评论
}
if (desc("表情").exists()) {
desc("表情").click()
log("本次评论内容:" + 评论内容)
sleep(random(1000, 2000))
//setText(评论内容);
while (true) {
if (!textContains("留下你的精彩评论").exists()) {
log("内容输入成功")
break;
} else {
log("未发现输入内容")
let text = textContains("留下你的精彩评论").findOnce().bounds()
press(text.centerX() + random(-50, 50), text.centerY() + random(-10, 10), 1)
sleep(500)
setText(0, 评论内容);
setText(1, 评论内容);
setText(3, 评论内容);
sleep(2000)
}
}
sleep(random(3000, 7000));
//评论并转发====
var vszuangf = random(1, 101 - (Number(ui.zuangf.text()))) //转发
if (Number(ui.zuangf.text()) !== 0) {
if (vszuangf == 1) {
let forwardbounds = text("评论并转发").findOnce().bounds()
press(forwardbounds.centerX() + random(-10, 10), forwardbounds.centerY() + random(-2, 2), 1)
console.info("转发:已选择转发")
sleep(random(2000, 4000));
} else {
log("转发:不需要转发")
sleep(random(1000, 2000));
}
} else {
log("转发关闭")
}
//=====
for (let i = 0; i < 3; i++) {
try {
var 发表图标 = desc("表情").findOnce().bounds()
} catch (error) {
}
sleep(1000)
}
press(发表图标.right + random(20, 50), 发表图标.centerY() + random(10, 20), 1)
sleep(random(1000, 3000))
}
sleep(random(800, 1500));
back()
sleep(random(500, 1000));
if (textContains("条评论").exists() || textContains("暂无评论").exists()) {
back();
}
break;
}
}
}
}
function 评论区点赞() {
for (var plbsi = 0; plbsi < 5; plbsi++) {
//log(plbsi) //plbs=评论本身
try {
var plbs = descContains("评论").findOnce(plbsi).bounds();//
} catch (e) {
continue;
// 错误处理代码片段
}
var plbstop = plbs.top
var plbsbottom = plbs.bottom
var y = device.height
if (plbstop < y && plbsbottom > 1 && plbstop > 1) {
//log("找到了:" + plbs);
press(plbs.centerX() + random(1, 10), plbs.centerY() + random(1, 10), 1)
sleep(random(1000, 1500));
if (textContains("留下你的精彩评论吧").exists() && !textContains("条评论").exists()) {
log("评论区无评论")
sleep(500)
back();
sleep(1000)
if (textContains("条评论").exists() || textContains("暂无评论").exists()) {
sleep(500)
back();
}
} else {
try {
if (textContains("条评论").exists()) {
let textpl = textContains("条评论").findOne().text()
//var textplunm = Number(textpl.replace(/[^0-9]/g, ""))
let lookun = random(1, 5)
for (let lookuni = 0; lookuni < lookun; lookuni++) {
for (let likeuni = 0; likeuni < 10; likeuni++) {
let object = id("title").findOnce(likeuni)
let liekbottom = Number((desc("表情").findOnce().bounds().top)) - 30
// log(liekbottom)
let liekbottom1 = Number((textContains("条评论").findOnce().bounds().bottom)) + 80
// log(liekbottom1)
if (object.bounds().top > liekbottom1
&& object.bounds().bottom < liekbottom
&& object.bounds().top < liekbottom
&& object.bounds().left > 100) {
let xy = object.bounds()
press(device.width - random(50, 70), xy.top - random(-5, 5), 1)
sleep(1000)
break;
}
}
向上曲线滑动()
log("操作提示:随机浏览")
//log("划动")
sleep(2000)
}
}
else {
log("评论区不适合点赞")
}
} catch (error) {
}
back()
sleep(random(500, 1000));
if (textContains("条评论").exists() || textContains("暂无评论").exists()) {
back();
sleep(800)
}
}
break;
}
}
}
function 仿评论内容() {
let arrkey = [":", "-", "分钟前", "小时前", "天前"]
for (i = 0; i < arrkey.length; i++) {
//log(arr.length)
let key = arrkey[i]
// log(key)
if (textContains(key).exists()) {
let 内容 = textContains(key).findOnce().text()
sleep(800)
//log(内容)
num = 内容.length
//log(num)
if (num > 1) {
// log("22" + 内容)
let text = 内容.split(key)
let textf = text[0].slice(0, text[0].length - 4)
//log(textf)
// log(text)
//var 仿评论内容 = text[0]+random(100, 9999)
let pic = ["[捂脸]", "[666]", "[伤心]", "[赞][赞]", "[看][看]", "[流泪]", "[灵光一闪]", "[耶][耶]", "[右边]", "[调皮]", "[抠鼻][抠鼻]", "[比心][比心]"]
let piclong = pic.length - 1
let picnum = random(0, piclong)
仿评论 = pic[picnum] + textf + pic[picnum] + pic[picnum];
//log(仿评论内容)
break;
}
else {
let pic = ["[捂脸]", "[666]", "[伤心]", "[赞][赞]", "[看][看]", "[流泪]", "[灵光一闪]", "[耶][耶]", "[右边]", "[调皮]", "[抠鼻][抠鼻]", "[比心][比心]"]
let piclong = pic.length - 1
let picnum = random(0, piclong)
仿评论 = "加油" + pic[picnum] + pic[picnum] + pic[picnum];
}
}
}
}
function 获取qq群() {
var res = http.get("https://zhuanlan.zhihu.com/p/163833922");
if (res.statusCode >= 200 && res.statusCode < 300) {
//toast("页面获取成功!");
} else if (res.statusCode == 404) {
//toast("页面没找到哦...");
} else {
//toast("错误: " + res.statusCode + " " + res.statusMessage);
}
var a = res.body.string()
//log(a)
var 贴吧随机数 = random(1, 45);
var pos = a.indexOf("这是一个暗号"); //返回在第几位置出现
//log(pos);
var a1 = a.slice(pos, pos + 100)
//log(a1);
var arr = a1.split("#");
qq = arr[1]
//log(qq)
}
function 向上曲线滑动() {
x = device.width / 2 + random(-100, 50);
y = device.height * 0.7 + random(10, 50);;
t1 = device.height / 220
var points = [random(600, 1200)];
x1 = x + t1;
y1 = y - t1;
for (var i = 250; i > 0; i--) {
var arr = ["0.005", "0.003", "0.004", "-0.001"]
var item = arr[Math.floor(Math.random() * arr.length)];
x1 = x1 + t1 * i / 3 * item;
y1 = y1 - t1 * 0.5;
points.push([x1, y1])
}
gesture.apply(null, points);//通用滑动 ,向上
}//曲线划屏向上
function 向下曲线滑动() {
x = device.width * 0.7 + random(-100, 50);
y = device.height * 0.1 + random(10, 50);;
t1 = device.height / 200
var points = [random(600, 1200)];
x1 = x + t1;
y1 = y - t1;
//log(x1, y1);
for (var i = 50; i > 0; i--) {
var arr = ["0.05", "0.03", "0.04", "-0.01"]
var item = arr[Math.floor(Math.random() * arr.length)];
x1 = x1 + t1 * i / 3 * item;
y1 = y1 - t1 * -3;
points.push([x1, y1])
}
// log(points);
gesture.apply(null, points);
}//曲线划屏向下
function 等待打开首页() {
while (true) {
if (text("首页").exists() && text("").exists() && text("消息").exists() && text("推荐").exists()) {
log("抖音首页=已打开")
//1234定义搜索范围
toppage = Number((text("首页").findOne().bounds().top)) + 10
toastLog("坐标"+toppage)
break;
}
sleep(1000)
}
}
function 弹窗检测() {
if (textContains('正在尝试开启').exists()) {
text('允许').click();
sleep(1000);
}
sleep(50);
if (text("跳过广告").exists()) {
sleep(100)
press(text("跳过广告").findOnce().bounds().centerX() + random(-5, 5), text("跳过广告").findOnce().bounds().centerY() + random(-5, 5), 1)
log("==有广告==");
}
sleep(50);
if (text("好友推荐").exists()) {
sleep(100)
back();
log("==好友推荐==");
}
sleep(50);
if (className("android.widget.TextView").text("立即升级").exists()) {
sleep(100)
text("以后再说").click();
log("==有升级==");
sleep(1000);
};
sleep(50);
if (className("android.widget.TextView").text("进入儿童/青少年模式").exists()) {
text("我知道了").click();
log("==有青少年模式==");
};
sleep(50);
//log("3");
if (textContains("个人信息保护指引").exists()) {
textContains("好的").findOnce().click();
log("==个人信息保护指引==");
};
sleep(50);
if (textContains("对方已设置为私密帐号").exists()) {
press(text("知道了").findOnce().bounds().centerX() + random(-5, 5), text("知道了").findOnce().bounds().centerY() + random(-5, 5), 1)
log("==私密帐号==");
sleep(1000)
}
sleep(50);
} //抖音弹窗
function 收藏() {
for (i = 0; i < 10; i++) {
//log(i)
try {
if (descContains("分享,按钮").exists()) {
var 转发bottom = descContains("分享,按钮").findOnce(i).bounds().bottom
if (device.height > 转发bottom && 转发bottom > 0) {
press(descContains("分享,按钮").findOnce(i).bounds().centerX() + random(-5, 5), descContains("分享,按钮").findOnce(i).bounds().centerY() + random(-5, 5), 1)
sleep(1000)
press(text("收藏").findOnce().bounds().centerX() + random(-5, 5), text("收藏").findOnce().bounds().centerY() + random(-5, 5), 1)
sleep(1000)
break;
}
}
} catch (error) {
}
//log("1111")
}
}
function 转发() {
for (i = 0; i < 10; i++) {
// log(i)
if (descContains("分享,按钮").exists()) {
var 转发bottom = descContains("分享,按钮").findOnce(i).bounds().bottom
if (device.height > 转发bottom && 转发bottom > 0) {
press(descContains("分享,按钮").findOnce(i).bounds().centerX() + random(-5, 5), descContains("分享,按钮").findOnce(i).bounds().centerY() + random(-5, 5), 1)
sleep(1000)
press(text("转发").findOnce().bounds().centerX() + random(-5, 5), text("转发").findOnce().bounds().centerY() + random(-5, 5), 1)
sleep(1000)
if (textContains("有爱转发").exists()) {
sleep(1000)
// let arrdrawingOrder = ["5", "6", "7", "8"]
// let arrcolumn = ["0", "1", "2", "3"]
let forwardrandom = random(5, 8)
// if (forwardrandom == 1) {
// a = forwardrandom
// b = a - 1
// }
// if (forwardrandom == 2) {
// a = forwardrandom
// b = a - 1
// }
// if (forwardrandom == 3) {
// a = forwardrandom
// b = a - 1
// }
// if (forwardrandom == 4) {
// a = forwardrandom
// b = a - 1
// }
if (forwardrandom == 5) {
a = forwardrandom - 4
b = a - 1
}
if (forwardrandom == 6) {
a = forwardrandom - 4
b = a - 1
}
if (forwardrandom == 7) {
a = forwardrandom - 4
b = a - 1
}
if (forwardrandom == 8) {
a = forwardrandom - 4
b = a - 1
}
forwarbounds = drawingOrder(a).column(b).findOnce().bounds()
press(forwarbounds.centerX() + random(-5, 5), forwarbounds.centerY() + random(5, 10), 1)
sleep(random(1000, 2000))
press(forwarbounds.centerX() + random(-5, 5), forwarbounds.centerY() + random(5, 10), 1)
break;
}
}
}
//log("1111")
}
}
function 关注作者() {
let object = desc("关注").find();
//关注识别
if (!object.empty()) {
//log("找到啦");
object.forEach(function (currentValue, index) {
var gzfu = currentValue.bounds()
if (gzfu.bottom < device.height - 200 && gzfu.bottom > 200 && gzfu.top < device.height - 200) {
press(gzfu.centerX() + random(-5, 5), gzfu.centerY() + random(-5, 5), 1)
sleep(500)
}
});
}
}
function 自定义文案() {
var comment1 = ui.comment1.text()
//var comment = "大家好#有需要的请来我们这里#一定能帮助到你!"
var arrcomment = comment1.split(/,|,|#/);
if (typeof arrcomment == "undefined" || arrcomment == null || arrcomment == "") {
log("没有设置文案内容,请前往设置再重新开启")
sleep(2000)
alert("提示", "没有设置文案内容,请前往设置再重新开启," + "\n" + "软件已停止运行")
console.hide()
exit()
} else {
}
var commentlong = arrcomment.length
var randomcomment = random(0, commentlong - 1)
let pic = ["[捂脸]", "[666]", "[伤心]", "[赞][赞]", "[看][看]", "[流泪]", "[灵光一闪]", "[耶][耶]", "[右边]", "[调皮]", "[抠鼻][抠鼻]", "[比心][比心]"]
let piclong = pic.length - 1
let picnum = random(0, piclong)
自定义话术 = arrcomment[randomcomment] + pic[picnum];
//log(自定义话术)
}
function 推荐直播间(){
while (true) {
if (textContains("点击进入直播间").exists()) { //需要进入直播间
let liveroom = textContains("点击进入直播间").findOnce().bounds()
log(liveroom)
if (liveroom.top < device.height - 200 && liveroom.bottom < device.height - 200 && liveroom.top > 200 && liveroom.bottom > 200) {
while (true) {
if (textContains("小时榜").exists() && textContains("说点什么").exists()) {
log("正在直播间")
break;
} else {
press(device.width / 2, device.height / 2, 1)
log("点击进入直播间")
sleep(random(2000, 3000))
}
}
break;
} else {
log("直播间不可见")
break;
}
} else {
log("没有直播间")
}
}
// sleep(60 * 1000);//1分钟后开始点赞
let time3 = ui.liveroomtime.text()
let livetime1 = new Date().getTime();
if (textContains("小时榜").exists() && textContains("说点什么").exists()) {
log("正在直播间")
while (true) {
let livetime2 = new Date().getTime();
let livetime3 = livetime2 - livetime1
log("停留时长:"+time3+"分钟/已耗时:"+Math.trunc(livetime3/60000)+"")
log("进入点赞功能")
sleep(random(30000, 90000))
press(device.width * 0.7 + random(30, 100), device.height / 2 + random(30, 100), 1)
sleep(random(100, 150))
press(device.width * 0.7 + random(30, 100), device.height / 2 + random(30, 100), 1)
sleep(random(100, 150))
press(device.width * 0.7 + random(30, 100), device.height / 2 + random(30, 100), 1)
log("随机点赞")
if (textContains("直播结束").exists()) {
log("直播结束,退出")
break;
}
if (livetime3 > time3*60*1000) {
log("时间到,退出")
while (true) {
if (textContains("小时榜").exists() && textContains("说点什么").exists()) {
let 退出直播 = desc("退出直播").findOnce().bounds()
press(退出直播.centerX(), 退出直播.centerY(), 1)
sleep(2000)
} else {
log("退出成功")
break;
}
}
break;
}
}
}
}
function 直播广场() {
console.hide()
if (desc("直播").exists) {
while (true) {
if (textContains("小时榜").exists() && textContains("说点什么").exists()) {
log("正在广场")
console.show()
break;
} else {
try {
let livetxet = desc("直播").findOnce().bounds()
press(livetxet.centerX(), livetxet.centerY(), 1)
log("点击进入直播广场")
sleep(3000)
} catch (error) {
}
}
}
for (let i = 0; i < random(5, 9); i++) {
向上曲线滑动()
log("向上划动")
sleep(2000)
if (text("等待连线").exists()) {
向上曲线滑动()
log("向上划动")
}
sleep(random(10000, 30000))
}
}
let livetime1 = new Date().getTime();
if (textContains("小时榜").exists() && textContains("说点什么").exists()) {
log("正在直播间")
while (true) {
let time3 =ui.liveroomtime.text();
let livetime2 = new Date().getTime();
let livetime3 = livetime2 - livetime1
log("停留时长:"+time3+"分钟/已耗时:"+Math.trunc(livetime3/60000)+"")
log("进入点赞功能")
sleep(random(30000, 90000))
press(device.width * 0.7 + random(30, 100), device.height / 2 + random(30, 100), 1)
sleep(random(100, 150))
press(device.width * 0.7 + random(30, 100), device.height / 2 + random(30, 100), 1)
sleep(random(100, 150))
press(device.width * 0.7 + random(30, 100), device.height / 2 + random(30, 100), 1)
log("随机点赞")
if (textContains("直播结束").exists()||textContains("首页").exists()) {
log("直播结束,退出")
break;
}
if (livetime3 > time3*60*1000) {
log("时间到,退出")
while (true) {
if (textContains("小时榜").exists() && textContains("说点什么").exists()) {
let 退出直播 = desc("退出直播").findOnce().bounds()
press(退出直播.centerX(), 退出直播.centerY(), 1)
sleep(2000)
} else {
log("退出成功")
break;
}
}
break;
}
}
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化