使用B站网页端看番时,播放器有时会自动切换到会员画质。对于非大会员的我来说,部分高码率画质存在试看时长限制。试看倒计时结束后,网页便会弹出开通大会员的支付弹窗,十分影响观看体验。
之前,我也因为手机端的类似问题向客服投诉过,但客服也表示,只能暂时关闭弹窗,无法取消会员码率试看资格。
因此,我编写了这个油猴脚本,希望减少此类弹窗带来的干扰。

脚本原理
脚本仅在指定的哔哩哔哩播放页面运行,通过监听页面元素变化,识别并移除大会员弹窗。
注意:脚本仅限于处理页面中符合特定选择器的弹窗元素。不会参与修改账号会员状态、绕过会员权限验证、解锁会员专享内容等操作。
使用说明
- 运行环境:支持 Tampermonkey 等用户脚本管理器的现代浏览器。
- 适用页面:普通视频、番剧播放页及播放列表页面。
- 功能范围:拦截指定的大会员弹窗。
- 注意事项:哔哩哔哩页面结构可能随版本更新而变化,因此无法保证所有弹窗都能被拦截。
脚本安装
跳转至greasyfork安装:
下载并拖拽到浏览器安装:
度盘: https://pan.baidu.com/s/1iRrmObbnbJUFqe_UxgMbYw?pwd=ASXN 提取码: ASXN
编辑器复制安装:
// ==UserScript==
// @name B站高码率试看弹窗拦截
// @namespace http://tampermonkey.net/
// @version 1.1
// @description 拦截高清画质试看结束后的充会员弹窗
// @match https://www.bilibili.com/video/*
// @match https://www.bilibili.com/bangumi/play/*
// @match https://www.bilibili.com/medialist/play/*
// @icon https://www.bilibili.com/favicon.ico
// @grant none
// @run-at document-start
// @license MIT
// ==/UserScript==
(function () {
'use strict';
// 双保险:会员中心不执行
if (location.hostname === 'account.bilibili.com') return;
// 仅在播放页生效
const isVideoPage =
location.hostname === 'www.bilibili.com' &&
(
location.pathname.startsWith('/video/') ||
location.pathname.startsWith('/bangumi/play/') ||
location.pathname.startsWith('/medialist/play/')
);
if (!isVideoPage) return;
const SELECTOR = [
'#BilibiliVipDialog',
'#BiliBiliPayDialog',
'.bili-pay-plugin-box'
].join(',');
function removePopups(root) {
if (!root) return;
if (
root.nodeType === Node.ELEMENT_NODE &&
root.matches(SELECTOR)
) {
root.remove();
return;
}
if (typeof root.querySelectorAll === 'function') {
root.querySelectorAll(SELECTOR).forEach(el => el.remove());
}
}
const observer = new MutationObserver(mutations => {
for (const mutation of mutations) {
for (const node of mutation.addedNodes) {
removePopups(node);
}
}
});
function start() {
const root = document.documentElement;
if (!root) return false;
observer.observe(root, {
childList: true,
subtree: true
});
removePopups(root);
return true;
}
if (!start()) {
const bootstrap = new MutationObserver(() => {
if (start()) bootstrap.disconnect();
});
bootstrap.observe(document, {
childList: true,
subtree: true
});
}
})();
天下漫友是一家
脚本本身没有复杂的功能,也并非为了对抗平台的会员机制。它只是希望少一些弹窗打扰,让普通用户也能重新找回,看番时的快乐。
评论