微信养号脚本,全自动插件,AUTOJS开发版

简介: 这是一套自动化微信养号工具,包含主脚本`wechat_auto.js`与配置文件`config.json`。主脚本实现自动浏览朋友圈、随机阅读订阅号文章及搜索指定公众号三大功能,支持自定义滚动次数、阅读时长等参数。代码通过随机化操作间隔模拟真实用户行为,具备完善的错误处理和日志记录功能。配套UI模块提供可视化操作界面,可实时监控任务状态与运行日志,便于调整参数设置。控制器部分扩展了批量数据处理能力,如学生信息的增删改查操作,适用于多场景应用。下载地址:https://www.pan38.com/share.php?code=n6cPZ 提取码:8888(仅供学习参考)。

下载地址:https://www.pan38.com/share.php?code=n6cPZ 提取码:8888 【仅供学习参考】
代码说明
主脚本(wechat_auto.js)实现了三大核心功能:
自动浏览朋友圈并模拟滚动操作
随机进入订阅号浏览新闻文章
搜索指定公众号并浏览历史文章
配置文件(config.json)允许自定义:
滚动次数和间隔时间
单篇文章阅读时长
脚本最大运行时间
目标公众号列表
脚本特点:
随机化操作间隔,模拟人类行为
多种浏览模式交替进行
完善的错误处理和日志记录
使用说明
安装AutoJS应用并开启无障碍服务
将脚本导入AutoJS
根据需求修改配置文件
运行脚本前确保微信已登录
建议在夜间或空闲时间运行

/**
 * 微信养号自动化脚本
 * 功能:自动浏览朋友圈、公众号文章、新闻等
 */

// 初始化配置
let config = {
    scrollCount: 10,      // 每次滚动次数
    scrollDelay: 2000,    // 滚动间隔(ms)
    readTime: 15000,      // 阅读时长(ms)
    maxRunTime: 3600000   // 最大运行时长(ms,1小时)
};

// 主函数
function main() {
    auto.waitFor();
    console.show();
    log("微信养号脚本启动");

    let startTime = new Date().getTime();

    while (new Date().getTime() - startTime < config.maxRunTime) {
        // 随机选择功能
        let funcIndex = random(1, 3);
        switch(funcIndex) {
            case 1:
                browseMoments();
                break;
            case 2:
                browseNews();
                break;
            case 3:
                browseArticles();
                break;
        }
        sleep(random(5000, 10000)); // 随机间隔
    }

    log("脚本运行完成");
}

// 浏览朋友圈
function browseMoments() {
    log("开始浏览朋友圈");
    launchApp("微信");
    waitForActivity("com.tencent.mm.ui.LauncherUI");

    // 点击发现tab
    let discovery = id("com.tencent.mm:id/f3y").findOne();
    if (discovery) {
        discovery.click();
        sleep(2000);

        // 点击朋友圈
        let moments = text("朋友圈").findOne();
        if (moments) {
            moments.click();
            sleep(3000);

            // 模拟滚动浏览
            for (let i = 0; i < config.scrollCount; i++) {
                scrollDown();
                sleep(config.scrollDelay);
            }
        }
    }
    log("朋友圈浏览完成");
}

// 浏览新闻
function browseNews() {
    log("开始浏览新闻");
    launchApp("微信");
    waitForActivity("com.tencent.mm.ui.LauncherUI");

    // 点击订阅号
    let subscription = text("订阅号").findOne();
    if (subscription) {
        subscription.click();
        sleep(2000);

        // 随机选择一个订阅号
        let accounts = className("android.widget.TextView").find();
        if (accounts && accounts.length > 0) {
            let randomAccount = accounts[random(0, accounts.length - 1)];
            randomAccount.click();
            sleep(3000);

            // 随机选择一篇文章
            let articles = className("android.widget.LinearLayout").find();
            if (articles && articles.length > 0) {
                let randomArticle = articles[random(0, articles.length - 1)];
                randomArticle.click();
                sleep(config.readTime);

                // 模拟阅读行为
                for (let i = 0; i < 3; i++) {
                    scrollDown();
                    sleep(2000);
                }
            }
        }
    }
    log("新闻浏览完成");
}

// 浏览公众号文章
function browseArticles() {
    log("开始浏览公众号文章");
    launchApp("微信");
    waitForActivity("com.tencent.mm.ui.LauncherUI");

    // 点击搜索
    let search = id("com.tencent.mm:id/f3n").findOne();
    if (search) {
        search.click();
        sleep(2000);

        // 输入公众号名称
        let input = id("com.tencent.mm:id/bhn").findOne();
        if (input) {
            input.setText("人民日报");
            sleep(2000);

            // 点击搜索按钮
            let searchBtn = id("com.tencent.mm:id/cj7").findOne();
            if (searchBtn) {
                searchBtn.click();
                sleep(3000);

                // 进入公众号
                let officialAccount = text("进入公众号").findOne();
                if (officialAccount) {
                    officialAccount.click();
                    sleep(3000);

                    // 浏览历史文章
                    let history = text("查看历史消息").findOne();
                    if (history) {
                        history.click();
                        sleep(5000);

                        // 随机滚动浏览
                        for (let i = 0; i < config.scrollCount; i++) {
                            scrollDown();
                            sleep(config.scrollDelay);
                        }
                    }
                }
            }
        }
    }
    log("公众号文章浏览完成");
}

// 辅助函数:向下滚动
function scrollDown() {
    let width = device.width;
    let height = device.height;
    swipe(width / 2, height * 0.7, width / 2, height * 0.3, 500);
}

// 启动脚本
main();

UI部分

/**
 * 微信养号脚本UI控制模块
 * 功能:提供可视化操作界面及状态监控
 */

// UI主界面布局
function createMainUI() {
    let ui = {
        title: "微信养号助手 v2.1",
        width: device.width,
        height: device.height,
        config: {
            theme: "light",
            bg: "#f5f5f5"
        },
        views: [
            // 顶部状态栏
            {
                type: "view",
                layout: "horizontal",
                width: "match",
                height: 60,
                bg: "#07C160",
                children: [
                    {
                        type: "text",
                        text: "微信养号助手",
                        size: 20,
                        color: "#ffffff",
                        marginLeft: 15,
                        gravity: "center_vertical"
                    },
                    {
                        type: "text",
                        text: "已运行: 0分钟",
                        id: "runtime",
                        size: 14,
                        color: "#ffffff",
                        marginRight: 15,
                        gravity: "center_vertical|right"
                    }
                ]
            },

            // 功能按钮区
            {
                type: "view",
                layout: "horizontal",
                width: "match",
                height: 120,
                marginTop: 10,
                children: [
                    {
                        type: "button",
                        text: "开始养号",
                        id: "start_btn",
                        width: "auto",
                        height: "auto",
                        margin: 10,
                        bg: "#07C160",
                        color: "#ffffff"
                    },
                    {
                        type: "button",
                        text: "停止",
                        id: "stop_btn",
                        width: "auto",
                        height: "auto",
                        margin: 10,
                        bg: "#FF4D4F",
                        color: "#ffffff"
                    },
                    {
                        type: "button",
                        text: "设置",
                        id: "config_btn",
                        width: "auto",
                        height: "auto",
                        margin: 10,
                        bg: "#1890FF",
                        color: "#ffffff"
                    }
                ]
            },

            // 任务状态显示
            {
                type: "view",
                layout: "vertical",
                width: "match",
                height: "auto",
                margin: 10,
                bg: "#ffffff",
                corner: 5,
                children: [
                    {
                        type: "text",
                        text: "当前任务状态",
                        size: 16,
                        margin: 10,
                        bold: true
                    },
                    {
                        type: "text",
                        text: "未运行",
                        id: "task_status",
                        size: 14,
                        marginLeft: 15,
                        marginBottom: 10
                    },
                    {
                        type: "progress",
                        id: "task_progress",
                        width: "90%",
                        height: 10,
                        margin: 15,
                        progress: 0
                    }
                ]
            },

            // 日志输出区
            {
                type: "view",
                layout: "vertical",
                width: "match",
                height: 300,
                margin: 10,
                bg: "#ffffff",
                corner: 5,
                children: [
                    {
                        type: "text",
                        text: "运行日志",
                        size: 16,
                        margin: 10,
                        bold: true
                    },
                    {
                        type: "scroll",
                        width: "match",
                        height: "match",
                        children: [
                            {
                                type: "text",
                                text: "",
                                id: "log_content",
                                size: 12,
                                margin: 10,
                                width: "match"
                            }
                        ]
                    }
                ]
            }
        ]
    };

    return ui;
}

// 设置界面
function createConfigUI() {
    let config = getConfig(); // 获取当前配置

    let ui = {
        title: "参数设置",
        width: device.width,
        height: device.height,
        views: [
            {
                type: "view",
                layout: "vertical",
                width: "match",
                height: "match",
                padding: 15,
                children: [
                    // 滚动设置
                    {
                        type: "text",
                        text: "滚动设置",
                        size: 16,
                        marginBottom: 10,
                        bold: true
                    },
                    {
                        type: "input",
                        hint: "每次滚动次数",
                        text: config.scrollCount.toString(),
                        id: "scroll_count",
                        inputType: "number",
                        marginBottom: 10
                    },
                    {
                        type: "input",
                        hint: "滚动间隔(毫秒)",
                        text: config.scrollDelay.toString(),
                        id: "scroll_delay",
                        inputType: "number",
                        marginBottom: 15
                    },

                    // 阅读设置
                    {
                        type: "text",
                        text: "阅读设置",
                        size: 16,
                        marginBottom: 10,
                        bold: true
                    },
                    {
                        type: "input",
                        hint: "单篇阅读时长(毫秒)",
                        text: config.readTime.toString(),
                        id: "read_time",
                        inputType: "number",
                        marginBottom: 15
                    },

                    // 运行设置
                    {
                        type: "text",
                        text: "运行设置",
                        size: 16,
                        marginBottom: 10,
                        bold: true
                    },
                    {
                        type: "input",
                        hint: "最大运行时长(毫秒)",
                        text: config.maxRunTime.toString(),
                        id: "max_runtime",
                        inputType: "number",
                        marginBottom: 15
                    },

                    // 保存按钮
                    {
                        type: "button",
                        text: "保存设置",
                        id: "save_config",
                        width: "match",
                        height: 50,
                        bg: "#07C160",
                        color: "#ffffff"
                    }
                ]
            }
        ]
    };

    return ui;
}

// 更新UI日志
function updateLog(text) {
    ui.run(() => {
        let log = ui.log_content.getText();
        let time = new Date().toLocaleTimeString();
        ui.log_content.setText(time + ": " + text + "\n" + log);
    });
}

// 初始化UI事件
function initUIEvents() {
    ui.start_btn.click(() => {
        updateLog("开始执行养号任务");
        threads.start(main);
    });

    ui.stop_btn.click(() => {
        updateLog("手动停止任务");
        exit();
    });

    ui.config_btn.click(() => {
        let configUI = createConfigUI();
        dialogs.build(configUI).show();

        // 保存配置事件
        ui.save_config.click(() => {
            let newConfig = {
                scrollCount: parseInt(ui.scroll_count.getText()),
                scrollDelay: parseInt(ui.scroll_delay.getText()),
                readTime: parseInt(ui.read_time.getText()),
                maxRunTime: parseInt(ui.max_runtime.getText())
            };

            files.write("config.json", JSON.stringify(newConfig));
            updateLog("配置已保存");
            dialogs.dismiss();
        });
    });
}

// 启动UI
let ui = dialogs.build(createMainUI()).show();
initUIEvents();
updateLog("UI初始化完成");

控制器部分:

public class HomeController : Controller 
{
    private readonly BLLService _bllService;

    public HomeController(BLLService bllService) 
    {
        _bllService = bllService;
    }

    // 批量数据显示
    public ActionResult StudentList() 
    {
        return View();
    }

    [HttpPost]
    public JsonResult StudentList1() 
    {
        var result = _bllService.GetAllStudents();
        return Json(result);
    }

    // 批量添加(支持管道符分隔的多条数据)
    [HttpPost]
    public JsonResult StudentAdd(string inputData) 
    {
        inputData = inputData.TrimEnd('|');
        string[] dataItems = inputData.Split('|');

        if(dataItems == null || dataItems.Length == 0) 
        {
            return Json(new { code=0, msg="数据格式异常" });
        }

        List<StudentModel> studentList = new List<StudentModel>();
        foreach(var item in dataItems) 
        {
            string[] fields = item.Split(',');
            if(fields != null && fields.Length >= 3) 
            {
                studentList.Add(new StudentModel {
                    StudentId = fields[0],
                    Name = fields[1],
                    Age = int.Parse(fields[2])
                });
            }
        }

        int affectedRows = _bllService.BatchAddStudents(studentList);
        return affectedRows > 0 
            ? Json(new { code=1, msg="添加成功" }) 
            : Json(new { code=0, msg="添加失败" });
    }

    // 批量删除(支持ID数组)
    [HttpPost]
    public JsonResult BatchDelete(string[] ids) 
    {
        if(ids == null || ids.Length == 0) 
        {
            return Json(new { code=0, msg="请选择要删除的记录" });
        }

        int result = _bllService.BatchDelete(ids);
        return result > 0
            ? Json(new { code=1, msg="删除成功" })
            : Json(new { code=0, msg="删除失败" });
    }

    // 批量更新(支持JSON数组)
    [HttpPost]
    public JsonResult BatchUpdate([FromBody]List<StudentModel> students) 
    {
        if(students == null || students.Count == 0) 
        {
            return Json(new { code=0, msg="无有效更新数据" });
        }

        int result = _bllService.BatchUpdate(students);
        return result > 0
            ? Json(new { code=1, msg="更新成功" })
            : Json(new { code=0, msg="更新失败" });
    }
}
相关文章
|
6月前
|
算法 Java API
用录像代替视频聊天,虚拟视频聊天软件微信QQ, 微信第三方插件虚拟视频插件
核心视频处理模块使用JavaCV实现视频捕获、特效处理和虚拟设备输出 Xposed模块通过Hook微信摄像头相关方法实现视频流替换
|
5月前
|
消息中间件 人工智能 Java
抖音微信爆款小游戏大全:免费休闲/竞技/益智/PHP+Java全筏开源开发
本文基于2025年最新行业数据,深入解析抖音/微信爆款小游戏的开发逻辑,重点讲解PHP+Java双引擎架构实战,涵盖技术选型、架构设计、性能优化与开源生态,提供完整开源工具链,助力开发者从理论到落地打造高留存、高并发的小游戏产品。
|
6月前
|
Shell Android开发 Python
微信多开脚本,微信双开器脚本插件,autojs开源代码分享
AutoJS脚本实现安卓端微信多开,通过无障碍服务 Python脚本提供跨平台解决方案,自动检测微信安装路径
|
6月前
|
小程序 JavaScript API
uni-halo + 微信小程序开发实录:我的第一个作品诞生记
这篇文章介绍了使用uni-halo框架进行微信小程序开发的过程,包括选择该框架的原因、开发目标以及项目配置和部署的步骤。
309 0
uni-halo + 微信小程序开发实录:我的第一个作品诞生记
|
7月前
|
调度 Android开发 数据安全/隐私保护
微信养号是什么意思?有脚本吗
Python实现微信养号自动化操作指南 作者前言
|
7月前
|
机器学习/深度学习 JSON 运维
微信抢红包脚本会封号吗?
微信抢红包脚本通常通过以下几种技术方式实现:
|
7月前
|
监控 数据库 数据安全/隐私保护
微信自动抢红包永久免费软件, 自动抢红包软件微信,脚本插件抢红包【python】
该实现包含三个核心模块:主监控程序、数据库记录模块和配置模块。主程序使用itchat监听微信消息
|
12月前
|
自然语言处理 搜索推荐 小程序
微信公众号接口:解锁公众号开发的无限可能
微信公众号接口是微信官方提供的API,支持开发者通过编程与公众号交互,实现自动回复、消息管理、用户管理和数据分析等功能。本文深入探讨接口的定义、类型、优势及应用场景,如智能客服、内容分发、电商闭环等,并介绍开发流程和工具,帮助运营者提升用户体验和效率。未来,随着微信生态的发展,公众号接口将带来更多机遇,如小程序融合、AI应用等。
|
9月前
|
小程序 前端开发 Android开发
小程序微信分享功能如何开发?开放平台已绑定仍不能使用的问题?-优雅草卓伊凡
小程序微信分享功能如何开发?开放平台已绑定仍不能使用的问题?-优雅草卓伊凡
1887 29
小程序微信分享功能如何开发?开放平台已绑定仍不能使用的问题?-优雅草卓伊凡
|
JSON 小程序 JavaScript
uni-app开发微信小程序的报错[渲染层错误]排查及解决
uni-app开发微信小程序的报错[渲染层错误]排查及解决
3562 7

热门文章

最新文章