diff --git a/lib/clear.js b/lib/clear.js index b78efac..a26abcf 100644 --- a/lib/clear.js +++ b/lib/clear.js @@ -33,7 +33,7 @@ async function getFollowList(partition) { * 清理动态和关注 */ async function clear() { - const { search_wait, clear_white_list, clear_max_day, clear_quick_remove_attention, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type, clear_partition } = config; + const { search_wait, clear_white_list, clear_max_day, clear_quick_remove_attention, clear_quick_remove_attention_fans_number_smallest, clear_remove_dynamic, clear_remove_attention, clear_remove_delay, clear_dynamic_type, clear_partition } = config; let success = true; const uid_list = (await Promise.all(clear_partition.split(',').map(getFollowList))).flat(); if (!uid_list.length) { @@ -45,13 +45,17 @@ async function clear() { log.info('清理关注', '进入只清理关注模式') /* 专清关注 */ for (const [index, uid] of uid_list.entries()) { - log.info('清理关注', `(${index}) (${uid})`) - /* 取消关注 */ - if (await retryfn(3, [false], () => bili.cancelAttention(uid))) { - log.info('清理关注', '成功') - } else { - log.error('清理关注', '失败') - break + const fannumber = await bili.getUserInfo(uid); + log.info('清理关注', `粉丝数${fannumber}`) + if (fannumber !== -1 && fannumber < clear_quick_remove_attention_fans_number_smallest) { + log.info('清理关注', `(${index}) (${uid})`) + /* 取消关注 */ + if (await retryfn(3, [false], () => bili.cancelAttention(uid))) { + log.info('清理关注', '成功') + } else { + log.error('清理关注', '失败') + break + } } /* 延时 */ await delay(clear_remove_delay); diff --git a/lib/data/config.js b/lib/data/config.js index 3847872..3a96967 100644 --- a/lib/data/config.js +++ b/lib/data/config.js @@ -408,6 +408,13 @@ const config = { */ clear_quick_remove_attention: false, + /** + * - 快速移除关注 + * - 不加判断只去除关注 + * - 移除粉丝数小于指定数量的 + */ + clear_quick_remove_attention_fans_number_smallest: Infinity, + /** * 是否移除动态 */ @@ -419,7 +426,7 @@ const config = { clear_remove_attention: true, /** - * 清除动态延时(毫秒) + * 清除延时(毫秒) */ clear_remove_delay: 8000, diff --git a/my_config.example.js b/my_config.example.js index 3585ad3..690dd8b 100644 --- a/my_config.example.js +++ b/my_config.example.js @@ -418,6 +418,13 @@ module.exports = Object.freeze({ */ clear_quick_remove_attention: false, + /** + * - 快速移除关注 + * - 不加判断只去除关注 + * - 移除粉丝数小于指定数量的 + */ + clear_quick_remove_attention_fans_number_smallest: Infinity, + /** * 是否移除动态 */ @@ -429,7 +436,7 @@ module.exports = Object.freeze({ clear_remove_attention: true, /** - * 清除动态延时(毫秒) + * 清除延时(毫秒) */ clear_remove_delay: 8000,