blocktube icon indicating copy to clipboard operation
blocktube copied to clipboard

[Feature request] Whitelist

Open GreatestFool opened this issue 5 years ago • 4 comments

I'm quite enjoying the addon, but while blocking certain channels is nice and all it would also be very nice to be able to instead whitelist only a few channels and see only those. I would appreciate it a lot if you could add a whitelisting feature.

GreatestFool avatar Feb 21 '20 21:02 GreatestFool

Hey there, this issue seems to be referenced in #4. Maybe you, @GreatestFool , have an idea for a pull request?

RetriedAgain avatar Oct 04 '20 21:10 RetriedAgain

You don't need to @ me when I'm the only other person in the issue thread at the moment lol.

While thread #4 is certainly similar to this thread, they are not alike. While filtering by category would likely be nice for some, I doubt it would be particularly effective even if it was implemented considering how many people categorize and tag their videos wrong on purpose and I personally don't care for the feature. I just want a whitelist so I don't have to deal with all the random stuff youtube constantly recommends.

I am not particularly familiar with Javascript, even if it is a simple scripting language, and I do not wish to contribute bad code. Neither do I have any time or interest in learning it, as I have private projects to maintain.

GreatestFool avatar Oct 05 '20 16:10 GreatestFool

You can use a regex negative lookahead, so that everything not returning a match gets blocked:

/^((?!bingchannel|bangchannel|bongchannel).)*$/i

That will result in only videos from those channels showing up in your feed (provided they were in that feed in the first place). Pretty clunky though; a built-in option to make rules permissive rather than restrictive would be better.

keldian avatar Jul 14 '22 17:07 keldian

I was able to successfully create a simple "advanced blocking" script that includes a whitelist of preferredKeyWords and only include videos that contain these words in their title or channelName. I'm using this as a proxy for topic.

(video, objectType) => {
  // return true blocks content 
  // return false to allow content
  const preferredKeyWords = ["JavaScript", "code"];

  if (typeof video.channelName === 'string') {
    const channelBlockedByName = preferredKeyWords.some(sub => video.channelName.toLowerCase().includes(sub.toLowerCase()));
    if (channelBlockedByName) {
      // block video if channel name is in black list
      return true;
    }
  }

  if (typeof video.title === 'string') {
    const titleContainsKeyWord = preferredKeyWords.some(sub => video.title.toLowerCase().includes(sub.toLowerCase()));    
    if (titleContainsKeyWord) {
      // Display video if title contains a keyword true
      return false;
    }
  }
  // Custom conditions did not match, block all other content 
  return true; 
}

It's definitely suceptiable to false positives. IE if you add "C" or "React" you will get a lot of content that doesn't relate to programming

thomasMinshull avatar Jul 12 '23 20:07 thomasMinshull