Skip to content

Instantly share code, notes, and snippets.

@LuigiEspinosa
Created April 22, 2024 00:05
Show Gist options
  • Save LuigiEspinosa/44bb6706ce3f4649735f1166c355d9ef to your computer and use it in GitHub Desktop.
Save LuigiEspinosa/44bb6706ce3f4649735f1166c355d9ef to your computer and use it in GitHub Desktop.
Tapermonkey Script to hide 100% watched youtube videos from a YT Channel.
// ==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
})();
@LuigiEspinosa
Copy link
Author

Don't work anymore and won't bother to see why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment