YT-DVR

Unlocks rewind for YouTube live streams with disabled DVR

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         YT-DVR
// @namespace    n2gf
// @description  Unlocks rewind for YouTube live streams with disabled DVR
// @author       n2gf copyMister
// @version      1.0
// @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";

unsafeWindow.eval('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) {\
                    playerConfig.mediaCommonConfig.useServerDrivenAbr = false;\
                }\
\
                if (isObject(streamingData) && (streamingData.hlsManifestUrl || streamingData.dashManifestUrl) && streamingData.serverAbrStreamingUrl) {\
                    delete streamingData.serverAbrStreamingUrl;\
                }\
            }\
        }\
        this[Symbol.for("YT-DVR")] = value;\
    },\
    get() {\
        return this[Symbol.for("YT-DVR")];\
    },\
    configurable: true,\
});');