// ==UserScript==
// @name YTBetter
// @namespace YTBetter
// @match https://*.youtube.com/*
// @run-at document-start
// @grant none
// @version 2.0
// @author トワ…
// @description Patches YouTube to bypass some limitations
// ==/UserScript==
"use strict";
// Interop with "Simple YouTube Age Restriction Bypass"
const {
get: getter,
set: setter,
} = Object.getOwnPropertyDescriptor(Object.prototype, "playerResponse") ?? {
set(value) {
this[Symbol.for("YTBetter")] = value;
},
get() {
return this[Symbol.for("YTBetter")];
},
};
const isObject = (value) => value != null && typeof value === "object";
Object.defineProperty(Object.prototype, "playerResponse", {
set(value) {
if (isObject(value)) {
const { videoDetails } = value;
if (isObject(videoDetails)) {
videoDetails.isLiveDvrEnabled = true;
}
}
setter.call(this, value);
},
get() {
return getter.call(this);
},
configurable: true,
});