Skip to content

Instantly share code, notes, and snippets.

@dealingwith
Last active December 16, 2022 04:14
Show Gist options
  • Save dealingwith/1e2afc0bf76be3ed91d4759028c99e01 to your computer and use it in GitHub Desktop.
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
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