Last active
December 16, 2022 04:14
-
-
Save dealingwith/1e2afc0bf76be3ed91d4759028c99e01 to your computer and use it in GitHub Desktop.
An Arc boost to hide shorts and upcoming videos in the subscription page
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
addMutationObserver(); | |
function addMutationObserver() { | |
const observer = new MutationObserver(function (mutations) { | |
mutations.forEach(function (mutation) { | |
mutation.target.querySelectorAll("ytd-grid-video-renderer").forEach(handleElement); | |
}); | |
}); | |
observer.observe(document.body, { subtree: true, childList: true }); | |
} | |
function handleElement(e) { | |
short = e.querySelector("a#thumbnail").getAttribute("href").match(/shorts/); | |
if (short && short.length > 0) { | |
e.remove(); | |
} | |
upcoming = e.querySelector("span.ytd-thumbnail-overlay-time-status-renderer") | |
if (upcoming && upcoming.textContent.match(/UPCOMING/)) { | |
e.remove(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment