加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dybsy.js 46.87 KB
一键复制 编辑 原始数据 按行查看 历史
鹤鸣悠香 提交于 2020-10-12 19:07 . update dybsy.js.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219
"ui";
//脚本本身没加密,你看到了就看到了吧,别外传就行.更多项目请联系九黎qq1906507927商谈合作事宜
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="1点子网络-稳定高级版" />
<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>
);
function clickui(ui) {
if (ui.exists()) {
var a = ui.findOnce();
if (a) {
var b = a.bounds();
if (b) {
click(b.centerX(), b.centerY());
return true;
}
}
}
return false;
}
var like = Number(ui.like.text())
//=======================以下为执行====
//=========================允许检测是否打开无障碍=========================
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 发表图标 = id("ai_").findOnce()
} catch (error) {
log("出现错误,但是九黎修复了")
continue
}
sleep(1000)
}
clickui(id("ai_"))
sleep(random(1000, 3000))
}
sleep(random(800, 1500));
back();
sleep(random(500, 1000));
back();
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(500);
if (text("跳过广告").exists()) {
sleep(100)
press(text("跳过广告").findOnce().bounds().centerX() + random(-5, 5), text("跳过广告").findOnce().bounds().centerY() + random(-5, 5), 1)
log("==有广告==");
}
sleep(500);
if (text("好友推荐").exists()) {
sleep(100)
back();
log("==好友推荐==");
}
sleep(500);
if (className("android.widget.TextView").text("立即升级").exists()) {
sleep(100)
text("以后再说").click();
log("==有升级==");
sleep(1000);
};
sleep(500);
if (className("android.widget.TextView").text("进入儿童/青少年模式").exists()) {
text("我知道了").click();
log("==有青少年模式==");
};
sleep(500);
//log("3");
if (textContains("个人信息保护指引").exists()) {
textContains("好的").findOnce().click();
log("==个人信息保护指引==");
};
sleep(500);
if (textContains("对方已设置为私密帐号").exists()) {
press(text("知道了").findOnce().bounds().centerX() + random(-5, 5), text("知道了").findOnce().bounds().centerY() + random(-5, 5), 1)
log("==私密帐号==");
sleep(1000)
}
sleep(500);
} //抖音弹窗
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;
}
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化