首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >快手直播间自动打字脚本,抖音小红书京东淘宝,autojs自动化框架

快手直播间自动打字脚本,抖音小红书京东淘宝,autojs自动化框架

原创
作者头像
用户11749621
发布2025-07-21 17:44:28
发布2025-07-21 17:44:28
1500
举报

下载地址:https://www.pan38.com/dow/share.php?code=JCnzE 提取密码:6712

代码说明:该脚本包含5个模块文件,支持多平台自动评论功能。使用时需要Auto.js 4.1.1以上版本,建议配合定时任务使用。注意不同平台的UI结构可能随时更新,需要定期维护适配代码。

代码语言:txt
复制

// 主配置参数
const config = {
    platform: "douyin", // 可切换为kuaishou/xiaohongshu/jd/taobao
    commentList: ["666", "太棒了", "点赞关注", "感谢分享"],
    interval: 3000,
    maxRunTime: 3600000
};

// 平台检测模块
function detectPlatform() {
    const activity = currentActivity();
    if (activity.includes("com.ss.android.ugc.aweme")) {
        return "douyin";
    } else if (activity.includes("com.smile.gifmaker")) {
        return "kuaishou";
    } else if (activity.includes("com.xingin.xhs")) {
        return "xiaohongshu";
    } else if (activity.includes("com.jingdong.app.mall")) {
        return "jd";
    } else if (activity.includes("com.taobao.taobao")) {
        return "taobao";
    }
    return null;
}

// 通用输入法控制模块
function inputText(text) {
    setText(0, text);
    sleep(500);
    const input = className("EditText").findOne();
    if (input) {
        input.setText(text);
        sleep(300);
        press("enter");
    }
}

// 抖音直播间自动评论
function douyinLiveComment() {
    while (true) {
        try {
            const commentBtn = text("说点什么...").findOne(1000);
            if (commentBtn) {
                click(commentBtn.bounds().centerX(), commentBtn.bounds().centerY());
                sleep(1500);
                
                const randomIndex = Math.floor(Math.random() * config.commentList.length);
                inputText(config.commentList[randomIndex]);
                
                sleep(config.interval);
            }
        } catch (e) {
            console.error("抖音模块错误:" + e);
            back();
        }
    }
}

// 快手直播间自动互动
function kuaishouLiveInteraction() {
    let lastCommentTime = 0;
    while (true) {
        try {
            const now = new Date().getTime();
            if (now - lastCommentTime > config.interval) {
                const inputArea = desc("和大家说点什么").findOne(1000);
                if (inputArea) {
                    click(inputArea.bounds().centerX(), inputArea.bounds().centerY());
                    sleep(1000);
                    
                    const randomText = config.commentList[
                        Math.floor(Math.random() * config.commentList.length)
                    ];
                    inputText(randomText);
                    lastCommentTime = now;
                }
            }
            // 随机点赞
            if (Math.random() > 0.7) {
                const likeBtn = desc("点赞").findOne(500);
                if (likeBtn) likeBtn.click();
            }
        } catch (e) {
            console.error("快手模块错误:" + e);
        }
        sleep(1000);
    }
}

 防检测随机延迟
function randomDelay(base) {
    const variation = Math.random() * 1000;
    sleep(base + variation);
}

// 屏幕滑动控制
function smartSwipe() {
    const height = device.height;
    const width = device.width;
    const startY = height * 0.8;
    const endY = height * 0.2;
    
    swipe(width / 2, startY, width / 2, endY, 500);
    sleep(2000);
}

// 异常处理
function errorHandler(e) {
    console.error("错误捕获:" + e);
    captureScreen("/sdcard/error_" + new Date().getTime() + ".png");
    stopThread();
}

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
作者已关闭评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档