YTBetter - Enable Rewind/DVR

Unlocks rewind for YouTube live streams with disabled DVR

Versione datata 26/10/2025. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         YTBetter - Enable Rewind/DVR
// @namespace    YTBetter
// @version      2.10
// @description  Unlocks rewind for YouTube live streams with disabled DVR
// @description:ru  Позволяет перематывать YouTube-стримы, где такая возможность заблокирована
// @author       copyMister
// @match        https://www.youtube.com/*
// @match        https://m.youtube.com/*
// @run-at       document-start
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant        none
// @license      MIT
// ==/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 { streamingData, videoDetails, playerConfig } = value;
            if (isObject(videoDetails) && videoDetails.isLive && !videoDetails.isLiveDvrEnabled) {
                videoDetails.isLiveDvrEnabled = true;

                if (isObject(playerConfig) && playerConfig.mediaCommonConfig) {
                    const mcConf = playerConfig.mediaCommonConfig;
                    mcConf.useServerDrivenAbr = false;
                    if (mcConf.serverPlaybackStartConfig) {
                        mcConf.serverPlaybackStartConfig.enable = false;
                    }
                }

                if (isObject(streamingData) && (streamingData.hlsManifestUrl || streamingData.dashManifestUrl) && streamingData.serverAbrStreamingUrl) {
                    delete streamingData.serverAbrStreamingUrl;
                }
            }
        }
        setter.call(this, value);
    },
    get() {
        return getter.call(this);
    },
    configurable: true,
});