delete-sina-weibo-posts

删除所有微博,需要进入个人页面才会触发;删除微博代码取自:https://gist.github.com/mariotaku/e00b6b93663f2f420ef9

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         delete-sina-weibo-posts
// @namespace    https://ox0spy.github.io/
// @version      0.2
// @description  删除所有微博,需要进入个人页面才会触发;删除微博代码取自:https://gist.github.com/mariotaku/e00b6b93663f2f420ef9
// @author       ox0spy
// @match        https://weibo.com/*/profile*
// @match        https://www.weibo.com/*/profile*
// @match        https://weibo.com/*/profile*
// @match        https://www.weibo.com/*/profile*
// @match        https://weibo.com/p/*
// @match        https://www.weibo.com/p/*
// @compatible   chrome  支持
// @run-at       document-idle
// @grant        none
// ==/UserScript==

'use strict';

window.setTimeout(deletePosts,1000 * 3);

function deletePosts() {
    var http = new XMLHttpRequest();
    var anchors = document.getElementsByTagName("div");
    var i = 0;
    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();
}