0

Videos I already saw/viewed are the preferent things my YouTube home page likes to suggest.

I know I already had viewed a video because youtube shows a filled red bar bellow the videos I already saw, and I also remember just have watched them!

1

I manage to fix it by using https://github.com/Tampermonkey/tampermonkey and creating the following script which is injected on my YouTube home page:

// ==UserScript==
// @name         Remove youtube viewed videos
// @namespace    *
// @version      0.1
// @description  https://webapps.stackexchange.com/questions/145612/how-to-stop-the
// @author       You
// 
// @include https://*youtube.com/*
// @require http://code.jquery.com/jquery-3.4.1.min.js
// ==/UserScript==

(function() {
    'use strict';
    let keepclosing = async () => {
        let viewedbar = $('.style-scope.ytd-thumbnail-overlay-resume-playback-renderer');
        if(viewedbar.length) {
            // console.log("removing running...");
            let parent = viewedbar.closest('.style-scope.ytd-rich-grid-renderer');
            if(parent.length) {
                // use hide instead of remove to avoid mass flickering of the page
                parent.hide();
            }
        }
        // console.log("running");
        setTimeout(keepclosing, 500);
    }
    setTimeout(keepclosing, 500);
})();

What is does it each 0.5 seconds, run jquery selector searching for those red bars bellow a video (meaning I already watched). Then, immediately, it hides the video element instead of deleting it because deleting it would cause all the other videos to refresh/flick. And just by hiding it, we do not have this effect and video disappears like it never had existed.

By using this, you will never notice this is running because the page still behaving like a normal page (without flickering or blank holes). The only difference is that no viewed video is going to show up anymore.

| improve this answer | |

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.