Youtube, Raid to streaming

Even if continue playing is off, enable raid to streaming

// ==UserScript==
// @name         Youtube, Raid to streaming
// @name:ja      Youtube, ライブリダイレクト
// @namespace    http://tampermonkey.net/
// @version      2024-05-19
// @description  Even if continue playing is off, enable raid to streaming
// @description:ja  連続再生をオフにしていても配信へのレイドを有効する
// @author       You
// @match        https://www.youtube.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @run-at       document-end
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setInterval(function () {
        var video = document.querySelector("video");
        if (!video || !video.ended) return;
        var autonav = document.querySelector("[data-is-live=true] .ytp-autonav-endscreen-link-container, [data-is-upcoming=true] .ytp-autonav-endscreen-link-container");
        if (!autonav) return;

        location.href = autonav.href;
    }, 5000);
})();