Netflix Plus

Enable dolby plus audio and more video on Netflix

目前为 2023-11-01 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Netflix Plus
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Enable dolby plus audio and more video on Netflix
  6. // @author TGSAN
  7. // @match https://www.netflix.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=netflix.com
  9. // @run-at document-start
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (() => {
  14. "use strict";
  15.  
  16. const Event = class {
  17. constructor(script, target) {
  18. this.script = script;
  19. this.target = target;
  20.  
  21. this._cancel = false;
  22. this._replace = null;
  23. this._stop = false;
  24. }
  25.  
  26. preventDefault() {
  27. this._cancel = true;
  28. }
  29. stopPropagation() {
  30. this._stop = true;
  31. }
  32. replacePayload(payload) {
  33. this._replace = payload;
  34. }
  35. };
  36.  
  37. let callbacks = [];
  38. window.addBeforeScriptExecuteListener = (f) => {
  39. if (typeof f !== "function") {
  40. throw new Error("Event handler must be a function.");
  41. }
  42. callbacks.push(f);
  43. };
  44. window.removeBeforeScriptExecuteListener = (f) => {
  45. let i = callbacks.length;
  46. while (i--) {
  47. if (callbacks[i] === f) {
  48. callbacks.splice(i, 1);
  49. }
  50. }
  51. };
  52.  
  53. const dispatch = (script, target) => {
  54. if (script.tagName !== "SCRIPT") {
  55. return;
  56. }
  57.  
  58. const e = new Event(script, target);
  59.  
  60. if (typeof window.onbeforescriptexecute === "function") {
  61. try {
  62. window.onbeforescriptexecute(e);
  63. } catch (err) {
  64. console.error(err);
  65. }
  66. }
  67.  
  68. for (const func of callbacks) {
  69. if (e._stop) {
  70. break;
  71. }
  72. try {
  73. func(e);
  74. } catch (err) {
  75. console.error(err);
  76. }
  77. }
  78.  
  79. if (e._cancel) {
  80. script.textContent = "";
  81. script.remove();
  82. } else if (typeof e._replace === "string") {
  83. script.textContent = e._replace;
  84. }
  85. };
  86. const observer = new MutationObserver((mutations) => {
  87. for (const m of mutations) {
  88. for (const n of m.addedNodes) {
  89. dispatch(n, m.target);
  90. }
  91. }
  92. });
  93. observer.observe(document, {
  94. childList: true,
  95. subtree: true,
  96. });
  97.  
  98. window.globalOptions = {
  99. useallSub: true,
  100. useddplus: true,
  101. useAVC: false,
  102. useFHD: true,
  103. usedef: false,
  104. useHA: true,
  105. useAVCH: false,
  106. usevp9: false,
  107. useav1: false,
  108. useprk: true,
  109. usehevc: false,
  110. usef4k: true,
  111. usef12k: false,
  112. closeimsc: true,
  113. setMaxBitrate: true
  114. };
  115.  
  116. window.onbeforescriptexecute = function (e) {
  117. let scripts = document.getElementsByTagName("script");
  118. if (scripts.length === 0) return;
  119. for (let i = 0; scripts.length > i; i++) {
  120. let dom = scripts[i];
  121. if (dom.src.includes("cadmium-playercore")) {
  122. let playercore = document.createElement('script');
  123. playercore.src = "https://static-os.kumo.moe/js/netflix/cadmium-playercore.js";
  124. playercore.crossOrigin = dom.crossOrigin;
  125. playercore.async = dom.async;
  126. playercore.id = dom.id;
  127. document.head.appendChild(playercore);
  128. let maxbitrate = document.createElement('script');
  129. maxbitrate.src = 'https://static-os.kumo.moe/js/netflix/max-bitrate.js';
  130. maxbitrate.crossOrigin = dom.crossOrigin;
  131. maxbitrate.async = dom.async;
  132. maxbitrate.id = dom.id;
  133. document.head.appendChild(maxbitrate);
  134. dom.remove();
  135. window.onbeforescriptexecute = null;
  136. break;
  137. }
  138. }
  139.  
  140. };
  141. })();

QingJ © 2025

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