Giter Club home page Giter Club logo

delweibo's Introduction

delweibo's People

Contributors

dxhuii avatar oicebot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

delweibo's Issues

2021-10-08 删除失败,需要微调

我当前可见的菜单共 8 项:

0 置顶
1 推广
2 编辑微博
3 转换为粉丝可见
4 转换为好友圈可见
5 转换为自己可见
6 删除
7 复制微博地址

安装脚本后的第 57 行

    item[item.length - 3].click();

会命中菜单条目 8 - 3 = 5 转换为自己可见,会让第一条微博在 转换为自己可见转换为好友圈可见 状态间轮回。
改为

    item[item.length - 2].click();

后,命中到 8 - 2 = 6 删除,顺利删除。

感谢您的辛勤付出。

优化了删除效率: 含修改源码

更改说明:

  • 只是更改了 for( i<1000;)
  • 以及延迟了 reload() 的页面判断为 i > 160
  • 当前版本的微博首页, 会自动懒加载. 其实 reload 的延迟可以设置很久.

repo 插件的缺陷:

  • 删2条微博, 就会刷新页面 reload, 执行效率太低了.
  • 比手动删, 快不了多少.

优化版本:

  • 油猴插件, 可以直接改js 脚本, 保存后. 刷新 微博主页, 就能生效.
  • 懒得给作者提 PR 了.

使用方式: 油猴插件+编辑脚本文件(替换我如下源码)

  • 看到的朋友. 可以用我下面这个脚本. 其他逻辑都没有改动.
  • 再次感谢作者. 好人.
// ==UserScript==
// @name         批量删除新浪微博博文
// @namespace    https://github.com/dxhuii/delWeibo
// @version      1.0.10
// @description  批量删除新浪微博
// @author       plain
// @match        *://weibo.com/*/profile?*
// @match        *://weibo.com/u/*
// @match        *://weibo.com/fav*
// @match        *://weibo.com/u/page/fav/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    window.onload = () => {
        function $(elem) {
            return document.querySelector(elem);
        }
        function $All(elem) {
            return document.querySelectorAll(elem);
        }
        function del() {
            for (let i = 0; i < 1000; i++) {
                setTimeout(function() {
                    if(window.location.href.indexOf('//weibo.com/u/page/fav/') !== -1) { // 新
                        if($('i[title="更多"]')) {
                            $('i[title="更多"]').click();
                            $All('.woo-pop-item-main')[0].click();
                            if($('.woo-dialog-ctrl')) {
                                $('.woo-dialog-ctrl').querySelectorAll('.woo-button-main')[1].click();
                            }
                            i > 160 && window.location.reload();
                        }
                    }

                    if(window.location.href.indexOf('/profile') !== -1) { // 旧
                        if($('a[action-type="fl_menu"]')) {
                            $('a[action-type="fl_menu"]').click();
                            $('a[title="删除此条微博"]').click();
                            $('a[action-type="ok"]').click();
                            $('a[title="取消快转"]').click();
                        }
                    }
                    if(window.location.href.indexOf('//weibo.com/fav') !== -1) { // 旧,github网友提供 https://github.com/Syukkic
                        if($('a[action-type="fl_favorite"]')) {
                            $('a[action-type="fl_favorite"]').click();
                            $('a[action-type="ok"]').click();
                        }
                    }

                    if(window.location.href.indexOf('//weibo.com/u/') !== -1) { // 新
                        if($('i[title="更多"]')) {
                            $('i[title="更多"]').click();
                            const item = $All('.woo-pop-item-main');
                            if(item.length > 3) {
                                item[item.length - 2].click();
                            } else {
                                $('.woo-pop-item-main') && $('.woo-pop-item-main').click();
                            }
                            $('.woo-dialog-ctrl') && $('.woo-dialog-ctrl').querySelectorAll('.woo-button-main')[1].click();
                            if($('.deletedToolbar_toolbarFull_1dOfW')) {
                                $('.deletedToolbar_toolbarFull_1dOfW').click();
                            }
                            i > 160 && window.location.reload();
                        }
                    }
                }, 1000 * i);
            }
        }

        // 判断如果有cookie 就不再弹窗,直接进行删除微薄
        if(document.cookie.indexOf('delWeibo=1') !== -1) {
            del();
        } else {
            var r = confirm("确定好要删除所有微薄了吗,确定好了就点确定吧!");
            if (r === true) {
                document.cookie = 'delWeibo=1';
                del();
            }
        }
    };
})();

貌似这样成功率高点

if($('a[action-type="fl_menu"]')) {
$('a[action-type="fl_menu"]').click();
if($('a[action-type="fl_del_fast_reported"]')){
$('a[action-type="fl_del_fast_reported"]').click();
}
if($('a[action-type="feed_list_delete"]')){
$('a[action-type="feed_list_delete"]').click();
$('a[action-type="ok"]').click();
}
if($('a[action-type="feed_list_delete_fast_reported"]')){
$('a[action-type="feed_list_delete_fast_reported"]').click();
}
if($('a[title="取消快转"]')){
$('a[title="取消快转"]').click();
}
if($('a[action-type="ok"]')){
$('a[action-type="ok"]').click();
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.