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.
53 lines
1.8 KiB
53 lines
1.8 KiB
3 weeks ago
|
// 等待Auto.js无障碍服务启动
|
||
|
auto.waitFor();
|
||
|
|
||
|
// 启动小红书应用
|
||
|
function openXiaoHongShu() {
|
||
|
console.log("启动小红书...");
|
||
|
app.launchApp('小红书');
|
||
|
sleep(5000); // 等待应用加载
|
||
|
}
|
||
|
|
||
|
// 进入发帖页面
|
||
|
function enterPostPage() {
|
||
|
console.log("查找发帖入口...");
|
||
|
// 假设小红书发帖按钮的描述为“+”,可以通过调试工具确认
|
||
|
id("dy5").findOne().click();
|
||
|
console.log('进入发帖页面');
|
||
|
let searchButton = id("bfp").text("文字").findOne(); // 假设按钮的文本为“文字”
|
||
|
searchButton.click();
|
||
|
console.log('进入编辑文字页面');
|
||
|
id("cbn").findOne().click();
|
||
|
console.log('编辑文字');
|
||
|
}
|
||
|
|
||
|
function searchAndEnterLiveRoom(keyword) {
|
||
|
console.log("编辑内容");
|
||
|
setText(keyword); // 输入直播间关键词
|
||
|
console.log("输入关键词:" + keyword);
|
||
|
sleep(1000);
|
||
|
|
||
|
// 点击搜索按钮
|
||
|
let searchButton1 = text("下一步").findOne(); // 假设搜索按钮的文本为“搜索”
|
||
|
searchButton1.click();
|
||
|
console.log("下一步");
|
||
|
sleep(5000);
|
||
|
let searchButton2 = text("下一步").findOne(); // 假设搜索按钮的文本为“搜索”
|
||
|
searchButton2.click();
|
||
|
console.log("下一步");
|
||
|
let searchButton3 = text("发布笔记").findOne(); // 假设搜索按钮的文本为“搜索”
|
||
|
searchButton3.click();
|
||
|
console.log("发布笔记");
|
||
|
}
|
||
|
// 主函数:启动小红书,进入发帖页面,编辑内容并发布
|
||
|
function main() {
|
||
|
openXiaoHongShu(); // 启动小红书
|
||
|
sleep(1000);
|
||
|
enterPostPage(); // 进入发帖页面
|
||
|
sleep(1000);
|
||
|
searchAndEnterLiveRoom("你好");
|
||
|
}
|
||
|
|
||
|
// 执行主程序
|
||
|
main();
|