您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
bilibili净化脚本,屏蔽各种不需要的页面元素、关键字、直播、广告
当前为
// ==UserScript== // @name bilibili净化 // @namespace evalcony // @version 0.3.0 // @description bilibili净化脚本,屏蔽各种不需要的页面元素、关键字、直播、广告 // @author evalcony // @match https://*.bilibili.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=bilibili.com // @grant none // @license MIT // @homepageURL https://github.com/evalcony/better-bilibili // ==/UserScript== (() => { 'use strict'; new MutationObserver(() => { // 首页 屏蔽词 list var blackList = [ // 首页屏蔽关键字 示例 '对局','页游','国服','国标','破防','好看','好听','打野','逆风','射手','下头','戒','女朋友', ]; // 个人动态页面 屏蔽词 list var dynBlackList = [ // 个人动态页屏蔽关键字 示例 '进口','转+评','拼多多','精美','券后','版型','官方店','库存','先拍','预告','治愈','投票','公示','VLOG','好货','实习生', '直播','猫咪','党校','转发有奖','巡礼','预约','分享动态','恭喜','中奖','甄别','还有谁','炎热','万粉','手气','封面', '即将','泰裤辣','安康','不见不散','分享视频','福利','转发','里程碑','UP主','快乐','按摩','冲牙器','实惠','便宜','豪礼', '到手','内裤','好好选' ]; // 动态、热门、频道 const channelIconsElement = document.querySelector('div.channel-icons'); if (channelIconsElement) { channelIconsElement.remove(); } const channelFixedLeftElement = document.querySelector('div.header-channel-fixed-left'); if (channelFixedLeftElement) { channelFixedLeftElement.remove(); } // 导航栏右侧 const channelRightElement = document.querySelector('a.channel-link__right'); if (channelRightElement) { channelRightElement.remove(); } // 推荐 const recommendedSwipeElement = document.querySelector('div.recommended-swipe.grid-anchor'); if (recommendedSwipeElement) { recommendedSwipeElement.remove(); } // // grid // const videoCardSkeletonElement = document.querySelector('div.bili-video-card__skeleton'); // if (videoCardSkeletonElement) { // videoCardSkeletonElement.remove(); // } // // grid封面 // const cardImageElement = document.querySelector('div.bili-video-card__image.__scale-player-wrap'); // if (cardImageElement) { // cardImageElement.remove(); // } // 直播card const floorCardSingleCardElement = document.querySelector('div.floor-card.single-card'); if (floorCardSingleCardElement) { floorCardSingleCardElement.remove(); } // 直播card //class="bili-live-card is-rcmd" const liveCardElement = document.querySelector('div.bili-live-card'); if (liveCardElement) { liveCardElement.remove(); } // 点赞数量标签 const videoCardInfoIconTextElement = document.querySelector('div.bili-video-card__info--icon-text'); if (videoCardInfoIconTextElement) { videoCardInfoIconTextElement.remove(); } // 页面滑动板块 const channelSwiperElement = document.querySelector('div.channel-swiper.channel-swiper-client'); if (channelSwiperElement) { channelSwiperElement.remove(); } // 热门 const asideWrapElement = document.querySelector('div.aside-wrap'); if (asideWrapElement) { asideWrapElement.remove(); } // 根据屏蔽词过滤grid const cardInfoElementList = document.querySelectorAll('div.bili-video-card') if (cardInfoElementList) { var max_len = 20 cardInfoElementList.forEach(card => { // var links = card.getElementsByTagName('a') var videoCardInfoRight = card.querySelector('div.bili-video-card__info--right') if (videoCardInfoRight) { var links = videoCardInfoRight.getElementsByTagName('a') if (links) { for (var i = 0; i < links.length; i++) { var title = links[i].textContent || links[i].innerText; var flag = false; for (var j = 0; j < blackList.length; ++j) { if (title.indexOf(blackList[j]) !== -1) { console.log("屏蔽词:" + blackList[j] + " title=" + title); flag = true; break; } } if (flag) { card.remove(); break; } // 标题缩减 if (title.length > max_len) { links[i].innerHTML = title.substring(0, max_len) } } } } // 广告 var svg = card.querySelector('svg.bili-video-card__info--ad') if (svg) { card.remove(); } }) } //-------------------------- // 删除动态搜索栏的占位文字 const navSearchInputElement = document.querySelector('input.nav-search-input') if (navSearchInputElement) { navSearchInputElement.removeAttribute('placeholder'); navSearchInputElement.removeAttribute('title'); } // 删除搜索历史 const searchPanelElement = document.querySelector('div.search-panel'); if (searchPanelElement) { searchPanelElement.remove(); } // 菜单栏 const leftEntryElement = document.querySelector('ul.left-entry'); if (leftEntryElement) { leftEntryElement.remove(); } // 菜单栏右边 const rightEntryVipElement = document.querySelector('a.right-entry__outside.right-entry--vip'); if (rightEntryVipElement) { rightEntryVipElement.remove(); } const rightEntryMessageElement = document.querySelector('li.v-popover-wrap.right-entry__outside.right-entry--message'); if (rightEntryMessageElement) { rightEntryMessageElement.remove(); } const headerUploadEntryElement = document.querySelector('div.header-upload-entry'); if (headerUploadEntryElement) { headerUploadEntryElement.remove(); } // up头像 const upAvatarElement = document.querySelector('div.up-avatar-wrap'); if (upAvatarElement) { upAvatarElement.remove(); } // 充电 const chargeBtnElement = document.querySelector('div.default-btn.new-charge-btn.charge-btn-loaded'); if (chargeBtnElement) { chargeBtnElement.remove(); } // //删除视频弹幕发送 //const videoPlayerSendingElement = document.querySelector('div.bpx-player-sending-bar'); //if (videoPlayerSendingElement) { //videoPlayerSendingElement.remove(); //} // 投诉 const videoComplaintElement = document.querySelector('div.video-toolbar-right-item.toolbar-right-complaint'); if (videoComplaintElement) { videoComplaintElement.remove(); } // 笔记 const videoNoteElement = document.querySelector('div.video-note.video-toolbar-right-item.toolbar-right-note'); if (videoNoteElement) { videoNoteElement.remove(); } // share const videoShareBtnElement = document.querySelector('div.video-share-wrap.video-toolbar-left-item'); if (videoShareBtnElement) { videoShareBtnElement.remove(); } // 下方 const leftContainerUnderPlayerElement = document.querySelector('div.left-container-under-player'); if (leftContainerUnderPlayerElement) { //leftContainerUnderPlayerElement.remove(); } //删除视频下方标签 const tagWrapElement = document.querySelector('div.tag-wrap'); if (tagWrapElement) { tagWrapElement.remove(); } // 广告 const adReportElement = document.querySelector('div.ad-floor-cover.b-img'); if (adReportElement) { adReportElement.remove(); } // 直播 const popLivePartElement = document.querySelector('div.pop-live-small-mode.part-undefined'); if (popLivePartElement) { popLivePartElement.remove(); } // 评论区 //const commentElement = document.querySelector('.comment'); //if (commentElement) { //commentElement.remove(); //} //-------------------------- 动态 // 个人动态 const biliDynItemsList = document.querySelectorAll('div.bili-dyn-item__main'); if (biliDynItemsList) { biliDynItemsList.forEach(item => { // 投票 var voteElement = item.querySelector('.bili-dyn-card-vote__body') if (voteElement) { console.log('屏蔽投票') item.remove(); return; } // 预约 var reserveElement = item.querySelector('.bili-dyn-card-reserve') if (reserveElement) { console.log('屏蔽预约') item.remove(); return; } // 正文 var richTextContent = item.querySelector('div.bili-rich-text__content') if (richTextContent) { var textElementList = richTextContent.getElementsByTagName('span') if (textElementList) { for (var i = 0; i < textElementList.length; i++) { var text = textElementList[i].textContent || textElementList[i].innerText; var flag = false; for (var j = 0; j < dynBlackList.length; ++j) { if (text.indexOf(dynBlackList[j]) !== -1) { console.log("包含指定字符串:" + dynBlackList[j]); flag = true; break; } } if (flag) { item.remove(); break; } } } } }) } // 右侧话题栏 const rightElement = document.querySelector('.right'); if (rightElement) { rightElement.remove(); } // --------------- // 直播房间-礼物栏 const giftControlPanelElement = document.querySelector('.gift-control-panel'); if (giftControlPanelElement) { giftControlPanelElement.remove(); } // 直播房间-视频下方区域 const sectionBlockElement = document.querySelector('.section-block'); if (sectionBlockElement) { sectionBlockElement.remove(); } // 直播房间-视频上方信息区 const headInfoLowerRowElement = document.querySelector('.head-info-section .lower-row'); if (headInfoLowerRowElement) { headInfoLowerRowElement.remove(); } // 直播房间-页面底部bilibili公司信息区域 const linkFooterElement = document.querySelector('#link-footer-vm'); if (linkFooterElement) { linkFooterElement.remove(); } }).observe(document.querySelector('body'), { childList: true, attributes: true, subtree: true, }); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址