本地黑名单-新浪微博

我的地盘,我做主!

// ==UserScript==
// @name         本地黑名单-新浪微博
// @namespace    http://tampermonkey.net/
// @version      0.2.1
// @description  我的地盘,我做主!
// @author       lavaf
// @match        https://weibo.com/
// @match        https://weibo.com/*
// @match        https://s.weibo.com/weibo?q=*
// @match        https://s.weibo.com/weibo/*
// @match        https://d.weibo.com/*
// @grant        none
// @require         https://cdn.bootcss.com/jquery/3.4.1/jquery.js
// ==/UserScript==

(function() {
    'use strict';
    //https://s.weibo.com/weibo?q=%E8%B7%AF%E8%AF%9E%E5%85%88%E7%94%9F&wvr=6&b=1&Refer=SWeibo_box
    let blackList=['1095240537','1739623952','2422966453','5872687669','6071579739','2832328014','1246989224',
    '1707826455','6342595981','1254509761','5584699175','5904645803','1672009073','6076330983',
    '6456278033','6252599351','1846897444','5714665931','2799621212','5622091826','5682311618','5283076169',
    '1651909015','6316344897','2128782104','1927917084','2752865265','1896116202','2103936197','2112238255',
    '2865491782','2161285474','6150149028','1679497140','6569600635','1198432330','1708837061','2707058873',
    '5512757319','1865051515','6826458805','5204499107','3265269384','1743840000','1893624707','2308998613',
    '7378216730','6042105402','5832193584','6936079456','5186265158','1497406907','2067535333','6345935237',
    '1966575391','2207117132','5347867637','5246052917','5202581201','7366694702','1221586910','1836763517',
    '3759602395','5467378834','5244091770','1481324167','2550548823','2821429691','1409641392','5976381459',
    '5375644381','2864097890','6117474447','1525376535','2707473871','1642088277','3834755446','1107845313',
    '1729395733','1646422590','3889809204','3118326075','1790047035','6029852493','1960631174','5525661902',
    '1353509550','2288595114','5817080538','3054114113','1575619643','7276034416','1663819761','1223812162',
    '1852184611','7388970498','6725370797','5874234020','1708533224','2423325250','5097649095','3489552987',
    '6233189472','6610865860','6618748130','5829653398','5645463500','7318146004','2249877443','6433748377',
    '1621229732','2623681923','6478319459','5726983480','5073745996','5409926707','7133969587','7406841612',
    '6854267440','5534010924','6854267440','1081273845','6214497703','6051672130','3173379207','1774452431',
    '2266078273','1643194824','3587736880','2038088420','6010980137','6499603060','2933933160','1233848760',
    '2515724614','6531942617','5124848832','3176903793','1649173367','6161591278','5235373093','2334479323',
    '7237942578','1439468794','2530653400','5936742166','6483117154','2274533430','1646809724','3173831862',
    '3861637947','6330190212','7060567997','6152993811','2107947800','5676315927','6036499194','6552619683',
    '2954601765','5329758882','7016060628','6867714779','1764760204','5790183505','6457653381','6883057572',
    '5591438111','1633588670','6338172523','1764760204','2405960045','5379258328','1996358470','3489835601',
    '5208094127','1713520817','5265134358','5680268576','1073273791','6304986702','5366062595','7375863094',
    '6299828876','6504785918','6549877954','1496940541','2543579625','2882152550','5706966061','3538233267',
    '2699348030','2140325182','1765421763','1632656524','5643533899','5812282880','3829227023','6053326016',
    '1742591465','1183186652','7036322361','5333937989','6348028370','2941996635','1049862605','2656861825',
    '5651500951','1442783975','1400617904','6289549776','2661982093','6870772320','5632044829','5160687416',
    '5604951354','3754473064','3625788752','6081744745','6297828734','6610528977','6450289839','6450289839',
    '5734852264','3662721101','2706508644','5928267794','3910455156','5803122677','6029762667','5660330600',
    '2088874107','7020996998','1652768147','1308165280','3212476685','6343775938','3790673270','1677403621',
    '7329923401','6697274401','6489233789','3275085401','2607875395','7454125721','5645240699','6101787487',
    '3525925645','3192574940','1671675572','6976255023','5822161069','3919792526','5967321193','1773206563',
    '7395343315','5703807437','5617991845','5569450037','2534494835','3185057053','5685445107','5985305304',
    '2813432731','1712402923','2427835305','7241123911','5682029815','1747537062','6681791335','1843475940',
    '2019743535','6368625304','7028970089','1615420827','1644700745','2011848973','2087656595','1738580712',
    '2905578983','6470901910','6649421500','6550596895','7275538696','6190644910','2925219620','2203318630',
    '3077157477','6572778130','2954325032','2141611490','6735820241','6250455238','5950044539','6732437773',
    '6320525484','2677204684','1421011563','5493483288','6420427870','2824136327','5100980780','3201102714',
    '5614275287','5982093060','1467883652','3310872281','7048875874','5761575336','2275757881','3237139890',
    '1881940564','1799510455','6564673602','2456266501','3026570553','6512113818','1959830294','3170235842',
    '5644576705','7189933293','1780944561','5690428069','6434996036','7256718176','1682023293','96155866',
        '2705087863',
        '1716300575','3905327796','2631952531','2963989755','5338099477','1833665195','6355083739','6679292544',
    '1870736965','5647119937','1888015977','1823087383','2883340160','2814697172','5505719076','2102720142',
    '1937627901','1727659112','5458469167','1952195195','5649381807','1929060243','2641910215','5528678952',
    '2836610594','1936359800','2637339372','3502466401','5255998308','5640261250','1784491561','2612122801',
    '2143372152','2513314580','2160176954','1597428653','2770907897','5486655240','6436177344','1649111590',
    '1729382834','5743386999','1969030412','1779990993','5074648251','1682023293','1201573204','1611454944',
    '6027174524','3209225565','3878220945','1770154187','3666192867','6540407299','2101473681','2670024403',
    '1905404365','1291446497','6593704215'];
    let set=new Set(blackList);
    setInterval(function () {
        //console.log('start')
        
        let nameList=$("div.WB_feed_type");
        nameList.each(function (i,e) {
            if ($(e).attr('data-lavaf') !== '1') {
                let fb = $(e).find("a.W_fb");
                if (fb.length == 0) {
                    console.log(e);
                    return;
                }
                let id = fb.attr("usercard");
                let index=id.indexOf("&");
                let s = id.substring(3,index);
                if (set.has(s)) {
                    $(e).text(id+" 此用户已经被屏蔽")
                    $(e).attr('data-lavaf','1');
                }
            }

        });
        let List=$("div.list_li");
        List.each(function (i,e) {
            if ($(e).attr('data-lavaf') !== '1') {
                let id = $(e).find('div.WB_text').children("a").attr("usercard")
                if (id.indexOf("2826909263")>=0) {
                    console.log(id,set.has('2826909263'));
                }
                for (const blackListKey in blackList) {
                    if (blackList.hasOwnProperty(blackListKey)) {
                        //console.log(id);
                        if ("id="+blackList[blackListKey] === id) {
                            $(e).text(id+" 此用户已经被屏蔽");
                            $(e).attr('data-lavaf','1');
                            break;
                        }
                    }
                }
            }

        });
        let List1=$("div.card-wrap[action-type='feed_list_item']");
        List1.each(function (i,e) {
            if ($(e).attr('data-lavaf') !== '1') {
                let fb = $(e).find("a.name");
                if (fb.length == 0) {
                    //console.log(e);
                    return;
                }
                let id = fb.attr("href");
                for (const blackListKey in blackList) {
                    if (blackList.hasOwnProperty(blackListKey)) {
                        //console.log(id);
                        //console.log("s:"+s+" "+id);
                        if (id.indexOf("//weibo.com/"+blackList[blackListKey]+"?")  === 0) {
                            $(e).text(id+" 此用户已经被屏蔽")
                            $(e).attr('data-lavaf','1');
                            break;
                        }
                    }
                }

            }

        });
        //
        let List2=$("div.card-review[node-type='feed_merge_list_reply_item']");
        List2.each(function (i,e) {
            if ($(e).attr('data-lavaf') !== '1') {
                let fb = $(e).find("a.name");
                if (fb.length == 0) {
                    //console.log(e);
                    return;
                }
                let id = fb.attr("href");
                for (const blackListKey in blackList) {
                    if (blackList.hasOwnProperty(blackListKey)) {
                        //console.log(id);
                        //https://weibo.com/u/5790183505?refer_flag=1001030103_
                        if (id.indexOf("////weibo.com/u/"+blackList[blackListKey]+"?")  === 0) {
                            $(e).text(id+" 此用户已经被屏蔽")
                            $(e).attr('data-lavaf','1');
                            break;
                        }
                    }
                }

            }

        });
        let List3=$("div.card-review");
        List3.each(function (i,e) {
            if ($(e).attr('data-lavaf') !== '1') {
                let fb = $(e).find("a.name");
                if (fb.length == 0) {
                    //console.log(e);
                    return;
                }
                let id = fb.attr("href");
                for (const blackListKey in blackList) {
                    if (blackList.hasOwnProperty(blackListKey)) {
                        //console.log(id);
                        //https://weibo.com/u/5790183505?refer_flag=1001030103_
                        if (id.indexOf("//weibo.com/u/"+blackList[blackListKey]+"?")  === 0) {
                            $(e).text(id+" 此用户已经被屏蔽")
                            $(e).attr('data-lavaf','1');
                            break;
                        }
                    }
                }

            }

        });
    },500)

})();