Skip to content

Instantly share code, notes, and snippets.

@JaymzZh
Forked from mariotaku/README.md
Created January 19, 2016 00:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JaymzZh/88caf267dca9a0873941 to your computer and use it in GitHub Desktop.
Save JaymzZh/88caf267dca9a0873941 to your computer and use it in GitHub Desktop.
删除当前屏幕所有微博

删除所有微博

在Chrome Dev Tools中粘贴代码到Console,就可以删除当前屏幕所有微博。经过测试一万条微博大约需要10小时的半人工操作。

每批删除大概一分钟,最多50条。

如果遇到微博的Rate limit(提示操作过快),稍等三五分钟再试即可。

/*
* 在weibo.com的个人首页删除当前屏幕所有微博
*/
var http = new XMLHttpRequest();
var anchors = document.getElementsByTagName("div");
for (i = 0; i < anchors.length; i++) {
// 找到有mid属性的div元素
var mid = anchors[i].getAttribute("mid");
if (mid) {
console.log("Deleting " + mid);
// 这是微博的删除接口
var url = "/aj/mblog/del?ajwvr=6";
var params = "mid=" + mid;
http.open("POST", url, false);
//Send the proper header information along with the request
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.send(params);
}
}
window.location.reload();
/*
* 在weibo.cn的个人微博列表删除当前屏幕所有微博
* 推荐把屏幕条数设置为50,这样删得多很多
*/
var http = new XMLHttpRequest();
// 找到所有链接
var anchors = document.getElementsByTagName("a");
for (i = 0; i < anchors.length; i++) {
var name = anchors[i].textContent;
// 找出文字为“删除”的链接
if (name == "删除") {
var delLink = anchors[i].getAttribute("href");
console.log("Deleting " + delLink);
// 实际删除操作是删除确认的URL+如下两个参数
var url = delLink + "&type=del&act=delc";
http.open("GET", url, false);
http.send();
}
}
// 重载页面
window.location.reload();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment