b站大会员广告

b站大会员广告清除

  1. // ==UserScript==
  2. // @name b站大会员广告
  3. // @namespace wrongThing
  4. // @version 0.3
  5. // @description b站大会员广告清除
  6. // @author wrongThing
  7. // @match *.bilibili.com/video/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14. var maxCheckTime = 5 * 60 * 60;
  15. var startTime = +new Date();
  16. var endTime = startTime + maxCheckTime;
  17. var timer = null;
  18. var count = 0;
  19.  
  20. var e = document.createEvent("MouseEvents")
  21. e.initEvent('click', true, true);
  22.  
  23. let video = null;
  24. let isPlaying = false;
  25.  
  26. function clearTimer() {
  27. timer && clearInterval(timer);
  28. timer = null;
  29. }
  30. function controlAd() {
  31. count++;
  32. console.log(`【b站大会员弹窗广告检测】:第${count}次检测`)
  33. if (+new Date() >= endTime) {
  34. clearTimer();
  35. console.log(`【b站大会员弹窗广告检测】:超时退出`)
  36. return;
  37. }
  38. const closeButton = document.querySelector('.bili-dialog-m .q1080p .icon.close');
  39. if (!video) {
  40. video = document.querySelector('video')
  41. }
  42. if (closeButton) {
  43. // adDialog.parentNode.removeChild(adDialog);
  44. closeButton.dispatchEvent(e);
  45. if (isPlaying) {
  46. video && video.play();
  47. console.log('恢复播放状态')
  48. }
  49. clearTimer();
  50. console.log(`【b站大会员弹窗广告检测】:成功清除`)
  51. } else {
  52. isPlaying = !(video && video.paused);
  53. }
  54. }
  55. timer = setInterval(controlAd, 200)
  56. // Your code here...
  57. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址