Skip to content

Instantly share code, notes, and snippets.

@cyio
Last active May 18, 2020 21:53
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save cyio/98c847bf6bfc5d016f51 to your computer and use it in GitHub Desktop.
Save cyio/98c847bf6bfc5d016f51 to your computer and use it in GitHub Desktop.
【用户脚本】删除我的微博
  • 模拟人工操作删除微博(按条),需登陆自己的微博主页使用。
  • 每页大楖25条,删完微博会刷新,等加载完继续删。
  • 用户可随时手动关闭微博页面或禁用脚本,以便停止删除操作。
  • 即使弹框“服务繁忙”,也不影响删除操作。
  • 运行时占CPU较高,待优化。

在Chrome+Tampermonkey环境下测试通过

// ==UserScript==
// @name Delete My Weibo
// @namespace http://cyio.github.io/
// @version 0.1
// @description 模拟人工操作删除微博(按条),需登陆自己的微博主页使用
// @description 即使弹框“服务繁忙”,也不影响删除操作。不过,运行时占CPU较高,待优化。
// @author Oaker
// @match http://www.weibo.com/*/profile?*
// @match http://weibo.com/*/profile?*
// @grant none
// ==/UserScript==
function delWeibo() {
if (!document.querySelectorAll('.screen_box a')[0]) return false;
if (window.confirm("是否确定要删除微博?")) {
document.querySelectorAll('.screen_box a')[0].click();
if (!document.querySelectorAll('.screen_box ul li a')[0]) return false;
document.querySelectorAll('.screen_box ul li a')[0].click();
if (!document.querySelectorAll('.btn a.W_btn_a')[0]) return false;
document.querySelectorAll('.btn a.W_btn_a')[0].click();
}
}
window.onload = setInterval(delWeibo, 1000);
@prinsss
Copy link

prinsss commented Jan 31, 2017

感谢分享 👍

@XuHaiDong
Copy link

老哥,请问一下,一次批量删除太多会不会封号啊。。。

@guimaizi
Copy link

thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment