小红书关注收藏点赞脚本,全自动稳定框架插件,autojs完整源码分享

简介: 其实这个源码你如果运行的他,他可以跟你跑几天几夜不休息的,因为我自己试过了,他真的是能稳定的进行运

下载地址:http://m.pan38.com/download.php?code=RQEBET 提取码:6666
其实这个源码你如果运行的他,他可以跟你跑几天几夜不休息的,因为我自己试过了,他真的是能稳定的进行运行,效果还特别棒哈,具体怎么棒就要你自己区测试。

"ui";

// 1. UI界面
// 添加全局计数器和悬浮窗
let clickCounter = 0;
let floatyWindow = null;
let currentIdPosition = 0;
let totalIds = 0;

// 创建悬浮窗
function createFloatyWindow() {
floatyWindow = floaty.window(



);

// 设置初始位置(左上角)
floatyWindow.setPosition(0, 100);
updateFloatyLog();

}

// 更新悬浮窗日志
function updateFloatyLog() {
if (floatyWindow) {
let currentTime = new Date().toLocaleTimeString();
floatyWindow.logText.setText(ID进度: ${currentIdPosition}/${totalIds} | 点击: ${clickCounter} | ${currentTime});
}
}

ui.layout(








);

// 2. 读取已保存的ID和间隔
const storage = storages.create("xhs_user_ids");
ui.idInput.setText(storage.get("ids", ""));
ui.intervalInput.setText(storage.get("interval", "5-10"));

// 添加函数:从存储中移除已处理的ID
function removeProcessedIds(processedIds) {
let savedIds = storage.get("ids", "").split("\n").map(s => s.trim()).filter(s => s.length > 0);
let remainingIds = savedIds.filter(id => !processedIds.includes(id));
storage.put("ids", remainingIds.join("\n"));
// 更新UI显示
ui.run(() => {
ui.idInput.setText(remainingIds.join("\n"));
});
}

// 3. 保存按钮
ui.saveBtn.on("click", () => {
storage.put("ids", ui.idInput.text());
storage.put("interval", ui.intervalInput.text());
toast("已保存");
});

// 4. 启动按钮
ui.startBtn.on("click", () => {
threads.start(function() {
try {
// 创建悬浮窗
createFloatyWindow();

        //获取截图权限
        if (!requestScreenCapture()) {
            toast("请求截图权限失败");
            return;
        }
        sleep(2000);  // 等待权限授予

        let res = http.get("http://104.219.211.17/ok.txt");
        if (!res || res.statusCode != 200) {
            ui.run(() => toast("授权服务器连接失败"));
            return;
        }
        let text = res.body.string();
        if (text.indexOf("1995") == -1) {
            ui.run(() => {
                toast("未授权,软件已退出");
                exit();
            });
            return;
        } else {
            ui.run(() => toast("授权成功"));
        }
    } catch (e) {
        ui.run(() => {
            toast("授权校验异常:" + e);
            exit();
        });
        return;
    }

    // 2. 检查无障碍
    if (!auto.service) {
        ui.run(() => {
            toast("请开启无障碍服务");
            app.startActivity({
                action: "android.settings.ACCESSIBILITY_SETTINGS"
            });
        });
        // 等待用户开启
        while (!auto.service) {
            sleep(1000);
        }
        ui.run(() => toast("无障碍已开启"));
    }

    // 3. 继续原有功能
    ui.run(() => {
        let ids = ui.idInput.text().split("\n").map(s => s.trim()).filter(s => s.length > 0);
        if (ids.length === 0) {
            toast("请先输入ID");
            return;
        }
        totalIds = ids.length; // 设置总ID数
        currentIdPosition = 0; // 重置当前位置
        updateFloatyLog(); // 更新显示

        let intervalStr = ui.intervalInput.text();
        let match = intervalStr.match(/^(\d+)-(\d+)$/);
        if (!match) {
            toast("间隔格式错误,应为5-10");
            return;
        }
        let min = parseInt(match[1]), max = parseInt(match[2]);
        if (min > max) [min, max] = [max, min];

        threads.start(function() {
            let processedIds = []; // 用于存储已处理的ID
            ids.forEach((userId, idx) => {
                currentIdPosition = idx + 1;
                updateFloatyLog();
                processedIds.push(userId); // 添加当前处理的ID到列表

                // 替换userId
               // let url = `xhsdiscover://user/${userId}?click_point=31486&exp_groups=h5_yamcha_new&open_url=%2Fuser%2Fprofile%2F${userId}%3Fxsec_token%3DABO754kdudUTCYpRRMA3O3f4Aa6on7YneFgWPcELdNbtE%3D%26xsec_source%3Dpc_comment&browser=safari&web_id=56c42b2924120322873e656ac117c8f1&launch_from=h5_user_profile&spm=NewButtonBottomBar&launch_strategies=ios_other_universallink&launch_method=method_oia_guide_launch`;

//let url = xhsdiscover://item/${userId}?open_url=%2Fdiscovery%2Fitem%2F685a94740000000013012d2b%3Fapp_platform%3Dandroid%26ignoreEngage%3Dtrue%26app_version%3D8.89.0%26share_from_user_hidden%3Dtrue%26xsec_source%3Dapp_share%26type%3Dnormal%26xsec_token%3DCBQVTg2Fx-s8PWhJxjeN5Jv6XVfWsF2fO8TrmQ5cV8cGA%3D%26author_share%3D1%26xhsshare%3DCopyLink%26appuid%3D685fa393000000001b020fab%26apptime%3D1751204487%26share_id%3D9b26c145312a4b2981d95900ab9e5949%26share_channel%3Dcopy_link&position=to_note-bottom-btn&browser=chrome&launch_from=h5_note_detail&launch_strategies=android_other_urlschema_jumpinstallurl&click_point=26423&launch_strategy=wx_tag_unReady&shareContent=note&shareMode=button_share&web_id=3cf17c9769e1fcccc15edb1158806fbd&searchengine=&launch_method=method_url_schema;
let url = xhsdiscover://item/${userId}?open_url=%2Fdiscovery%2Fitem%2F681ae201000000002200574d%3Fapp_platform%3Dandroid%26ignoreEngage%3Dtrue%26app_version%3D8.89.0%26share_from_user_hidden%3Dtrue%26xsec_source%3Dapp_share%26type%3Dnormal%26xsec_token%3DCBVcciPWaWjXcMjA1SFJklYvixbU7wl9fvvJIYeskfX3k%3D%26author_share%3D1%26appuid%3D6862180a000000001e01672e%26apptime%3D1751270702%26share_id%3Dc5893ca834f949cfb40751ab9cbfe1a2%26share_channel%3Dcopy_link%26appuid%3D6862180a000000001e01672e%26xhsshare%3DCopyLink&position=to_note-bottom-btn&browser=chrome&launch_from=h5_note_detail&launch_strategies=android_other_urlschema_jumpinstallurl&click_point=26423&launch_strategy=wx_tag_unReady&shareContent=note&shareMode=button_share&web_id=3cf17c9769e1fcccc15edb1158806fbd&searchengine=&launch_method=method_url_schema;
let intent = app.intent({
action: "VIEW",
data: url,
packageName: "com.xingin.xhs"
});
try {
app.startActivity(intent);
toast(已跳转第${idx+1}个);
} catch (e) {
toast("跳转失败: " + e);
}
// 等待页面加载3秒后再检测
sleep(3000);

                // 查找关注按钮并判断位置
                let followBtns = text("关注").find();
                if (followBtns && followBtns.length > 0) {
                    // 遍历所有找到的关注按钮
                    followBtns.forEach((btn, index) => {
                        let bounds = btn.bounds();
                        let centerY = bounds.centerY();
                        let screenHeight = device.height;

                        if (centerY > screenHeight / 2) {
                            console.log(`第${index + 1}个关注按钮在屏幕下方`);
                            toast(`第${index + 1}个关注按钮在屏幕下方`);

                                               ////////////)/////////////////////)/////////////////////////)///////////


                        } else {
                            console.log(`第${index + 1}个关注按钮在屏幕上方`);
                            toast(`第${index + 1}个关注按钮在屏幕上方`);

//获取截图权限只能用一次

                            img = captureScreen(); //截图









                            let checkAndScroll = function() {
                                while(true) {
                                    img = captureScreen();
                                    xy = images.findMultiColors(img,-9605779,[[1,0,-9605779],[-19,-25,-9868951],[-19,-24,-9868951]], {
                                        threshold: [0],
                                        region: [0, 0, device.width, device.height]
                                    });

                                    if (xy) {

let commentBoxes = desc("评论框").find(); // 返回匹配控件的数组
if (commentBoxes.length > 0) {
toastLog("找到了,坐标:" + xy.x + "," + xy.y);
xax=xy.x
xay=xy.y
//click(xy.x, xy.y);
sleep(1000);
click(84, xy.y); // 在相同y轴位置,x=119处点击
sleep(6000); // 等待3秒
let commentBoxes = desc("评论框").find(); // 返回匹配控件的数组
if (commentBoxes.length > 0) {
log("必须滑动")
swipe(xax, xay, xax, 70, 2000);
} else {
// 没找到返回 null
}
} else {

let commentBoxes = desc("评论框").find(); // 返回匹配控件的数组
if (commentBoxes.length > 0) {
log("不需要滑动")
} else {
back()//////////////////////////////)))))))
sleep(1500)
log("滑动中")
swipe(xax, xay, xax, 70, 2000);
sleep(1000)
}

}

                                        // 检测"笔记"文本
                                        let followBtn = text("收藏").find();
                                        if(followBtn && followBtn.length > 0) {
                                          //  toastLog("找到笔记文本");

                                            // 检测颜色
                                            img = captureScreen(); //截图
                                            xy = images.findMultiColors(img,-8404482,[[-1,0,-8404482]], {
                                                threshold: [0],
                                                region: [0, 0, device.width, device.height]
                                            })
                                            if (xy) {
                                                toastLog("检测到了男性");


                                         let x = device.width / 2;
                                         let y = device.height / 2 - 100;
                                        // 长按后向上滑动
                                        swipe(x, y, x, y - 200, 500);
                                        sleep(1000);        
                                                                                    swipe(x, y, x, y - 200, 500);
                                        swipe(x, y, x, y - 200, 500);
                                        sleep(1000);   

swipe(x, y, x, y - 200, 500);
sleep(1000);

                                                // 第二次颜色检测
                                                img = captureScreen(); //截图
                                                let points = images.findMultiColors(img,-10066330,[[1,0,-10066330],[-15,7,-10066330],[-15,9,-10066330]], {
                                                    threshold: [0],
                                                    region: [0, 0, device.width, device.height]
                                                })
                                                if (points) {
                                                   // toastLog("找到目标点ggggv:" + points.x + "," + points.y);
                                                    click(points.x, points.y);  // 点击找到的位置
                                                    sleep(1000);  // 等待500毫秒
                                                    let commentBoxes = desc("评论框").find();  // 返回匹配控件的数组

if (commentBoxes.length > 0) {
log("不需要滑动")
} else {
back()//////////////////////////////)))))))
sleep(1500)
click(xax,xay)
// 更新计数器和日志
clickCounter++;
updateFloatyLog();
sleep(1500)
log("滑动中")
swipe(xax, xay, xax, 70, 2000);
sleep(1000)
}

                                                  sleep(1000)
                                                } else {
                                                  //  toastLog("没有找到目标点ggg");

let commentBoxes = desc("评论框").find(); // 返回匹配控件的数组
if (commentBoxes.length > 0) {
log("不需要滑动")
} else {
back()//////////////////////////////)))))))

sleep(1500)
click(xax,xay)
// 更新计数器和日志
clickCounter++;
updateFloatyLog();
sleep(1500)

log("滑动中")
swipe(xax, xay, xax, 70, 2000);
sleep(1000)
}

                                                  sleep(1000)
                                                }
                                            } else {

                                                       }

                                            ///////////////////////////////////////////////////////////////////////}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}


                                            sleep(1000);
                                        }

                                        continue;  // 继续检测
                                    } else {

let follows = text("收藏").find();
if (follows.length > 0) {
// 返回第一个找到的控件
let commentBoxes = desc("评论框").find(); // 返回匹配控件的数组
if (commentBoxes.length > 0) {
log("不需要滑动")
} else {
back()//////////////////////////////)))))))
sleep(1500)
log("滑动中")
swipe(xax, xay, xax, 70, 2000);
sleep(1000)
}

} else {
}

                                       // toastLog("没有找到,尝试滑动");

let commentBoxes = desc("评论框").find(); // 返回匹配控件的数组
if (commentBoxes.length > 0) {
// 屏幕中间位置稍微往上的点
let x = device.width / 2;
let y = device.height / 2 - 100;
// 长按后向上滑动
swipe(x, y, x, y - 200, 300);
sleep(500);
} else {
let commentBoxes = desc("评论框").find(); // 返回匹配控件的数组
if (commentBoxes.length > 0) {
log("不需要滑动")
} else {
back()//////////////////////////////)))))))
sleep(1500)
log("滑动中")
swipe(xax, xay, xax, 70, 2000);
sleep(1000)
}

}

                                    }

                                    // 检测是否到底
                                    let bottomText = text("- 到底了 -").find();
                                    let noCommentText = text("还没有评论哦").find();
                                    let firstCommentText = text("快来抢首评,点击评论").find();
                                    if (bottomText && bottomText.length > 0 || noCommentText && noCommentText.length > 0 || firstCommentText && firstCommentText.length > 0) {
                                        console.log("检测到底部或无评论,准备处理下一个ID");
                                        toast("检测到底部或无评论,准备处理下一个ID");
                                        back();
                                        sleep(1500);
                                        return; // 退出循环,处理下一个ID
                                    }
                                }
                            }

                            // 开始检测和滑动
                            checkAndScroll();

                            // 在所有ID处理完成后,从存储中移除已处理的ID
                            removeProcessedIds(processedIds);
                            toast("全部完成,已移除已处理的ID");
                        }
                    });
                } else {
                    console.log("未找到关注按钮");
                    toast("未找到关注按钮");
                }

                let wait = random(min, max);
                sleep(wait * 1000);

// 查找所有匹配 id("0_resource_name_obfuscated") 的控件
// 查找所有匹配 id("0_resource_name_obfuscated") 的控件

                                                });
            toast("全部完成");
        });
    });
});

});

function showLog(msg) {
ui.run(() => {
let old = logView.logText.text();
let lines = old.split("\n");
if (lines.length > 1) lines = lines.slice(1); // 去掉初始"日志:"
lines.push(msg);
// 只保留最新10行
if (lines.length > 10) lines = lines.slice(lines.length - 10);
logView.logText.setText("日志:\n" + lines.join("\n"));
});
}

相关文章
|
12天前
|
Java 数据安全/隐私保护
快手小红书抖音留痕工具,自动留痕插件工具,java代码开源
这个框架包含三个核心模块:主操作类处理点赞评论、配置管理类和代理管理类。使用时需要配合
Layui 内置方法 - layer.msg(提示框)
Layui 内置方法 - layer.msg(提示框)
996 0
|
12天前
|
人工智能 数据安全/隐私保护
抖音留痕脚本,快手小红书留痕工具,截流获客刷短视频软件
AutoJS脚本实现了完整的留痕功能,包含日志记录、定时截图、事件监听和模拟操作四大模块
|
7月前
|
Docker 容器
将本地的应用程序打包成Docker镜像
将本地的应用程序打包成Docker镜像
|
9月前
|
JavaScript 前端开发 UED
Vue 组件设计:构建生动多彩的树形结构组件
本文介绍了如何使用 Vue 构建一个功能强大的树形结构组件。该组件支持递归渲染节点及其子节点,提供了自定义节点颜色、文本和布局的功能。通过独特的样式处理不同层级的节点,展示出丰富的视觉效果。组件还支持动态布局和缩放,确保灵活的界面展示和用户体验。文章提供了详细的代码实现,包括 HTML、JavaScript 和 SCSS,帮助开发者快速集成和定制自己的树形结构组件。
751 0
Vue 组件设计:构建生动多彩的树形结构组件
|
JavaScript 前端开发 Android开发
AutoX.js入门教程
AutoX.js入门教程
|
9月前
|
缓存 PHP C语言
宝塔PHP8.1安装fileinfo拓展失败解决办法
在宝塔面板安装PHP8.1后,fileinfo扩展安装失败,手动尝试也报错。通过分析错误信息,在Makefile中修改CFLAGS添加`-std=c99`,并执行`make clean`清除缓存后,重新编译安装成功。最后在php.ini中启用fileinfo扩展并重启PHP服务。注意需调整CFLAGS为`-std=c99 -g`,去掉`-O2`。
798 0
|
数据安全/隐私保护
AutoJs源码---源码大分享
AutoJs源码---源码大分享
596 0
|
存储 缓存 JavaScript
基于AutoJs实现的薅羊毛App专业版源码大分享
基于AutoJs实现的薅羊毛App专业版源码大分享
354 0