delete-sina-weibo-posts

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

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

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

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

// ==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();
}