Created
April 22, 2024 00:05
-
-
Save LuigiEspinosa/44bb6706ce3f4649735f1166c355d9ef to your computer and use it in GitHub Desktop.
Tapermonkey Script to hide 100% watched youtube videos from a YT Channel.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hide Watched YouTube Video | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Hide YouTube video when progress bar width is 100%. | |
// @author NumeroCuatro | |
// @match https://www.youtube.com/*/videos | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Function to hide videos with 100% progress bar width | |
function hideCompletedVideos() { | |
let progressBars = document.querySelectorAll('div#progress.ytd-thumbnail-overlay-resume-playback-renderer'); | |
progressBars.forEach((progressBar) => { | |
if (progressBar.style.width === '100%') { | |
const videoContainer = progressBar.closest('ytd-rich-item-renderer'); | |
if (videoContainer) videoContainer.remove(); | |
} | |
}); | |
if (progressBars.length <= 0) clearInterval(interval); | |
} | |
// Check for completed videos on page load | |
const interval = setInterval(hideCompletedVideos, 1000); | |
// add this to the video URL to start watching them chronologically from there | |
// &list=ULcxqQ59vzyTk | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't work anymore and won't bother to see why.