前言
赛博僵尸道长是针对微博兴趣推荐用户以及不活跃用户问题(俗称僵尸粉)而设计的,旨在轻松快捷地清除微博用户的僵尸粉,使得用户发出的微博获得更多有效曝光及互动。
更新公告
2023-10-17
1.添加清理微博推荐粉丝开关
2.修复铁粉被误删问题
3.调整深度清粉条件
2023-02-22
1.添加清粉时自动过滤铁粉的功能
2023-01-21
1.赛博僵尸道长2023版本发布,适配新版微博
2022-07-07:
1.添加不相关用户清除功能
2.修复互相关注失效bug
2022-07-02:
1.修复内存泄漏问题。
2.添加可交互面板。
2022-06-29
1.修复深度清粉时页面异常的情况,并加快清理效率。
2.增加心跳复活功能。
2022-06-26:
提供 快速清粉 和 深度清粉 两个模式。
快速清粉:可选择清理满足以下条件的粉丝。
①兴趣推荐
②微博数<3且粉丝数<2 (可以修改参数和判断逻辑,详见说明)
③默认头像
深度清粉:在快速清粉的基础上,可以扫描并清理一定时间内没发微博或点赞的粉丝。(默认365天内,可修改参数)
使用说明
代码已适配新版微博。
复制代码后
① 电脑页面打开至新版微博主页
② 右键菜单->检查元素或按快捷键Ctrl + Shift + I或按F12打开开发者工具
③ 点击Console打开console窗口,将代码粘贴到console窗口后按Enter键运行代码。
运行代码后,关掉开发者工具,否则可能再清粉过程中引起网页崩溃,网页将变成如下图所示:
快速清粉参数:
①清除兴趣推荐用户:清理通过兴趣推荐关注过来的用户。
②排除相互关注:如果是相互关注的用户则跳过。
③只检查通过推荐关注:开启后只检查通过兴趣推荐或者微博推荐关注过来的粉丝。
④清除不活跃用户:开启后将检查粉丝数和微博数低于指定数量用户。
⑤最低粉丝数 和 最低微博数:用于判断用户活跃度。
⑥满足任一条件即清除:只要 粉丝数 或 微博数 小于给定的数值,即判断为不活跃用户。
⑦清除默认头像用户:清理头像是默认头像的用户。
⑧清除微博推荐用户:清理通过微博推荐关注过来的用户。(可能会清掉真粉丝,需谨慎使用)
深度清粉参数:
①开启深度清粉:勾选后开启深度清粉模式,运行时会读取粉丝的微博跟点赞,一旦在指定时间内没有发过微博或点赞,则视为不活跃用户。
②无视用户最近点赞:开启后深度模式将不去检查用户点赞。
③最小不活跃天数:用于判断用户是否不活跃。
④开启检查关注:勾选后会在深度清粉时去检查当前用户的共同关注
检测按钮:从第一页开始检测僵尸粉。(不做清理)
清粉按钮:从第一页开始检测并清理僵尸粉。
如删粉力度不够,除了调高 最小粉丝数 和 最小微博数 之外,还可将开关满足任一条件即清除打开,条件将变为只要 粉丝数 或 微博数 小于给定的数值,即判断为不活跃用户。
Q&A
Q:运行代码后报错: “Uncaught SyntaxError: Unexpected token …”
A:浏览器内核过旧,请使用最新版的谷歌浏览器、火狐浏览器、Edge浏览器。
Q:运行代码后显示微博拒绝连接
A:触发了微博服务器安全策略,可以更换浏览器、更换网络或更换电脑再试试。文章来源:https://www.toymoban.com/news/detail-713378.html
使用前请仔细阅读说明。
使用前请仔细阅读说明。
使用前请仔细阅读说明。文章来源地址https://www.toymoban.com/news/detail-713378.html
代码
let removeTargetFans = false; /*是否删除符合条件的粉丝,默认关闭*/
let deepSearchMode =false; /*是否开启深度清理模式*/
let ignoreLikes = true; /*是否无视用户最近点赞*/
let minDayCount = 180; /*最小不活跃天数*/
let fansMinCount = 2; /*最小粉丝数*/
let weiboMinCount = 3; /*最小微博数*/
let totalCount = 0;
let checkIsFromRecommended = true; /*是否检查通过兴趣推荐关注*/
let checkIsFromWBRecommended = false /*是否检查通过微博推荐关注*/
let checkIsInactive = true; /*是否检查不活跃用户*/
let checkFansOrWeibo = false; /*是否只判断粉丝数或微博数*/
let checkIsFollowing =true; /*是否检查相互关注*/
let checkIsDefaultIcon = false; /*是否检查默认头像*/
let checkIsNormalFollowed = false; /*是否检查关注来源*/
let isError = false;
let isRunning = false;
let userID = 0;
let zeroFanPageCount = 0;
function clearLog()
{
let logger = document.querySelector("p.logger");
logger.innerHTML = "";
}
function logError(msg){
let logger = document.querySelector("p.logger");
let parent = logger.parentElement;
logger.innerHTML +="<span style='color: darkred; font-weight:bold;'>" + msg + "</span><br>";
parent.scrollTop = parent.scrollHeight;
}
function logSuccessMsg(msg){
let logger = document.querySelector("p.logger");
let parent = logger.parentElement;
logger.innerHTML +="<pre style='tab-size: 15em; color: forestgreen;'>" + msg + "</pre>";
parent.scrollTop = parent.scrollHeight;
}
function logImportantMsg(msg)
{
let logger = document.querySelector("p.logger");
let parent = logger.parentElement;
logger.innerHTML +="<pre style='font-weight:bold'>" + msg + "</pre>";
parent.scrollTop = parent.scrollHeight;
}
function logMsg(msg){
let logger = document.querySelector("p.logger");
let parent = logger.parentElement;
logger.innerHTML +="<pre style='tab-size: 15em;'>" + msg + "</pre>";
parent.scrollTop = parent.scrollHeight;
}
async function removeFanMainFunc() {
const delay = ms => new Promise(res => setTimeout(res, ms));
const minute = 1000 * 60;
const hour = minute * 60;
const day = hour * 24;
clearTimeout();
isError = false;
let startIndex = 0;
let pageIndex = 1;
while(true) {
if(!isRunning)
{
if (removeTargetFans)
logError("用户退出程序。总计清理了 " + totalCount + " 个疑似僵尸粉");
else
logError("用户退出程序。总计发现了 " + totalCount + " 个疑似僵尸粉");
break;
}
await delay(300);
let fanListJson = await fetch(
'https://weibo.com/ajax/friendships/friends?relate=fans&count=20&type=fans&fansSortType=followTime' +
'&page=' + pageIndex +
'&uid=' + userID,
{
method: "GET",
}).then(response => response.json())
.catch((e) => {
});
if (fanListJson == null || fanListJson.ok != 1 || fanListJson['users'].length === 0) {
fanListJson = await fetch(
'https://weibo.com/ajax/friendships/friends?relate=fans&count=20&type=fans&fansSortType=followTime' +
'&page=' + pageIndex +
'&uid=' + userID,
{
method: "GET",
}).then(response => response.json())
.catch((e) => {
});
if (fanListJson == null || fanListJson.ok != 1) {
if (removeTargetFans)
logError("请求异常,退出程序。总计清理了 " + totalCount + " 个疑似僵尸粉");
else
logError("请求异常,退出程序。总计发现了 " + totalCount + " 个疑似僵尸粉");
break;
}
}
let fans = fanListJson['users'];
let count = 0;
for (let i = startIndex; i < fans.length; i++) {
if(!isRunning)
{
if (removeTargetFans)
logError("用户退出程序。总计清理了 " + totalCount + " 个疑似僵尸粉");
else
logError("用户退出程序。总计发现了 " + totalCount + " 个疑似僵尸粉");
return;
}
let isFromRecommended = false;
let isFromWBRecommended = false;
let isInactive = false;
let isFollowing = false;
let isDefaultIcon = false;
let isNormalFollowed = false;
let isIrrelevant = false;
let fansCount, weiboCount;
/*关注来源*/
let originSrc = fans[i]['origin_source_info'];
isNormalFollowed = originSrc != null && originSrc['text'] !== "兴趣推荐" && originSrc['text'] !== "微博推荐";
/*是否为铁粉*/
if(fans[i]['fansIcon'] != null)
{
if(fans[i]['fansIcon'].name == "loyal_fans")
continue;
}
/*是否为非推荐的会员*/
if (isNormalFollowed && (fans[i]['mbtype'] === 12))
continue;
/*关注来源是否为兴趣推荐*/
if (checkIsFromRecommended) {
isFromRecommended = originSrc != null && originSrc['text'] === "兴趣推荐";
}
if (checkIsFromWBRecommended) {
isFromWBRecommended = originSrc != null && originSrc['text'] === "微博推荐";
}
let fanID = fans[i]['id'];
let fanName = fans[i]['name'];
/*粉丝数与微博数*/
if (checkIsInactive) {
fansCount = fans[i]['followers_count'];
weiboCount = fans[i]['statuses_count'];
if (checkFansOrWeibo)
isInactive = fansCount < fansMinCount || weiboCount < weiboMinCount;
else
isInactive = fansCount < fansMinCount && weiboCount < weiboMinCount || weiboCount === 0 || fansCount === 0;
}
/*是否为默认头像*/
if (checkIsDefaultIcon) {
let icon = fans[i]['avatar_hd'];
isDefaultIcon = icon != null && icon.includes("/default/images/default_avatar_");
}
/*是否互相关注*/
if (checkIsFollowing) {
isFollowing = fans[i]['following'];
}
let isZombie = false;
if (!isFollowing)
if (!checkIsNormalFollowed || (checkIsNormalFollowed && !isNormalFollowed))
if (isDefaultIcon || isFromRecommended || isFromWBRecommended || isInactive || isDefaultIcon || (deepSearchMode && weiboCount === 0))
isZombie = true;
/*深度检查*/
if (deepSearchMode && !isFollowing && !isZombie) {
await delay(600);
let weiboJson = await fetch('https://weibo.com/ajax/statuses/mymblog?page=1&feature=0&uid=' + fanID, {
method: "GET",
}).then(response => response.json())
.catch((e) => {
});
if (weiboJson == null || weiboJson.ok != 1) {
await delay(800);
weiboJson = await fetch('https://weibo.com/ajax/statuses/mymblog?page=1&feature=0&uid=' + fanID, {
method: "GET",
}).then(response => response.json())
.catch((e) => {
});
if (weiboJson == null || weiboJson.ok != 1) {
logError(fanName + "主页请求失败,跳过检查");
continue;
}
}
let weiboList = weiboJson.data['list'];
let invalidWeiboCount = 0;
let validWeiboCount = 0;
let currDate = Date.now();
for (let index = 0; index < weiboList.length; index++) {
let currWeibo = weiboList[index];
let weiboSrc = currWeibo['source'];
if(weiboSrc != null && weiboSrc.includes("生日动态"))
continue;
if (weiboSrc != null && (weiboSrc.includes("渔场") ||
weiboSrc.includes("活动") || weiboSrc.includes("森林") || weiboSrc.includes("微博积分") ||
weiboSrc.includes("支付宝") || weiboSrc.includes("淘宝") || weiboSrc.includes("芭芭农场") ||
weiboSrc.includes("任务") || weiboSrc.includes("签到") || weiboSrc.includes("新浪游戏") ||
weiboSrc.includes("微博游戏") || weiboSrc.includes("红包") || weiboSrc.includes("微博会员") ||
weiboSrc.includes("微博运动") || weiboSrc.includes("熊猫守护者") || weiboSrc.includes("点淘") ||
weiboSrc.includes("绿植领养")
)) {
invalidWeiboCount++;
continue;
}
if (ignoreLikes && currWeibo['title'] != null && currWeibo['title']['text'].includes("赞"))
continue;
let createTime = currWeibo['created_at'];
if (currWeibo['retweeted_status'] != null) {
createTime = currWeibo['retweeted_status']['created_at'];
}
if (Math.round((currDate - new Date(createTime)) / day) <= minDayCount) {
validWeiboCount++;
}
invalidWeiboCount--;
}
if (invalidWeiboCount > 3) {
isIrrelevant = true;
isZombie = true;
}
if (validWeiboCount < 2) {
isInactive = true;
isZombie = true;
}
}
await delay(300);
if (isZombie) {
let reason = "原因: ";
if (isFromRecommended)
reason += " 兴趣推荐";
if (isFromWBRecommended)
reason += " 微博推荐";
if (isInactive)
reason += " 不活跃用户";
if (isIrrelevant)
reason += " 不相关用户";
if (isDefaultIcon)
reason += " 默认头像";
if (removeTargetFans) {
let fData = new FormData();
fData.append("uid", fanID);
fData.append("_t", "0");
const json = await fetch('/aj/f/remove?ajwvr=6&__rnd=' + Math.round(new Date().getTime()), {
method: "POST",
body: fData
}).then(response => response.json())
.catch((e) => {
});
if (json != null && json.code == 100000) {
logSuccessMsg(fanName + "\t删除成功 " + reason);
count++;
totalCount++;
} else
logError(fanName + "\t删除失败 ");
} else {
logMsg(fanName + "\t疑似僵尸粉 " + reason);
count++;
totalCount++;
}
}
}
if (fans.length > 0) {
startIndex = 0;
zeroFanPageCount = 0;
if (removeTargetFans) {
logImportantMsg("第 " + pageIndex + " 页删除了 " + count + " 个粉丝");
if (count > 0) {
startIndex = fans.length - count;
if (startIndex < 0) startIndex = 0;
} else {
pageIndex++;
}
} else {
logImportantMsg("第 " + pageIndex + " 页发现了 " + count + " 个疑似僵尸粉");
pageIndex++;
}
} else {
if(zeroFanPageCount < 5)
{
zeroFanPageCount++;
pageIndex++;
}else {
if (removeTargetFans)
logError("已到达粉丝列表上限,退出程序。总计清理了 " + totalCount + " 个疑似僵尸粉");
else
logError("已到达粉丝列表上限,退出程序。总计发现了 " + totalCount + " 个疑似僵尸粉");
break;
}
}
}
StopFunc();
}
function RemoveFans(startIndex){
let p = new Promise(function(){removeFanMainFunc(startIndex)});
}
let InitParameters = ()=>
{
checkIsFromRecommended = document.body.querySelector("input#checkIsFromRecommended").checked;
checkIsFromWBRecommended = document.body.querySelector("input#checkIsFromWBRecommended").checked;
checkIsFollowing = document.body.querySelector("input#checkIsFollowing").checked;
checkIsNormalFollowed = document.body.querySelector("input#checkIsNormalFollowed").checked;
checkIsDefaultIcon= document.body.querySelector("input#checkIsDefaultIcon").checked;
checkIsInactive = document.body.querySelector("input#checkIsInactive").checked;
checkFansOrWeibo = document.body.querySelector("input#checkFansOrWeibo").checked;
fansMinCount = parseInt(document.body.querySelector("input#fansMinCount").value);
weiboMinCount = parseInt(document.body.querySelector("input#weiboMinCount").value);
deepSearchMode = document.body.querySelector("input#deepSearchMode").checked;
ignoreLikes = document.body.querySelector("input#ignoreLikes").checked;
minDayCount = parseInt(document.body.querySelector("input#minDayCount").value);
};
let StartCheckFans = ()=>
{
SetMode("running");
InitParameters();
clearLog();
totalCount = 0;
removeTargetFans = false;
isRunning = true;
RemoveFans(0);
};
let StartRemoveFans = ()=>
{
SetMode("running");
InitParameters();
clearLog();
totalCount = 0;
removeTargetFans = true;
isRunning = true;
RemoveFans(0);
};
let StopFunc = ()=>
{
SetMode("ready");
clearInterval();
clearTimeout();
isRunning = false;
};
let SetDeepSearchParam = ()=>{
let disable = document.body.querySelector("input#deepSearchMode").checked === false;
let params = document.body.querySelectorAll("input.DeepSearchParam");
for(let i = 0; i < params.length; i++)
params[i].disabled = disable;
};
let SetMode = (mode) =>{
let params = document.querySelector("div.parameter").querySelectorAll("input");
let readyPanel = document.querySelector("div.ready");
let runningPanel = document.querySelector("div.running");
if(mode === "running")
{
for(let i = 0; i < params.length; i++) params[i].disabled = true;
readyPanel.style.display = "none";
runningPanel.style.display = "";
}
else if(mode === "ready")
{
for(let i = 0; i < params.length; i++) params[i].disabled = false;
runningPanel.style.display = "none";
readyPanel.style.display = "";
}
};
let ReplaceHTML = ()=>
{
let list = document.querySelector("div.woo-box-flex.woo-tab-nav")?.querySelectorAll("a");
let href = document.location.href;
if(list == null || list.length !== 5) {
if(document.location.href.includes("https://weibo.com/u/"))
{
userID = document.location.href.replace("https://weibo.com/u/", "");
let numIndex = 0;
for(numIndex = 0; numIndex < userID.length; numIndex++)
{
if(userID[numIndex] < '0' || userID[numIndex] > '9')
break;
}
userID = userID.slice(0, numIndex);
}else {
console.error("无法找到用户id,请打开微博主页再运行代码");
return;
}
}else{
userID = list[4].href.replace("https://weibo.com/u/", "");
href = "https://weibo.com/u/page/follow/"+ userID +"?relate=fans";
}
document.head.innerHTML = '<meta charset="UTF-8"><title>赛博僵尸道长v2023.10</title>';
let body = '<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>Title</title><script src="RemoveZombiesUI.js"></script></head><body><div class="left"style="position: fixed; display: flex; flex-direction: column;top:0; left:0; bottom:0; width:500px; background-color: burlywood;"><h1 style="text-align:center; margin: 10px;">赛博僵尸道长<span style="font-size: 20px;">v2023.10 作者:<a href="https://weibo.com/u/3696426802">小蛊</a></span></h1><div class="parameter"><h3>快速清粉参数</h3><table style="width: 100%; font-size: 15px;"><tr><td><input id="checkIsFromRecommended"type="checkbox"style="height: 15px; width: 15px;"checked>清除兴趣推荐用户</td><td><input id="checkIsFollowing"type="checkbox"style="height: 15px; width: 15px;"checked>排除相互关注</td><td><input id="checkIsNormalFollowed"type="checkbox"style="height: 15px; width: 15px;">只检查通过推荐关注</td></tr><tr style="height: 10px;"></tr><tr><td rowspan="2"><input id="checkIsInactive"type="checkbox"style="height: 15px; width: 15px;"checked>清除不活跃用户</td><td>最低粉丝数<input id="fansMinCount"type="number"style="height: 15px; width: 60px;"min="0"value="2"></td><td rowspan="2"><input id="checkFansOrWeibo"type="checkbox"style="height: 15px; width: 15px;">满足任一条件即清除</td></tr><tr><td>最低微博数<input id="weiboMinCount"type="number"style="height: 15px; width: 60px;"min="0"value="3"></td></tr><tr><td><input id="checkIsDefaultIcon"type="checkbox"style="height: 15px; width: 15px;">清除默认头像用户</td><td><input id="checkIsFromWBRecommended"type="checkbox"style="height: 15px; width: 15px;">清除微博推荐用户</td></tr></table><h3>深度清粉参数</h3><table style="width: 100%; font-size: 15px;"><tr><td><input id="deepSearchMode"type="checkbox"style="height: 15px; width: 15px;"οnchange="SetDeepSearchParam();">开启深度清粉</td><td>最小不活跃天数:<input class="DeepSearchParam"id="minDayCount"type="number"style="height: 15px; width: 40px;"min="0"value="365"disabled></td><td><input class="DeepSearchParam"id="ignoreLikes"type="checkbox"style="height: 15px; width: 15px;"checked disabled>无视用户最近点赞</td></tr></table></div><div class="ready"><button style="position: relative; height: 45px; width:48%; font-size: 16px; margin: 4px 2px;"οnclick="StartRemoveFans();">清粉</button><button style="position: relative; height: 45px; width:48%; font-size: 16px; margin: 4px 2px;"οnclick="StartCheckFans();">检测</button></div><div class="running"style="display: none"><button style="position: relative; height: 45px; width:98%; font-size: 16px; margin: 4px 2px;"οnclick="StopFunc();">停止</button></div><div style="position: relative; margin: 4px 2px; flex-grow: 1; width: 100%; background-color: azure; overflow-y: scroll;"><p class="logger"></p></div><div style="position: absolute; bottom: 0px; height: 1px; width:100%; background-color: black"></div></div><div style="position: fixed; top:0; left: 500px; bottom: 0; right: 0;"><iframe class="web"src=""sandbox="allow-same-origin allow-scripts"style="width:100%; height:100%;"></iframe></div></body></html>';
document.body.innerHTML = body.replaceAll('ο', 'o');
let iframe = document.body.querySelector('iframe.web');
iframe.src = href;
iframe.onload=()=>{ iframe.contentDocument.body.querySelector("div[node-type=outer]")?.remove(); }
}
ReplaceHTML();
到了这里,关于赛博僵尸道长2023的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!