amitbl / blocktube

YouTube™ content blocker
GNU General Public License v3.0
856 stars 59 forks source link

[Feature Request] Allow for blocking videos under a certain number of views #373

Closed domeniczz closed 4 months ago

domeniczz commented 4 months ago

Allow for blocking videos under a certain number of views.

For example never show videos under 100 views in the YouTube home page.

3skue commented 4 months ago

You can do that using Advanced Blocking (video.viewCount)

domeniczz commented 4 months ago

You can do that using Advanced Blocking (video.viewCount)

Thank you very much!

stefson commented 4 months ago

can you maybe share the exact command?

ercarp commented 2 months ago

can you maybe share the exact command?

Add this line to your Advanced Blocking to hide videos under 1000 views. You can change the number to whatever you want.

(video, objectType) => {  if (video.viewCount < 1000) {return true; } return false; }

EDIT: Keep in mind you'll have to nest the if conditions (as shown below) if you want to have multiple rules. Just pasting in the above rule as is will cause other rules to stop functioning.

(video, objectType) => {
    if (video.publishTimeText.match("years")) {
        return true; // Block videos older than 1 year
    }
    if (video.viewCount < 1000) {
        return true; // Block videos with less than 1000 views
    }
    return false; // Allow all other videos
}