Youtube AdBlock ban bypass

Bypass youtubes new ad block restrictions

目前为 2023-10-15 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Youtube AdBlock ban bypass
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description Bypass youtubes new ad block restrictions
  6. // @author Obelous
  7. // @match https://www.youtube.com/*
  8. // @match https://www.youtube-cocookie.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
  10. // @grant none
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. let currentPageUrl = window.location.href;
  15.  
  16. window.addEventListener('beforeunload', function () {
  17. currentPageUrl = window.location.href;
  18. });
  19.  
  20. document.addEventListener('yt-navigate-finish', function () {
  21. const newUrl = window.location.href;
  22. if (newUrl !== currentPageUrl) {
  23. location.reload();
  24. }
  25. });
  26.  
  27. function splitUrl(str) {
  28. return str.split('=')[1];
  29. }
  30.  
  31. function run() {
  32. console.log("Loaded");
  33. const block = document.querySelector('.yt-playability-error-supported-renderers');
  34. block.parentNode.removeChild(block);
  35. const url = "https://youtube.com/embed/" + splitUrl(window.location.href);
  36. const oldplayer = document.getElementById("error-screen");
  37. const player = document.createElement('iframe');
  38. player.setAttribute('src', url);
  39. player.style = "height:100%;width:100%;border-radius:12px;";
  40. player.id = "youtube-iframe";
  41. oldplayer.appendChild(player);
  42. console.log('Finished');
  43. }
  44.  
  45. (function() {
  46. 'use strict';
  47. //| |||
  48. // RUN DELAY VVV
  49. setTimeout(run, 500);
  50. })();

QingJ © 2025

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