// ==UserScript== // @name B站专用vip解析 // @namespace xyz_xyz-B%e7%ab%99%e4%b8%93%e7%94%a8vip%e8%a7%a3%e6%9e%90 // @version 1.2 // @description b站专用vip解析,免vip看番剧,免vip看电影。如有问题,请到公众号网络喵上反馈!!! // @author xyz_xyz // @match *://*bilibili*/*/play/* // @grant none // @icon https://www.bilibili.com/favicon.ico?v=1 // ==/UserScript== (function() { 'use strict'; const classNamesToRemove = [ 'paybar_container__WApBR', 'pc-cashier-wrapper' ]; let lastUrl = window.location.href; console.log('初始URL:', lastUrl); const removeElementsByClass = () => { classNamesToRemove.forEach(className => { const elements = document.querySelectorAll(`.${className}`); elements.forEach(element => { element.remove(); }); }); }; const mutePageAudio = () => { const audioElements = document.querySelectorAll('audio'); const videoElements = document.querySelectorAll('video'); audioElements.forEach(audio => audio.muted = true); videoElements.forEach(video => video.muted = true); }; const replaceVideoWithIframe = () => { const videoWraps = document.querySelectorAll('.bpx-player-video-wrap'); videoWraps.forEach(wrap => { const video = wrap.querySelector('video'); if (video && !wrap.querySelector('iframe')) { const pageUrl = window.location.href; const iframeUrl = `https://jx.xmflv.com/?url=${encodeURIComponent(pageUrl)}`; const iframe = document.createElement('iframe'); iframe.src = iframeUrl; iframe.width = "100%"; iframe.height = "100%"; iframe.frameBorder = "0"; iframe.allow = "autoplay; fullscreen"; iframe.style.position = "absolute"; iframe.style.top = "0"; iframe.style.left = "0"; iframe.style.zIndex = "1001"; wrap.innerHTML = ''; wrap.appendChild(iframe); } }); }; const executeAll = () => { removeElementsByClass(); mutePageAudio(); replaceVideoWithIframe(); }; const checkUrlAndRefresh = () => { const currentUrl = window.location.href; console.log('当前URL:', currentUrl); if (currentUrl !== lastUrl) { console.log('URL已变化,刷新页面'); lastUrl = currentUrl; window.location.reload(); } }; window.addEventListener('load', () => { executeAll(); setInterval(checkUrlAndRefresh, 500); }); const observer = new MutationObserver(() => { executeAll(); }); observer.observe(document.body, { childList: true, subtree: true }); })();