13

Is there a way to prevent YouTube from showing videos already watched in the list of suggested videos?

migrated from superuser.com Mar 25 at 11:48

This question came from our site for computer enthusiasts and power users.

  • 1
    A quick glance at the HTML makes me think that it shouldn't be too hard to do. You basically want to set display: none on any <ytd-compact-video-renderer> element that contains a child element #progress. You won't be able to do that in CSS, but a Tampermonkey script should be simple enough. I'll have a go later and write an answer... – Aaron F Mar 25 at 17:03
12

Currently, there is no treat/workaround to do so. Apart from manually block them one by one, there are no scalable solutions.

0

But there are extensions which can do so like:


// ==UserScript==
// @version        1.1.1
// @name           Hide watched videos on YouTube
// @namespace      https://gist.github.com/xPaw/6324624
// @match          https://www.youtube.com/*
// @updateURL      https://gist.github.com/xPaw/6324624/raw/YoutubeHideWatched.user.js
// @downloadURL    https://gist.github.com/xPaw/6324624/raw/YoutubeHideWatched.user.js
// @grant          none
// ==/UserScript==

const app = document.querySelector( 'ytd-app' );

function HideVideos( a )
{
    app.querySelectorAll( 'ytd-thumbnail-overlay-resume-playback-renderer:not([data-hidden="true"])' ).forEach( element =>
    {
        element.dataset.hidden = true;

        while( ( element = element.parentNode ).tagName.toLowerCase() !== 'ytd-item-section-renderer' )
        {
            // Find the container element for this video
        }

        element.hidden = true;
    } );
}

function ProcessPage()
{
    if( !window.location.pathname.startsWith( '/feed/subscriptions' ) )
    {
        return;
    }

    const list = app.querySelector( 'ytd-section-list-renderer' );

    if( list.dataset.hooked )
    {
        return;
    }

    list.dataset.hooked = true;
    list.addEventListener( 'yt-next-continuation-data-updated', HideVideos );

    // TODO: Find an event to fix this
    new MutationObserver( HideVideos ).observe( list, { childList: true, subtree: true } );
}

app.addEventListener( 'yt-navigate-finish', ProcessPage );

ProcessPage();
  • 3
    That's a shame. I'm getting the same ~dozen music videos all the time but completely blocking them is overkill. – JollyJoker Mar 25 at 15:27
  • 1
    oh nice, you updated with a userscript! :-) – Aaron F Mar 26 at 8:34
4

AFAIK, there's no way to do this on YouTube itself, but I use a Chrome extension (Better Subscriptions for YouTube) that lets you hide watched videos from your subscriptions tab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.