Closed rh-testcode closed 2 years ago
you can do something like this:
if (window.location.pathname !== '/') return false;
That worked as desired. Thank you.
Here is my final code for reference:
// Block videos with over a million views
(video, objectType) => {
// Only block videos from homepage recommendations
if (window.location.pathname !== '/') {
return false;
}
// If video view count over one million
if (video.viewCount > 1000000) {
// Block the video
return true;
}
// Custom conditions did not match, do not block
return false;
}
I've been looking for something similar, but for blocking individual videos specifically from the home section only.
Alas, Youtube homepage shuffles the same damn recommended videos for months, regardless of wether they are already watched, some of them persists on every refresh, and i'll eventually just end up blocking them entirely (Video ID filter list), and bookmark the ones that are worth rewatching.
I copied the above script, and replaced it with video ID selector instead like this:
// Block persistent video recommendations from main homepage
(video, objectType) => {
// Only block videos from homepage recommendations
if (window.location.pathname !== '/') {
return false;
}
// List of Video IDs
if (video.videoId.match("videoid1|videoid2|etc")) {
// Block the video
return true;
}
// Custom conditions did not match, do not block
return false;
}
It works great, but will be a hassle to rewrite all the video ID's into the liste manually, and for future videos.
Can anyone guide me how to automate/batch this process ?
I've made a custom blocking function that works to block videos with over a million views, but I would like it to only block videos from the homepage recommendations and nowhere else (searches, subscriptions, etc). I saw the objectType reference mentioned on the Advanced Blocking documentation but wasn't sure how to get it to work for homepage recommendations only.