"ui";
var myAPP = {};
myAPP.title = "抖音关注私信"
myAPP.packageName = "com.ss.android.ugc.aweme"
myAPP.appVersion = "7.4.0"
myAPP.characteristic = "xxxxx"
myAPP.mainMenu = 0
myAPP.taskNum = 0
myAPP.totalNum = "5000"
myAPP.every = "10"
myAPP.suspend = "60"
myAPP.delayMin = "1"
myAPP.delayMax = "3"
myAPP.findTimeout = "1"
myAPP.taskTimeout = "60"
myAPP.isMale = false
myAPP.isLady = false
myAPP.isNoOne = false
myAPP.isNickStart = false
myAPP.isSignEnd = false
myAPP.talking01 = "一只刚上线的小可爱~"
myAPP.talking02 = ""
myAPP.talking03 = ""
ui.layout(
<ScrollView>
<vertical>
<appbar>
<toolbar id="toolbar" title="{{myAPP.title}}" />
</appbar>
<card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical padding="18 8" h="auto">
<linear>
<Switch id="autoService" text="无障碍服务:" checked="{{auto.service != null}}" w="auto" textStyle="bold" />
</linear>
</vertical>
<View bg="#E51400" h="*" w="5" />
</card>
<card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical padding="18 8" h="auto">
<linear>
<text text="功能选择:" textColor="black" w="auto" />
<spinner id="mainMenu" entries="关注|私信|关注私信" spinnerMode="dialog" />
</linear>
</vertical>
<View bg="#dddddd" h="*" w="3" />
</card>
<card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical padding="18 8" h="auto">
<linear>
<text text="性别选择:" textColor="black" w="auto" />
<checkbox id="isMale" checked="{{myAPP.isMale}}" text="男" w="auto" marginLeft="10" />
<checkbox id="isLady" checked="{{myAPP.isLady}}" text="女" w="auto" marginLeft="10" />
<checkbox id="isNoOne" checked="{{myAPP.isNoOne}}" text="无" w="auto" marginLeft="10" />
</linear>
</vertical>
<View bg="#dddddd" h="*" w="3" />
</card>
<card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical padding="18 8" h="auto">
<linear>
<text text="计划运行:" textColor="black" w="auto" />
<input id="totalNum" color="black" inputType="number" w="60" />
<text text="个后,停止" textColor="black" w="auto" />
</linear>
<linear>
<text text="每执行:" textColor="black" w="auto" />
<input id="every" color="black" inputType="number" w="60" />
<text text="个,暂停" textColor="black" w="auto" />
<input id="suspend" color="black" inputType="number" w="60" />
<text text="秒" textColor="black" w="auto" />
</linear>
<linear>
<text text="任务间隔:" textColor="black" w="auto" />
<input id="delayMin" color="black" inputType="numberDecimal" w="60" />
<text text="~" textColor="black" w="auto" />
<input id="delayMax" color="black" inputType="numberDecimal" w="60" />
<text text="秒" textColor="black" w="auto" />
</linear>
<linear>
<text text="任务超时:" textColor="black" w="auto" />
<input id="taskTimeout" color="black" inputType="number" w="60" />
<text text="秒" textColor="black" w="auto" />
</linear>
</vertical>
<View bg="#dddddd" h="*" w="3" />
</card>
<card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical padding="10 8" h="auto">
<linear>
<checkbox id="isNickStart" checked="{{myAPP.isNickStart}}" text="" w="auto" />
<text text="话术前添加昵称" textColor="black" w="auto" />
</linear>
<linear>
<checkbox id="isSignEnd" checked="{{myAPP.isSignEnd}}" text="" w="auto" />
<text text="话术后添加随机符号表情" textColor="black" w="auto" />
</linear>
</vertical>
<View bg="#dddddd" h="*" w="3" />
</card>
<card w="*" h="auto" margin="10 5" cardCornerRadius="2dp" cardElevation="1dp" gravity="center_vertical">
<vertical padding="18 8" h="auto">
<linear>
<text text="话术内容:" textColor="black" w="auto" />
<input id="talking01" color="black" inputType="number" w="*" />
</linear>
<linear>
<text text="话术内容:" textColor="black" w="auto" />
<input id="talking02" color="black" inputType="number" w="*" />
</linear>
<linear>
<text text="话术内容:" textColor="black" w="auto" />
<input id="talking03" color="black" inputType="number" w="*" />
</linear>
</vertical>
<View bg="#dddddd" h="*" w="3" />
</card>
<button style="Widget.AppCompat.Button.Colored" margin="10" id="start">启动</button>
</vertical>
</ScrollView>
);
getData(true);
threads.start(function () {
if (!requestScreenCapture()) {
log("请求截图失败");
exit();
} else {
log("请求截图成功");
}
});
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.start.on("click", () => {
saveData();
getData(false);
if (auto.service == null) {
toastLog("请先开启无障碍服务!");
return;
};
events.setKeyInterceptionEnabled("volume_up", true);
events.observeKey();
events.onKeyDown("volume_up", () => {
toastLog('按音量键停止');
exit();
});
threads.start(function () {
main()
});
});
function main() {
app.launch(myAPP.packageName)
waitForActivity("com.netease.vopen.activity.SigFragmentActivity")
sleep(random(parseInt(myAPP.delayMin), parseInt(myAPP.delayMax)) * 1000)
var date1 = new Date(), date2
toastLog("开始执行")
while (true) {
if (textEndsWith("的粉丝").exists()) {
log("当前在粉丝列表页面")
var object = id("friends_name").find();
if (!object.empty()) {
var 是否执行 = false
var 是否私信 = false
object.forEach(function (currentValue, index) {
log("当前用户名:" + currentValue.text())
var farther = currentValue.parent().parent().parent()
if (farther.clickable()) {
if (farther.click()) {
sleep(random(parseInt(myAPP.delayMin), parseInt(myAPP.delayMax)) * 1000)
log("开始判断性别")
var sex = APP_取用户性别()
if (myAPP.isMale && myAPP.isLady && myAPP.isNoOne) {
是否执行 = true
} else if (myAPP.isMale && myAPP.isLady) {
if (sex == 1 || sex == 0) {
是否执行 = true
}
} else if (myAPP.isMale && myAPP.isNoOne) {
if (sex == 1 || sex == 2) {
是否执行 = true
}
} else if (myAPP.isLady && myAPP.isNoOne) {
if (sex == 0 || sex == 2) {
是否执行 = true
}
} else if (myAPP.isMale && sex == 1) {
是否执行 = true
} else if (myAPP.isLady && sex == 0) {
是否执行 = true
} else if (myAPP.isNoOne && sex == 2) {
是否执行 = true
} else {
toastLog("Error:请设置性别")
};
if (是否执行) {
if (myAPP.mainMenu == "0") {
if (APP_关注用户()) {
log("关注成功")
myAPP.taskNum++;
date1 = new Date();
sleep(random(parseInt(myAPP.delayMin), parseInt(myAPP.delayMax)) * 1000)
}
} else if (myAPP.mainMenu == "1") {
是否私信 = true
} else if (myAPP.mainMenu == "2") {
APP_关注用户()
是否私信 = true
};
if (是否私信) {
if (APP_发送文本私信()) {
log("私信成功")
myAPP.taskNum++;
date1 = new Date();
sleep(random(parseInt(myAPP.delayMin), parseInt(myAPP.delayMax)) * 1000)
};
};
};
};
if (id("timeline_profile_msg_btn").exists()) {
id("back_actionbar").click()
sleep(random(parseInt(myAPP.delayMin), parseInt(myAPP.delayMax)) * 1000)
};
};
});
} else {
toastLog("Error:没找到╭(╯^╰)╮");
};
} else {
toastLog("Error:不在粉丝列表页面")
};
if (textEndsWith("的粉丝").exists()) {
id("list").findOne().scrollForward()
};
};
};
function saveData() {
setStorageData(myAPP.characteristic, "mainMenu", ui.mainMenu.getSelectedItemPosition())
setStorageData(myAPP.characteristic, "totalNum", ui.totalNum.text())
setStorageData(myAPP.characteristic, "every", ui.every.text())
setStorageData(myAPP.characteristic, "suspend", ui.suspend.text())
setStorageData(myAPP.characteristic, "delayMin", ui.delayMin.text())
setStorageData(myAPP.characteristic, "delayMax", ui.delayMax.text())
setStorageData(myAPP.characteristic, "taskTimeout", ui.taskTimeout.text())
setStorageData(myAPP.characteristic, "isMale", ui.isMale.isChecked())
setStorageData(myAPP.characteristic, "isLady", ui.isLady.isChecked())
setStorageData(myAPP.characteristic, "isNoOne", ui.isNoOne.isChecked())
setStorageData(myAPP.characteristic, "isNickStart", ui.isNickStart.isChecked())
setStorageData(myAPP.characteristic, "isSignEnd", ui.isSignEnd.isChecked())
setStorageData(myAPP.characteristic, "talking01", ui.talking01.text())
setStorageData(myAPP.characteristic, "talking02", ui.talking02.text())
setStorageData(myAPP.characteristic, "talking03", ui.talking03.text())
};
function getData(isSetVlue) {
if (getStorageData(myAPP.characteristic, "mainMenu") != undefined) {
myAPP.mainMenu = getStorageData(myAPP.characteristic, "mainMenu")
isSetVlue && ui.mainMenu.setSelection(myAPP.mainMenu);
};
if (getStorageData(myAPP.characteristic, "totalNum") != undefined) {
myAPP.totalNum = getStorageData(myAPP.characteristic, "totalNum")
};
isSetVlue && ui.totalNum.setText(myAPP.totalNum);
if (getStorageData(myAPP.characteristic, "every") != undefined) {
myAPP.every = getStorageData(myAPP.characteristic, "every")
};
isSetVlue && ui.every.setText(myAPP.every);
if (getStorageData(myAPP.characteristic, "suspend") != undefined) {
myAPP.suspend = getStorageData(myAPP.characteristic, "suspend")
};
isSetVlue && ui.suspend.setText(myAPP.suspend);
if (getStorageData(myAPP.characteristic, "delayMin") != undefined) {
myAPP.delayMin = getStorageData(myAPP.characteristic, "delayMin")
};
isSetVlue && ui.delayMin.setText(myAPP.delayMin);
if (getStorageData(myAPP.characteristic, "delayMax") != undefined) {
myAPP.delayMax = getStorageData(myAPP.characteristic, "delayMax")
};
isSetVlue && ui.delayMax.setText(myAPP.delayMax);
if (getStorageData(myAPP.characteristic, "taskTimeout") != undefined) {
myAPP.taskTimeout = getStorageData(myAPP.characteristic, "taskTimeout")
};
isSetVlue && ui.taskTimeout.setText(myAPP.taskTimeout);
if (getStorageData(myAPP.characteristic, "isMale") != undefined) {
myAPP.isMale = getStorageData(myAPP.characteristic, "isMale")
};
isSetVlue && ui.isMale.setChecked(myAPP.isMale);
if (getStorageData(myAPP.characteristic, "isLady") != undefined) {
myAPP.isLady = getStorageData(myAPP.characteristic, "isLady")
};
isSetVlue && ui.isLady.setChecked(myAPP.isLady);
if (getStorageData(myAPP.characteristic, "isNoOne") != undefined) {
myAPP.isNoOne = getStorageData(myAPP.characteristic, "isNoOne")
};
isSetVlue && ui.isNoOne.setChecked(myAPP.isNoOne);
if (getStorageData(myAPP.characteristic, "isNickStart") != undefined) {
myAPP.isNickStart = getStorageData(myAPP.characteristic, "isNickStart")
};
isSetVlue && ui.isNickStart.setChecked(myAPP.isNickStart);
if (getStorageData(myAPP.characteristic, "isSignEnd") != undefined) {
myAPP.isSignEnd = getStorageData(myAPP.characteristic, "isSignEnd")
};
isSetVlue && ui.isSignEnd.setChecked(myAPP.isSignEnd);
if (getStorageData(myAPP.characteristic, "talking01") != undefined) {
myAPP.talking01 = getStorageData(myAPP.characteristic, "talking01")
};
isSetVlue && ui.talking01.setText(myAPP.talking01);
if (getStorageData(myAPP.characteristic, "talking02") != undefined) {
myAPP.talking02 = getStorageData(myAPP.characteristic, "talking02")
};
isSetVlue && ui.talking02.setText(myAPP.talking02);
if (getStorageData(myAPP.characteristic, "talking03") != undefined) {
myAPP.talking03 = getStorageData(myAPP.characteristic, "talking03")
};
isSetVlue && ui.talking03.setText(myAPP.talking03);
};
function APP_取用户昵称() {
var nickName = ""
let object = className("TextView").depth(17).find();
if (!object.empty()) {
object.forEach(function (currentValue, index) {
if (index == 0) {
nickName = currentValue.text()
}
});
} else {
log("没找到╭(╯^╰)╮");
};
return nickName
};
function APP_取用户性别() {
let objectAge = textEndsWith("岁").depth(18).findOne(1000)
let objectMan = textEndsWith("男").depth(18).findOne(1000)
let objectWomen = textEndsWith("女").depth(18).findOne(1000)
if (objectAge != null || objectMan != null || objectWomen != null) {
var rect;
if (objectAge != null) {
rect = objectAge.bounds()
} else if (objectMan != null) {
rect = objectMan.bounds()
} else if (objectWomen != null) {
rect = objectWomen.bounds()
};
var img = captureScreen();
var point = findColor(img, -16148307, {
region: [rect.left, rect.top, rect.width(), rect.height()],
threshold: 4
});
if (point) {
log("找到蓝色啦:" + point);
return 1
} else {
log("没找到蓝色,开始寻找粉色");
var point = findColor(img, -3390887, {
region: [rect.left, rect.top, rect.width(), rect.height()],
threshold: 4
});
if (point) {
log("找到粉色啦:" + point);
return 0
} else {
log("没找到粉色,该用户未设置性别");
return 2
}
};
} else {
log("Error:未获取到性别节点")
}
return 2
};
function APP_关注用户() {
var isFollow = false
let object = text("关注").depth(18).findOne(1000)
if (object != null) {
if (object.clickable()) {
object.click();
sleep(random(1000, 3000))
if (findNode("text", "取消关注")) {
log("关注成功")
isFollow = true
} else if (findNode("text", "已请求")) {
log("已请求关注,关注失败.这是私密账号")
} else {
log("关注失败")
}
} else {
log("关注节点不可点击")
}
} else if (findNode("text", "取消关注")) {
log("已关注,无需执行关注")
} else if (findNode("text", "已请求")) {
log("已请求关注,无需执行关注.这是私密账号")
} else {
log("未找到关注按钮,可能已关注或APP版本不符合")
}
return isFollow
};
function APP_取随机话术() {
var talkings = Array()
if (myAPP.talking01 != "") {
talkings.push(myAPP.talking01)
}
if (myAPP.talking02 != "") {
talkings.push(myAPP.talking02)
}
if (myAPP.talking03 != "") {
talkings.push(myAPP.talking03)
}
return talkings[random(0, talkings.length - 1)]
};
function APP_取随机符号表情() {
var arr = ["o(╯□╰)o", "╯▂╰", "╯0╰", "⊙﹏⊙", "˙▽˙", "⊙▂⊙", "⊙0⊙", "ゃōゃ", "●0●", "∪ω∪", "(^人^)"]
return arr[random(0, arr.length - 1)]
};
function APP_发送文本私信() {
var 执行结果 = false
waitForActivity("com.netease.vopen.timeline.ui.UserTimelineActivity")
var nickName = APP_取用户昵称()
var talking = APP_取随机话术()
if (id("timeline_profile_msg_btn").exists()) {
id("timeline_profile_msg_btn").click()
sleep(random(100, 500))
waitForActivity("com.netease.vopen.im.MessageActivity")
sleep(random(100, 500))
if (id("avatar").exists()) {
log("历史已经发送过")
} else {
if (myAPP.isNickStart) {
talking = nickName + talking
};
if (myAPP.isSignEnd) {
talking = talking + APP_取随机符号表情()
};
setText(talking)
sleep(random(100, 500))
text("发送").click()
执行结果 = true
sleep(random(parseInt(myAPP.delayMin), parseInt(myAPP.delayMax)) * 1000)
};
desc("转到上一层级").click()
sleep(random(parseInt(myAPP.delayMin), parseInt(myAPP.delayMax)) * 1000)
} else {
log("Error:未获取到私信按钮节点")
};
return 执行结果
};
function setStorageData(name, key, value) {
const storage = storages.create(name);
storage.put(key, value);
};
function getStorageData(name, key) {
const storage = storages.create(name);
if (storage.contains(key)) {
return storage.get(key, "");
};
};
function delStorageData(name, key) {
const storage = storages.create(name);
if (storage.contains(key)) {
storage.remove(key);
};
};
function findNode(way, str, timeOut) {
if (!timeOut) { timeOut = 1000 }
let result = false
let object;
if (way == "text") {
object = text(str).findOne(timeOut);
} else if (way == "desc") {
object = desc(str).findOne(timeOut);
} else if (way == "id") {
object = id(str).findOne(timeOut);
} else if (way == "className") {
object = className(str).findOne(timeOut);
} else {
log("Error:findNode-way参数不正确")
}
if (object != null) {
result = true
} else {
}
return result;
};
function clickNodeR(way, str, sleepTime) {
if (!sleepTime) { sleepTime = 1000 }
let result = false
let object;
if (way == "text") {
object = text(str).findOne(1000);
} else if (way == "desc") {
object = desc(str).findOne(1000);
} else if (way == "id") {
object = id(str).findOne(1000);
} else if (way == "className") {
object = className(str).findOne(1000);
} else {
log("Error:clickNodeR-way参数不正确")
}
if (object != null) {
let x = object.bounds().centerX();
let y = object.bounds().centerY();
log(x, y)
if (x > 0 && y > 0) {
result = click(parseInt(x), parseInt(y));
} else {
log("Error:clickNodeR-中心点坐标不在可视区")
}
result && sleep(sleepTime);
} else {
log("Error:clickNodeR-组件不存在/没找到")
}
return result;
};
function clickNode(way, str, sleepTime) {
if (!sleepTime) { sleepTime = 1000 }
let result = false
let object;
if (way == "text") {
object = text(str).findOne(1000);
} else if (way == "desc") {
object = desc(str).findOne(1000);
} else if (way == "id") {
object = id(str).findOne(1000);
} else if (way == "className") {
object = className(str).findOne(1000);
} else {
log("Error:clickNode-way参数不正确")
}
if (object != null) {
if (object.clickable()) {
result = object.click();
result && sleep(sleepTime);
} else {
log("Error:clickNode-组件不可点击")
}
} else {
log("Error:clickNode-组件不存在/没找到")
}
return result;
};