Last active
September 4, 2023 10:34
-
-
Save naoyeye/3f9cb391b8981e90aac82207f0efccb8 to your computer and use it in GitHub Desktop.
批量清除豆瓣黑名单用户
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 在黑名单管理页面( https://www.douban.com/contacts/blacklist ),打开浏览器的 dev tools。在 console 中输入以下代码,回车 | |
let list = [] | |
let start_num = 0 | |
$('.obss.namel dl').each((i, ele) => { | |
const target = $(ele).find('.gact-item .gact a') | |
const username = $(ele).find('dd a').attr('href').split('/')[4] | |
const nickname = $(ele).find('dd').text() | |
const url = target.attr('href') | |
list.push({ | |
username, | |
url, | |
nickname, | |
}) | |
}) | |
setTimeout(() => { | |
kick() | |
}, 100) | |
function kick() { | |
if (!list[start_num]) { | |
console.log('本页用户已全部清除,请刷新页面后再次执行此脚本') | |
return | |
} | |
$.ajax({ | |
url: list[start_num].url, | |
method: 'GET', | |
success: () => { | |
console.log(`成功清除${list[start_num].username} - ${list[start_num].nickname}`) | |
start_num = start_num + 1 | |
// 每两秒清除一个 | |
setTimeout(() => { | |
kick() | |
}, 2000) | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment