BiliBili哔哩哔哩推荐关键词屏蔽

BiliBili哔哩哔哩屏蔽与相应关键词有关的视频与直播

目前為 2020-05-16 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name BiliBili哔哩哔哩推荐关键词屏蔽
// @description BiliBili哔哩哔哩屏蔽与相应关键词有关的视频与直播
// @namespace https://space.bilibili.com/482343
// @author 超神越鬼
// @license 超神越鬼
// @version 2.0
// @include *bilibili.com*
// @exclude *message.bilibili.com*
// @run-at document-end
// @grant GM_setValue
// @grant GM_getValue
// @noframes
// ==/UserScript==
//dd 都屏蔽, bt 只屏蔽标题, zz 只屏蔽up主  在这里添加,运行一次后会保存,在存储里修改删除。
var dd = new Array("","","","","");
var bt = new Array("","","","","");
var zz = new Array("","","","","");
var i,c,fl,x,debugx = 0;
var toObj = function( arr ){ var obj = {}; for(var temp in arr){ obj[arr[temp]] = true; } return obj;};
var toArr = function( obj ){ var arr = []; for(var temp in obj){ arr.push(temp); } return arr;};
var together = function( a,b ){ for(var temp in b){ if(b[temp]!="")a.push(b[temp]);}};
var getUniq = function(arr){ return toArr( toObj(arr) );};
var ddx = GM_getValue("dd",new Array(""));
var btx = GM_getValue("bt",new Array(""));
var zzx = GM_getValue("zz",new Array(""));
together(ddx,dd);together(btx,bt);together(zzx,zz);
ddx =getUniq(ddx);btx =getUniq(btx);zzx =getUniq(zzx);
GM_setValue("dd", ddx);GM_setValue("bt", btx);GM_setValue("zz", zzx);
dd=ddx;bt=btx;zz=zzx;
bt.push.apply(bt,dd);
zz.push.apply(zz,dd);
function sc() {
     if (debugx)console.log("删除开始 ");
     for (x in zz) {if(zz[x] != ""){
          //在线列表up主
          fl = document.evaluate('//div[@class="online-list"]/div[@class="ebox"]/div[@class="dlo"]/a[contains(text(),"' + zz[x] + '")]/../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除1 ",zz[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          //直播up主
          fl = document.evaluate('//div[@class="live-card"]/a/div[@class="up"]/div[@class="txt"]/p[@class="name" and contains(text(),"' + zz[x] + '")]/../../../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除2 ",zz[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="room-ctnr w-100"]/div[@class="room-card-wrapper p-relative dp-i-block"]/a/div[@class="card-info-ctnr"]/div[@class="text-info-ctnr body-bg p-relative dp-i-block v-middle"]/div[@class="room-anchor card-text p-relative"]/span[contains(text(),"' + zz[x] + '")]/../../../../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除2b ",zz[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          //视频up主
          fl = document.evaluate('//div[@class="zone-list-box"]/div[@class="video-card-common"]/a[@class="up"]/i[contains(text(),"' + zz[x] + '")]/../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除3 ",zz[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="ext-box"]/div[@class="video-card-common ex-card-common"]/a[@class="ex-up"]/i[contains(text(),"' + zz[x] + '")]/../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除3b ",zz[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="rec-list"]/div[@class="video-page-card"]/div[@class="card-box"]/div[@class="info"]/div[@class="count up"]/a[contains(text(),"' + zz[x] + '")]/../../../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除4 ",zz[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
     }}
     for (x in bt) {if(bt[x] != ""){
          //在线列表标题
          fl = document.evaluate('//div[@class="online-list"]/div[@class="ebox"]/a[1]/p[contains(text(),"' + bt[x] + '")]/../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除5 ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          //直播标题
          fl = document.evaluate('//div[@class="live-card"]/a/div[@class="up"]/div[@class="txt"]/p[@class="desc" and contains(text(),"' + bt[x] + '")]/../../../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除6 ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="room-ctnr w-100"]/div[@class="room-card-wrapper p-relative dp-i-block"]/a/div[@class="card-info-ctnr"]/div[@class="text-info-ctnr body-bg p-relative dp-i-block v-middle"]/span[contains(text(),"' + bt[x] + '")]/../../../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除6b ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          //视频标题
          fl = document.evaluate('//div[@class="zone-list-box"]/div[@class="video-card-common"]/a[@class="title" and contains(text(),"' + bt[x] + '")]/..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除7 ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="ext-box"]/div[@class="video-card-common"]/a[@class="title" and contains(text(),"' + bt[x] + '")]/..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除7b ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="ext-box"]/div[@class="video-card-common"]/a[@class="title"]/span[contains(text(),"' + bt[x] + '")]/../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除7c ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="storey-box clearfix"]/div[@class="spread-module"]/a/p[@class="t" and contains(text(),"' + bt[x] + '")]/../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除8 ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//div[@class="rec-list"]/div[@class="video-page-card"]/div[@class="card-box"]/div[@class="info"]/a[@class="title" and contains(text(),"' + bt[x] + '")]/../../..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除9 ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
          fl = document.evaluate('//ul[@class="clearfix cube-list"]/li[@class="small-item fakeDanmu-item"]/a[@class="title" and contains(text(),"' + bt[x] + '")]/..', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
          if (fl.snapshotLength) {
               for (i = 0; i < fl.snapshotLength; i++) {
                    if (debugx)console.log("删除10 ",bt[x]," : ", fl.snapshotItem(i));
                    fl.snapshotItem(i).remove();
               }
          }
     }}
     return false;
}
if (location.href.indexOf("video/")>-1 || location.href.indexOf("play/")>-1){
     if (debugx)console.log("A 视频播放模式 ",location.href);
     setTimeout(sc,10000);
}else{
     if (debugx)console.log("B 列表模式 ",location.href);
     sc; setInterval(sc,2000);
}