From 9f0c49bbb8fba8369f19769d98d391bf0a924a50 Mon Sep 17 00:00:00 2001 From: Huansheng1 <2933903535@qq.com> Date: Sun, 24 Jan 2021 16:39:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=AE=80=E5=8D=95=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E4=B8=8B=E7=99=BD=E5=90=8D=E5=8D=95=E7=94=A8=E6=88=B7ID?= =?UTF-8?q?=E5=92=8C=E5=8F=96=E4=B8=80=E4=B8=AA=E5=81=87=E9=9A=8F=E6=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/clear.js | 12 +++++++----- lib/config.js | 8 +++++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/clear.js b/lib/clear.js index 7b1be83..d0322d6 100644 --- a/lib/clear.js +++ b/lib/clear.js @@ -4,9 +4,10 @@ const BiliAPI = require("./BiliAPI"); const Public = require("./Public"); const GlobalVar = require('./GlobalVar.json'); const { clearDyid } = require("./MyStorage"); +const { followWhiteList } = require("./config"); let offset = '0'; -async function delDynamic() { +async function delDynamic () { for (let index = 0; index < 1000; index++) { const { allModifyDynamicResArray, offset: _offset } = await Public.prototype.checkAllDynamic(GlobalVar.myUID, 1, 5 * 1000, offset); offset = _offset; @@ -28,15 +29,16 @@ async function delDynamic() { if (offset === '0') break; } } -async function unFollow() { +async function unFollow () { const tagid = await checkMyPartition(); if (tagid === 0) { console.log('未能成功获取关注分区id'); return } let rmup = []; for (let index = 1; index < 42; index++) { const uids = await BiliAPI.getPartitionUID(tagid, index); await Base.delay(5 * 1000); - rmup.push(...uids); - if (uids.length === 0) break; + const cancelFollowUIDList = uids.filter(uid => followWhiteList.split(',').indexOf(String(uid)) === -1); + if (cancelFollowUIDList.length) rmup.push(...cancelFollowUIDList); + if (cancelFollowUIDList.length === 0) break; } for (let index = 0; index < rmup.length; index++) { const uid = rmup[index]; @@ -51,7 +53,7 @@ async function unFollow() { /** * 清理动态和关注 */ -async function clear() { +async function clear () { await delDynamic(); await unFollow(); await clearDyid(); diff --git a/lib/config.js b/lib/config.js index 2470dc8..7b47528 100644 --- a/lib/config.js +++ b/lib/config.js @@ -5,11 +5,13 @@ module.exports = { model: '11', chatmodel: '01', maxday: '-1', - wait: '60000', + wait: String(Math.floor(Math.random() * 30000) + 60000), minfollower: '500', blacklist: '28008897,28272016,140389827,24598781,28008860,28008880,28008743,28008948,28009292,319696958,90138218,28272000,28272047,28271978,8831288,175979009,3177443,486780865,403048135,474325039,455274996,477519424,292671666,448873224,22498938,1770865,444796995,306112375,320193786,606637517,305276429,204487541,404761800,186914127,99439379,457697569,270886929,477519424,401575,201296348,206804212,333584926,34679178,699923691,392689522,178700744,272882445,350977368,487168411,22682842,444949061,523974463,192231907,503908324,383189098,252909207,336467750,264875137,90721742,452299642,677739290,441522918,8766623,698327474,5439672', - blockword: ["脚本抽奖","恭喜","结果"], - whiteklist: '', + blockword: ["脚本抽奖", "恭喜", "结果"], + whitelist: '', + // 不想清空的关注UP主名单,同样用,分割 + followWhiteList: '', relay: ['转发动态'], chat: [ '[OK]', '[星星眼]', '[歪嘴]', '[喜欢]', '[偷笑]', '[笑]', '[喜极而泣]', '[辣眼睛]', '[吃瓜]', '[奋斗]', From e317220df47548e683d76521f065f190d0496383 Mon Sep 17 00:00:00 2001 From: Huansheng1 <2933903535@qq.com> Date: Sun, 24 Jan 2021 17:28:32 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=80=E4=B8=8B?= =?UTF-8?q?=E9=9A=8F=E6=9C=BA=E6=97=B6=E9=97=B4=EF=BC=8C=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84whitelist=EF=BC=9B=E6=9C=AA?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=85=B3=E6=B3=A8=E7=99=BD=E5=90=8D=E5=8D=95?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/clear.js | 10 +++++++--- lib/config.js | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/clear.js b/lib/clear.js index d0322d6..72fc805 100644 --- a/lib/clear.js +++ b/lib/clear.js @@ -36,9 +36,13 @@ async function unFollow () { for (let index = 1; index < 42; index++) { const uids = await BiliAPI.getPartitionUID(tagid, index); await Base.delay(5 * 1000); - const cancelFollowUIDList = uids.filter(uid => followWhiteList.split(',').indexOf(String(uid)) === -1); - if (cancelFollowUIDList.length) rmup.push(...cancelFollowUIDList); - if (cancelFollowUIDList.length === 0) break; + const cancelFollowUIDList = followWhiteList.length ? + uids.filter(uid => followWhiteList.split(',').indexOf(String(uid)) === -1) : uids; + if (cancelFollowUIDList.length) { + rmup.push(...cancelFollowUIDList); + } else { + break; + } } for (let index = 0; index < rmup.length; index++) { const uid = rmup[index]; diff --git a/lib/config.js b/lib/config.js index 7b47528..c128a43 100644 --- a/lib/config.js +++ b/lib/config.js @@ -5,11 +5,10 @@ module.exports = { model: '11', chatmodel: '01', maxday: '-1', - wait: String(Math.floor(Math.random() * 30000) + 60000), + wait: String(Math.floor(Math.random() * 1000) + 60000), minfollower: '500', blacklist: '28008897,28272016,140389827,24598781,28008860,28008880,28008743,28008948,28009292,319696958,90138218,28272000,28272047,28271978,8831288,175979009,3177443,486780865,403048135,474325039,455274996,477519424,292671666,448873224,22498938,1770865,444796995,306112375,320193786,606637517,305276429,204487541,404761800,186914127,99439379,457697569,270886929,477519424,401575,201296348,206804212,333584926,34679178,699923691,392689522,178700744,272882445,350977368,487168411,22682842,444949061,523974463,192231907,503908324,383189098,252909207,336467750,264875137,90721742,452299642,677739290,441522918,8766623,698327474,5439672', blockword: ["脚本抽奖", "恭喜", "结果"], - whitelist: '', // 不想清空的关注UP主名单,同样用,分割 followWhiteList: '', relay: ['转发动态'],