You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.3 KiB

var packageName = "com.xingin.xhs";
// 启动小红书应用
if (app.getAppName(packageName)) {
toast("启动小红书...");
app.launch(packageName);
log("Package launched: " + packageName);
sleep(3000); // 等待应用启动
} else {
toast("找不到小红书应用");
log("Error: 找不到小红书应用");
exit();
}
// 刷新主页
toast('刷新主页面...');
swipe(540, 500, 540, 1500, 500);
sleep(2000);
console.log('主页刷新完成');
// 查找并进入直播区域
var liveAreaButtonText = '直播'; // 确保文本正确
var liveAreaButton = text(liveAreaButtonText).visibleToUser().findOne(10000);
if (liveAreaButton) {
var bounds = liveAreaButton.bounds();
click(bounds.centerX(), bounds.centerY());
sleep(2000);
console.log('已进入直播区域');
} else {
console.error("未找到直播区域按钮: " + liveAreaButtonText);
exit();
}
var specificLiveButtonId = 'com.xingin.xhs:id/eox';
var specificLiveButton = id(specificLiveButtonId).visibleToUser().findOne(2000); // 加长查找等待时间
if (specificLiveButton) {
var bounds = specificLiveButton.bounds();
click(bounds.centerX(), bounds.centerY());
sleep(2000); // 等待直播间加载
console.log('已进入具体直播间');
}