amitbl / blocktube

YouTube™ content blocker
GNU General Public License v3.0
860 stars 60 forks source link

[Request] Block videos that are newer (or older) than a certain date #298

Open ghost opened 1 year ago

ghost commented 1 year ago

It has happened to me so many times: a certain channel I like suddenly starts uploading content I don't like and sometimes for nostalgia reasons I want to revisit their old videos.

The problem is I have to navigate through so much garbage before I find what I like, because their newer videos are always at the beginning of the search and i don't always remember the video titles. For example, one of my favorite channels uploaded its last good video (in my opinion) on November 1, 2013.

Can you add a feature to input a certain date and block videos for a certain channel that are newer than that date? It could also be the opposite, I mean, someone might think a channel is better now than before and want to block their old videos.

Anyway, congratulations for your extension. Absolutely one of the greatest extensions ever made and I mean it.

llamatar commented 1 year ago

These features are already possible with Advanced Blocking functions, though I admit it's not very convenient. I have not tested these functions extensively, but they work except in some strange cases where YouTube does not provide a video's channelId, such as sometimes in the channel page's list of videos.

To block videos for a certain channel that are newer than a chosen number of years:

  // Block videos newer than 10 years by certain channel
  if (video.channelId === "UCuAXFkgsw1L7xaCfnd5JJOw"      // <-- change channel id
      && !(/year/.test(video.publishTimeText) 
           && video.publishTimeText.split(" ")[0] >= 10)) // <-- change number of years
    return true;

To block videos for a certain channel that are older or equal to a chosen number of years:

  // Block videos 10 years or older by certain channel
  if (video.channelId === "UCuAXFkgsw1L7xaCfnd5JJOw"      // <-- change channel id
      && /year/.test(video.publishTimeText) 
      && video.publishTimeText.split(" ")[0] >= 10)       // <-- change number of years
    return true;