B站-批量拉黑直播间机器人

批量拉黑直播间机器人

目前为 2024-12-11 提交的版本。查看 最新版本

// ==UserScript==
// @name         B站-批量拉黑直播间机器人
// @description  批量拉黑直播间机器人
// @namespace    https://gf.qytechs.cn/zh-CN/scripts/519962
// @version      1.0.6
// @note         更新于 2024年12月12日
// @license      MIT
// @icon         https://www.bilibili.com/favicon.ico
// @include      http://space.bilibili.com/*
// @include      https://space.bilibili.com/*
// @run-at       document-end
// @grant        GM_registerMenuCommand
// @grant        GM_addStyle
// @grant        GM_openInTab
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_xmlhttpRequest
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// ==/UserScript==

(function() {
    'use strict';

    // 从cookie中获取csrf_token
    var csrf_token = document.cookie.match(/(?<=bili_jct=).+?(?=;)/)[0];

    // 需要加入黑名单的UID列表
    const uid_list = [
        3546776046930594,
        3546739774589238,
        3546776317463299,
        3546741041269015,
        3546740993034384,
        3546751638178164,
        3493260519540812,
        3546794472508038,
        3546652910553267,
        3546677594032573,
        3546794403301573,
        3546656152750753,
        3546766708312646,
        3494361998297713,
        3546654636509299,
        3546654644898246,
        3546608931178814,
        3546656127584796,
        3546607012284656,
        3546656630901576,
        3546655817206124,
        3546778760644964,
        3546656469420368,
        3546760412661892,
        3546764527274008,
        3546586867043021,
        1938464087,
        3546760582531597,
        3546755194947608,
        3546789057661401,
        3546779928759179,
        3546787132475837,
        472738658,
        3546643123145231,
        1047441781,
        3546760899201197,
        3546776214702772,
        3546784137743274,
        247830407,
        3546760892909983,
        3546740747668080,
        3546726229085029,
        3546653829106509,
        3546719539169670,
        3546801051273762,
        3546727638371079,
        3546800180955840,
        3546761314437560,
        392427789,
        3546799820245917,
        3546652392557205,
        3546717068724629,
        3546753796147450,
        3546787363162777,
        3546801032399259,
        1920869180,
        3546643234294080,
        3546611160451732,
        3546775468116645,
        3546783410030893,
        3546786138426143,
        3546752472844964,
        3546791603604305,
        3546799553906720,
        3546761213774310,
        3546670105102441,
        3546766007863749,
        1738856490,
        1332005285,
        3546641321691585,
        1355276337,
        1830422345,
        3546654596663481,
        3546655892704220,
        279502432,
        279513013,
        3546655332764461,
        3546654600858402,
        309933628,
        3546655320180802,
        3546604273404664,
        160175853,
        3546644503070732,
        3546654569400348,
        3546641378314251,
        309831342,
        3546656096127238,
        279513321,
        3546656458934573,
        3546656320522794,
        279480466,
        3546591902305090,
        3546655309695289,
        1394122135,
        3546655911578057,
        1513289763,
        3546615371532754,
        3546646216444670,
        303357826,
        279479713,
        279513114,
        3546617988778048,
        3546655794137734,
        279515243,
        3546794279570035,
        3494357984348463,
        3546656089836096,
        3546654628121144,
        3546655603296263,
        3546654412114113,
        3546659585788033,
        279483805,
        3546720430459349,
        3546572845484288,
        322261454,
        3546652788918432,
        310642212,
        358678229,
        3546654896556552,
        302957418,
        3546654651189340,
        3546654728783954,
        3546655120951761,
        279514807,
        3546653455812609,
        3546655257266311,
        247830048,
        3546654433085698,
        3546654814767278,
        3546654649092931,
        306251576,
        3546609885383132,
        3546655873829041,
        3546655167089082,
        3546656142264973,
        3546654852516240,
        3546656148555885,
        3546564140206536,
        303349303,
        3546653405481122,
        3546654609246389,
        544909406,
        3546654649092334,
        3546763575167801,
        343267831,
        3546654571498062,
        3546655018191018,
        3546641355245904,
        3546655565547800,
        3546589427665485,
        3546656567986768,
        3546655274043577,
        620695476,
        279511078,
        3546571429907104,
        3546793912568080,
        279513620,
        3546654663772883,
        3546655964006962,
        420142987,
        3546655167088643,
        3546802829658925,
        3546787835021331,
        3546804419299347,
        629407829,
        3546799065271180,
        3546789128964128,
        3546636458396083,
        3546736031173077,
        1431353404,
        454847393,
        3546765447923892,
        3546781052832172,
        3546802728995574,
        3546645121730966,
        3546610822810053,
        3546655282432733,
        3546567319488807,
        3546605261162544,
        3546763262692165,
        311883221,
        3546655869635264,
        326615073,
        3493285295294615,
        1170951322,
        279513119,
        3546645664893138,
        332716059,
        3493290452191616,
        3546624064227336,
        279513333,
        3546653806037294,
        3546391911598566,
        3546652270921998,
        3546606657865742

    ];

    // 需要移出黑名单的已注销UID列表
    const del_uid_list = [
        35467994385640,
        354678115559314,
        3546812805811012

    ];

    // 批量拉黑函数
    function bacth_follow() {
        for (let i = 0; i < uid_list.length; i++) {
            setTimeout(function () {
                $.ajax({
                    url: '//api.bilibili.com/x/relation/modify',
                    type: "post",
                    xhrFields: {
                        withCredentials: true   // 携带跨域cookie
                    },

                    data: {
                        'fid': uid_list[i], // 要拉黑的UID
                        'act': 5,      // 加入黑名单
                        're_src': 11,
                        'jsonp': 'jsonp',
                        'csrf': csrf_token      // CSRF令牌
                    }
                })

                $.ajax({
                    url: '//api.bilibili.com/x/relation/modify',
                    type: "post",
                    xhrFields: {
                        withCredentials: true   // 携带跨域cookie
                    },

                    data: {
                        'fid': del_uid_list[i], // 要清除的已注销UID
                        'act': 6,      // 移出黑名单
                        're_src': 11,
                        'jsonp': 'jsonp',
                        'csrf': csrf_token      // CSRF令牌
                    }
                })

                console.log("拉黑的UP主页:https://space.bilibili.com/" + uid_list[i])   //输出日志
                if(i===uid_list.length-1){
                    alert('批量拉黑操作,执行完毕');
                }

            }, i * 100)
        };
    }

    // 执行批量拉黑操作
    function createButton() {
        // 创建一个按钮元素
        var zButton = document.createElement('button');

        // 设置按钮的文本
        zButton.textContent = '开始批量拉黑';

        // 设置按钮的样式
        zButton.className = 'dynamic-button'; // 添加类名以便后续操作
        zButton.style.position = 'fixed';
        zButton.style.bottom = '20px';
        zButton.style.right = '20px';
        zButton.style.zIndex = '9999';
        zButton.style.backgroundColor = '#f25d8e';
        zButton.style.color = 'white';
        zButton.style.padding = '10px 20px';
        zButton.style.border = 'none';
        zButton.style.borderRadius = '5px';
        zButton.style.cursor = 'pointer';

        // 为按钮添加点击事件监听器
        zButton.addEventListener('click', function() {
            // 当用户点击按钮时,执行批量拉黑操作
            bacth_follow();
        });
        // 添加按钮到页面
        document.body.appendChild(zButton);
    }

    // 执行创建开始按钮的操作
    createButton();
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址