Merge pull request #23 from Huansheng1/main

增加取关白名单和随机延迟功能
This commit is contained in:
shanmite 2021-01-24 17:33:49 +08:00 committed by GitHub
commit eea2e91eac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 8 deletions

View File

@ -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,20 @@ 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 = 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];
@ -51,7 +57,7 @@ async function unFollow() {
/**
* 清理动态和关注
*/
async function clear() {
async function clear () {
await delDynamic();
await unFollow();
await clearDyid();

View File

@ -5,11 +5,12 @@ module.exports = {
model: '11',
chatmodel: '01',
maxday: '-1',
wait: '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: ["脚本抽奖","恭喜","结果"],
whiteklist: '',
blockword: ["脚本抽奖", "恭喜", "结果"],
// 不想清空的关注UP主名单同样用,分割
followWhiteList: '',
relay: ['转发动态'],
chat: [
'[OK]', '[星星眼]', '[歪嘴]', '[喜欢]', '[偷笑]', '[笑]', '[喜极而泣]', '[辣眼睛]', '[吃瓜]', '[奋斗]',