Created
September 3, 2022 13:15
-
-
Save assertchris/b9c57016841a7c9997c6b2a2eccb62d8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 already watched YouTube videos | |
// @version 0.1 | |
// @description Hide already watched recommended YouTube videos from the home page | |
// @match https://www.youtube.com | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
(function() { | |
'use strict'; | |
var found; | |
var interval = setInterval(function() { | |
var recommendation = document.querySelector('ytd-thumbnail-overlay-resume-playback-renderer [style="width: 100%;"]:not([clicked])'); | |
if (!recommendation) { | |
return; | |
} | |
var button = recommendation.parentNode?.parentNode?.parentNode?.parentNode?.parentNode?.querySelector('[aria-label="Action menu"]'); | |
if (!button) { | |
return; | |
} | |
recommendation.setAttribute('clicked', 'clicked'); | |
button.click(); | |
setTimeout(function() { | |
document.querySelectorAll('[role="menuitem"]')[4].click(); | |
}, 250); | |
}, 500); | |
})(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment