LiteTube

Hide video recommendations from listing and remove annoying auto-mix playlists to reduce lag and improve performance

Από την 08/11/2025. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         LiteTube
// @namespace    http://tampermonkey.net/
// @version      v1.2
// @description  Hide video recommendations from listing and remove annoying auto-mix playlists to reduce lag and improve performance
// @author       Liminality Dreams
// @match        https://www.youtube.com/*
// @icon         https://img.icons8.com/?size=100&id=62852&format=png&color=228BE6
// @grant        none
// @run-at       document-start
// @license GNU 3.0
// ==/UserScript==

(function() {
    'use strict';

    let hasReloaded = false;

    function isAutoMix(listId) {
        if (!listId) return false;
        return listId.startsWith('RD') && !listId.startsWith('RDMM') && !listId.startsWith('RDAO') && !listId.startsWith('RDCLAK') && !listId.startsWith('RDTM') && !listId.startsWith('RDEM') && !listId.startsWith('RDPN');
    }

    function isWatchPage() {
        return window.location.pathname === '/watch';
    }

    function checkAndReload() {
        if (!isWatchPage() || hasReloaded) return;

        const url = new URL(window.location.href);
        const listParam = url.searchParams.get('list');

        if (listParam && isAutoMix(listParam)) {
            hasReloaded = true;
            url.searchParams.delete('list');
            url.searchParams.delete('start_radio');
            url.searchParams.delete('index');
            window.location.replace(url.toString());
        }
    }

    function removeWatchPageSidebar() {
        if (!isWatchPage()) return;
        document.querySelectorAll('#secondary').forEach(el => el.remove());
        document.querySelectorAll('ytd-watch-next-secondary-results-renderer').forEach(el => el.remove());
    }

    function removeBloat() {
        const bloatSelectors = [
            'ytd-rich-shelf-renderer[is-gaming]',
            'ytd-statement-banner-renderer',
            'ytd-banner-promo-renderer',
            'ytd-compact-promoted-video-renderer',
            'ytd-display-ad-renderer',
            'ytd-promoted-sparkles-web-renderer'
        ];
        bloatSelectors.forEach(selector => {
            document.querySelectorAll(selector).forEach(el => el.remove());
        });
    }

    const style = document.createElement('style');
    style.textContent = `
        body[is-watch-page] #secondary,
        body[is-watch-page] ytd-watch-next-secondary-results-renderer,
        ytd-playlist-panel-renderer,
        .ytp-playlist-menu {
            display: none !important;
        }
    `;
    document.head.appendChild(style);

    checkAndReload();

    const observer = new MutationObserver(() => {
        if (isWatchPage()) {
            removeWatchPageSidebar();
        }
        removeBloat();
    });

    const startObserver = () => {
        if (document.body) {
            observer.observe(document.body, {
                subtree: true,
                childList: true
            });
        }
    };

    if (document.body) {
        startObserver();
    } else {
        document.addEventListener('DOMContentLoaded', startObserver);
    }

    window.addEventListener('yt-navigate-finish', () => {
        hasReloaded = false;
        checkAndReload();
        if (isWatchPage()) {
            setTimeout(removeWatchPageSidebar, 100);
        }
    });

})();