不保证能成功

  1. 浏览器打开自己的B站动态页面
  2. 将鼠标移入到你想要删除的动态上(删除多个的话,每条都需要进行改操作)
  3. 按F12打开开发者工具
  4. 进入控制台,输入下面代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
async function clickConfirmAfterEachItem() {
try {
const targetItems = document.querySelectorAll(
".tp.bili-dyn-more__btn .bili-cascader-options>.bili-cascader-options__item:last-of-type"
);

if (targetItems.length === 0) {
console.warn(
"未找到目标元素(.bili-cascader-options__item:last-of-type)"
);
return;
}

for (const item of targetItems) {
item.click()

await new Promise((resolve) => setTimeout(resolve, 1000));

const confirmBtn = document.querySelector(
".bili-modal__button.confirm.red"
);

if (!confirmBtn) {
console.error("未找到确认按钮(.bili-modal__button.confirm.red)");
return;
}

confirmBtn.click();

console.log(
`已完成第 ${Array.from(targetItems).indexOf(item) + 1}/${
targetItems.length
} 个动态的处理,已点击确认按钮`
);
}

console.log("所有动态处理完成");
} catch (error) {
console.error("执行过程中发生错误:", error);
}
}

clickConfirmAfterEachItem();