刷直播

This commit is contained in:
2025-08-04 13:07:36 +08:00
parent 4037662497
commit a92c164af1
2 changed files with 96 additions and 39 deletions

View File

@@ -45,9 +45,13 @@ export function createWsActions(wslist) {
search: (udid, index) => send(index, { udid, action: 'click', type: 'search', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' }), //搜索页面
searchHost: (udid, index) => send(index, { udid, action: 'click', type: 'searchHost', index, resourceId: 'com.zhiliaoapp.musically:id/t6f' }), //搜索主播
toHost: (udid, index) => send(index, { udid, action: 'click', type: 'toHost', index, resourceId: 'com.zhiliaoapp.musically:id/iso' }), //进入主页二
toLive: (udid, index) => send(index, { udid, action: 'click', type: 'toLive', index, resourceId: 'com.zhiliaoapp.musically:id/gtz' }), //直播页面
isHead: (udid, index) => send(index, { udid, action: 'click', type: 'isHead', index, resourceId: 'com.zhiliaoapp.musically:id/i32' }), //主播页面
isOneLive: (udid, index) => send(index, { udid, action: 'click', type: 'isOneLive', index, resourceId: 'com.zhiliaoapp.musically:id/s1w' }), //判断是否是单人直播
hostVideo: (udid, index, num) => send(index, { udid, action: 'click', type: 'hostVideo', index, resourceId: 'com.zhiliaoapp.musically:id/d3u', num: num }), //主播视频
test: (udid, index) => send(index, { udid, action: 'test', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/TESTFFFXXX' }), //截屏测试
test2: (udid, index) => send(index, { udid, action: 'dump', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }), //截屏测试
// test2: (udid, index) => send(index, { udid, action: 'dump', type: 'test', index, resourceId: 'com.zhiliaoapp.musically:id/kg4' }), //截屏测试
};
}

View File

@@ -24,7 +24,7 @@
<el-button @click="clickPrivatetext(device.udid, index)">私信输入</el-button>
<el-button @click="clickPrivatePush(device.udid, index)">私信发送</el-button> -->
<el-button type="warning" @click="reload()">刷新</el-button>
<el-button type="warning" @click="opentanchuan()">123</el-button>
<!-- <el-button type="warning" @click="opentanchuan()">123</el-button> -->
<div></div>
<!-- <el-button @click="wsActions.clickCopy(device.udid, index)">找私信</el-button> -->
<!-- <el-button @click="wsActions.clickCopyList(device.udid, index)">私信列表</el-button> -->
@@ -35,6 +35,7 @@
<!-- <el-button @click="wsActions.isHost(device.udid, index)">一键养号</el-button> -->
<el-button type="success" @click="openTk()">打开tiktok</el-button>
<el-button type="success" @click="resetTk()">重置tiktok</el-button>
<el-button type="success" @click="brushLive()">打开直播</el-button>
<el-button :type="runType[0] == 'like' ? 'danger' : 'success'" @click="parentNum()">{{ runType[0] == 'like' ?
'养号中' : '一键养号' }}</el-button>
@@ -45,17 +46,6 @@
<el-button type="danger" @click="stop()">全部停止</el-button>
<el-button type="danger" @click="router.push('/')">登出</el-button>
<div></div>
<div></div>
<!-- <el-button @click="wsActions.test(device.udid, index)">截屏</el-button> -->
<div></div>
<!-- <div></div>
<el-button @click="wsActions.searchHost(device.udid, index)">搜主播</el-button>
<div></div>
<el-button @click="wsActions.toHost(device.udid, index)">主页</el-button>
<div></div>
<el-button @click="LikesToLikesToLikes(device.udid, index)">批量关注</el-button> -->
<div></div>
<!-- <div style="display: flex;">
<div style="width: 150px;">主播id</div>
<el-input style="border: 1px solid #000;" v-model="hostIdContent[index]" type="text"></el-input>
@@ -72,15 +62,8 @@
<el-button @click="setPrivateText(index)">发送</el-button>
</div> -->
<div></div>
<!-- <el-button @click="clickxy(160, 360, index)">开始/暂停</el-button> -->
<div></div>
<!-- <el-button @click="clickxy(284, 392, index, 9)">长按</el-button> -->
<!-- <el-button @click="getText(index)">获取粘贴板内容</el-button> -->
<div></div>
<!-- <el-button @click="LikesToCommentToComPush(device.udid, index)">设置自动化坐标</el-button> -->
<!-- <el-button @click="start(device.udid, index)">开始执行</el-button> -->
<!-- <el-button @click="stop(device.udid, index)">停止</el-button> -->
<div></div>
<!-- <el-button @click="wsActions.isVideoAndLive(device.udid, index)">判断视频还是直播</el-button> -->
</div>
</el-scrollbar>
@@ -119,7 +102,8 @@
<el-button @click="setComText(index)">发送</el-button>
</div>
<el-button @click="wsActions.test(device.udid, index)">打印ui节点树</el-button>
<el-button @click="wsActions.test2(device.udid, index)">等待</el-button>
<el-button @click="wsActions.isOneLive(device.udid, index)">判断单人还是双人</el-button>
<el-button @click="wsActions.slideDown(device.udid, index)">下滑</el-button>
<el-button @click="wsActions.killNow(device.udid, index)">关闭当前应用</el-button>
<el-button @click="chooseFile(device.udid, index, 1, wsActions)">安装 APK 文件</el-button>
<el-button @click="chooseFile(device.udid, index, 2, wsActions)">传送文件</el-button>
@@ -265,12 +249,7 @@ const initVideoStream = (udid, index) => {
setTimeout(() => {
wslist[index].send(openStr);
}, 300);
// playTimer.value[index] = setTimeout(() => {
// instanceList.value[index].converter.play();
// }, 3000);
//``````````````````````````````````````````````````````````````````````````````````
wsCache.set(udid, instanceList.value[index]);
//``````````````````````````````````````````````````````````````````````````````````
};
const magicSize = stringToUtf8ByteArray('scrcpy_message');
// 3. 处理接收到的二进制数据
@@ -351,8 +330,11 @@ const initVideoStream = (udid, index) => {
console.log('尺寸系数', iponeCoefficient.value[index])
} else {
console.log(resData.type, '坐标返回x:', resData.x, 'y:', resData.y);
// clickxy(resData.x * 0.3, resData.y * 0.3, index)
}
phoneXYinfo.value[index].id = resData.udid
if (resData.type == 'Likes') {//判断是否是 点赞
phoneXYinfo.value[index].Likes = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
@@ -366,9 +348,6 @@ const initVideoStream = (udid, index) => {
textContent.value[index] = resData.message
} else if (resData.type == 'Comtext') {//评论输入
phoneXYinfo.value[index].Comtext = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
// setTimeout(() => {
// setComText(index)//粘贴内容
// }, 1000)
} else if (resData.type == 'ComPush') {//评论发送
phoneXYinfo.value[index].ComPush = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
setTimeout(() => {
@@ -394,10 +373,6 @@ const initVideoStream = (udid, index) => {
// LikesToCommentToComPush(deviceInformation.value[index].udid, index) //是否继续循环任务
} else if (resData.type == 'return') {//私信评论
phoneXYinfo.value[index].return = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
// wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
// setTimeout(() => {
// LikesToCommentToComPush(deviceInformation.value[index].udid, index)
// }, 1000);
} else if (resData.type == 'addHost') {//添加关注
phoneXYinfo.value[index].addHost = { x: resData.x * iponeCoefficient.value[index].width, y: resData.y * iponeCoefficient.value[index].height }
wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
@@ -455,7 +430,8 @@ const initVideoStream = (udid, index) => {
} else if (resData.message == 1) {
console.log('有关注', index)
const randomNum = Math.random(); // 生成一个0到1之间的随机数
if (randomNum < 0.6) {
//是否点赞评论的概率
if (randomNum < 0.07) {
console.log('进行点赞评论', index)
LikesToCommentToComPush(deviceInformation.value[index].udid, index)
} else {
@@ -466,7 +442,56 @@ const initVideoStream = (udid, index) => {
}
} else if (resData.type == 'openDY') {//视频关注主播
createTaskQueue(index).clear();//清除队伍中的任务
} else if (resData.type == 'toLive') {//打开直播
wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播
} else if (resData.type == 'isHead') {//判断有没有头像
if (resData.message == 1) {
wsActions.isOneLive(deviceInformation.value[index].udid, index)//判断直播
} else {
return
}
} else if (resData.type == 'isOneLive') {//判断单人还是双人
if (resData.message == 0) {
wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播
return
}
// 用法:
(async () => {
const result = await randomDelayAndExecute();
//30%概率
if (result) {
let count = 0;
const num = Math.floor(Math.random() * 31) + 5;
const interval = setInterval(() => {
if (count >= num) {
clearInterval(interval);
wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播
return;
}
clickxy(
resData.x * iponeCoefficient.value[index].width,
resData.y * iponeCoefficient.value[index].height,
index
)
count++;
}, 300);
return;
} else {
wsActions.slideDown(deviceInformation.value[index].udid, index)//是否继续下一个视频
wsActions.isHead(deviceInformation.value[index].udid, index)//判断直播
return
}
})();
}
setphoneXYinfo(phoneXYinfo.value)
if (resData.type != 'isHost') {
if (resData.type == 'hostVideo' || resData.type == 'Likes') {
@@ -784,10 +809,11 @@ onMounted(() => {
} else {
stroageHost.value = getHostList()
stroageHost.value.push(({ country: data.country, text: data.hostsId, state: false }))
setHostList(stroageHost.value)
if (isMsgPop.value) {
setHostList(stroageHost.value)
}
}
//更新状态
// update(
// {
@@ -1260,6 +1286,27 @@ function randomSeeVideo(udid, index) {
wsActions.isHost(udid, index)//检测
}, delay);
}
//延迟3-4分钟后秒后检测关注
async function randomDelayAndExecute() {
const minDelay = 1 * 60 * 1000;
const maxDelay = 4 * 60 * 1000;
const randomDelay = Math.floor(Math.random() * (maxDelay - minDelay + 1)) + minDelay;
console.log(`将延迟 ${Math.round(randomDelay / 1000)} 秒后执行...`);
return new Promise((resolve) => {
setTimeout(() => {
const randomNum = Math.floor(Math.random() * 100);
if (randomNum < 30) {
console.log("30%概率触发");
resolve(true);
} else {
console.log("70%概率触发");
resolve(false);
}
}, randomDelay);
});
}
//选中样式
function getVideoStyle(index) {
@@ -1345,7 +1392,13 @@ function parentNum() {
wsActions.isHost(device.udid, index)
})
}
function brushLive() {
isStop.value = false;
deviceInformation.value.forEach((device, index) => {
// runType.value[index] = 'brushLive'
wsActions.toLive(device.udid, index)
})
}
//确认多行文本框内容
function onDialogConfirm(result, type, index) {
console.log(result, type, index);