Code for bulk deleting Weibo post – 批量删除微博代码 – 201909 update

Only for Chinese user.

前言

微博会使用你的不活跃账号转发各种奇怪的账号。这种行为可能让你非常尴尬,因为你不是个八卦的人,而微博代表着曾经,也代表着你的形象。所以小方提供代码让你轻松删除所有微博。

代码与教程

教程

代码

function main() {
    let scrollTimes = 0;
    scrollToPageBottom();

    setTimeout(() => delPost(), 4000);

    setTimeout( () => nextPage(), 8000)

    function scrollToPageBottom(){
        setTimeout(
            () => {
                window.scrollTo(10000, 10000);
                if (++scrollTimes > 2) {
                    return
                }
                scrollToPageBottom();
            },
            1000
        );

    }

    function delPost(){
        var arr = [].slice.call(document.querySelectorAll('[mid]')).map((e) => {return e.getAttribute('mid').replace(/mid\=\"\d*\"/, "$1")})
        arr.forEach((mid) => {

            const xhr = new XMLHttpRequest();
            xhr.open('POST', '/aj/mblog/del?ajwvr=6', true);
            const formData = new FormData();
            formData.append('mid', mid);
            xhr.send( formData )

        })

    }

    function nextPage(){
        document.querySelector('.page.next').click();
        setTimeout(() => main(), 2000)
    }

}
main();

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.