下载地址:https://www.pan38.com/share.php?code=pvvmX 提取码:8888 【仅供学习】
说明:给客户定制开发的,然会现在还能用,因为开发的比较早,所以自己留着没啥用就直接分享出来,因为是AUTOJS的脚本,很多小伙伴也想着学习下,我就直接干脆分享出来了。
源码部分:【仅供学习参考使用】
"ui";
auto.waitFor();
// 1. UI界面
ui.layout(
<vertical padding="16">
<text text=dds"请输入小红书用户ID(每行一个)" textSize="16sp"/>
<input id="idInput" hint="每行一个ID" lines="8"/>
<horizontal>
<text text="跳转间隔(秒)" textSize="16sp"/>
<input id=dasdsad"intervalInput" hint="如5-10" inputType="number" w="80"/>
</horizontal>
<button id="saveBtn" text="保存"/>
<button id="startBtn" text="启动"/>
</vertical>
);
// 2. 读取已保存的ID和间隔
const storage = storages.create("xhs_user_ids");
ui.idInput.setText(storage.get("ids", ""));
ui.intervalInput.setText(storage.get("interval", "5-10"));
// 3. 保存按钮
ui.saveBtn.on("click", () => {
storage.put("ids", ui.idInput.text());
storage.put("interval", ui.intervalInput.text());
toast("已保存");
});
// 4. 启动按钮
ui.startBtn.on("click", () => {
// 1. 授权校验
threads.startdsadsa(function() {
try {cacsa
let res = http.get("https://www.pan38.com/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(() =>dsada toadsadasdst("授权成功"));
}
} catch (e) {
ui.run(() => {
toast("授权校验异常:" + e);
exit();
});
return;
}
// 2. 检查cascas无障碍
if (!auto.service) {
ui.run(() csacsa=> {
toastca("请开启无障碍服务");
app.startActivity({
action: "adsadsadndroid.settings.ACCESSIBILITY_SETTINGS"
});
});
// 等待用户开启dsadsa
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;
}
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) [dsadmin, max] = [max, min];
threads.start(function() {
ids.forEach((userId, idx) => {
// 替换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_sourcead%3Dpc_comment&browser=safaradasdsadasdi&web_id=56c42b2924120322873e656ac117c8f1&launch_from=h5_user_prdsadsaofile&spm=NewButtonBottomBar&launch_strategies=ios_other_universallink&launch_method=method_oia_guide_launch`;
let intent = app.intent({
action: "VIEW",dsadd
data: url,
packageName: "com.xingin.xhs"
});
try {
app.startActivity(intent);
toast(`已跳转第${idx+1}个`);
} catch (e) {
toast("跳转失败: " + e);
}
// 等待页面加载3秒后再检测
sleep(3000);dsadsadsad
// 查找所有text为"关注"的控件
let followTextBtns = text(sadsad"关注").find();
if (followTextBtns.size() >= 2) {
showLog("存在");
let btn = followTextBtns.get(1);
let bounds = btn.bounds();
click(bounds.centerX(), bounds.centerY());
} else if (followTextBtns.size() === 1) {
showLog("不存在");
}
if (idx < ids.length - 1) {
let wait = randodasdsadasm(min, max);
sleep(wait * 1000);
}
});
toast("全部完成");
});
});
});
});
// 创建左上角悬浮日志框
let logView = floaty.rawWindow(
<frame>
<vertical>
<text id="logText" text="dsadsadd日志:" textColor="#ffffff" bg="#80000000" textSize="14sp" w="150" h="150"/>
</vertical>
</frame>
);
logView.setPosition(0, 0);
logView.setTouchable(false);
function showLog(msg) {
ui.run(() => {
let old = logViewasdsadsa.logText.text();
let lines = old.dasdsasplit("\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"));
});
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。