之前试了几个别的代码都不行,这个亲测有效,三千多条微博都给一键删干净了。
一、具体操作方法:
1、打开wb网页版,个人主页(个人用的谷歌浏览器)。
2、按F12,笔记本按住Fn+F12,进入控制台(Console),把下面的代码贴进去,回车启动。
二、小贴士:
1、MAC:command+option+i 唤起开发者工具
2、如果过程中有提示授权,需要先按照提示,填写要求的内容,然后回车授权,再贴代码回车。
3、效果就是:屏幕上不断看到系统自动删除微博。
4、想结束就刷新下页面。
三、代码如下:
function delay(timeout = 100) {
return new Promise((resolve) => {
setTimeout(() => {
resolve()
}, timeout)
})
}
function findOffsetParent (node) {
while (!node.offsetParent.classList.contains('vue-recycle-scroller__item-view')) {
node = node.offsetParent
}
return node.offsetParent
}
const initializedScrollTop = 600
let errorCount = 0
async function readyGo() {
const angleDownList = document.querySelectorAll('i[class="woo-font woo-font--angleDown morepop_action_bk3Fq"]')
const angleDownListLength = angleDownList.length
try {
if (!angleDownList) {
return console.log("微博改 class 或 dom 结构了,可以给我留言,我来修改脚本!!!")
}
if (!angleDownListLength) {
return console.log("这下清爽多了!!!")
}
// 展开下拉框
angleDownList[1].click()
// 点击删除
const popItems = document.querySelectorAll('div[class="woo-box-flex woo-box-alignCenter woo-pop-item-main"]')
for (let i = 0; i < popItems.length; i++) {
const node = popItems[i]
if (node.innerText === "删除") {
node.click()
break
}
}
await delay()
const offsetParent = findOffsetParent(angleDownList[1])
// 确认删除
document.querySelectorAll('button[class="woo-button-main woo-button-flat woo-button-primary woo-button-m woo-button-round woo-dialog-btn"]')[0].click()
await delay()
const doc = document.documentElement || document.body
doc.scrollTo(0,initializedScrollTop + offsetParent.offsetHeight)
errorCount = 0
} catch (e) {
if (errorCount >= 5) {
return console.error('重新执行吧:', e)
}
document.body.click()
errorCount += 1
readyGo()
return
}
if (angleDownListLength >= 2) {
readyGo()
}
}
readyGo()
免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。