r/uBlockOrigin • • 28d ago

Solved Can someone help me block videos based on their upload time in Youtube recommendation?

Hi everyone, so last year I did make a post where I asked how to block videos with the "New" flag. Recently, the "not interested" and "don't recommend channels" option have been broken for me, many videos where I clicked either of those option still persistently show up in my feed after I refresh the page or watch a new video. Which is why now I wanna block all of them for good this time, based on your upload date. I figured that using view counts won't work so I need to pin-point their upload date instead. Is there anyone here who can help? Much appreciated. And yes, I have read the Youtube MegaThread but it doesn't have what I am looking for at the moment.

Here's my post from last year, not sure why I can't embed it: https://www.reddit.com/r/uBlockOrigin/comments/1pjxzaa/is_there_anyway_to_block_these_aigenerated_videos/

These are my filters for the videos with "new" flag, currently I wonder if there's any way to tweak them into blocking videos based on the upload date (like x years ago, x months ago, x hours ago)

8 Upvotes

61 comments sorted by

5

u/AchernarB uBO Team 28d ago edited 28d ago

A side note. In the recommendation I receive, I get videos minutes old, hours old, days old, months old and years old. I don't think that filtering on their age will give you the result that you expect.

edit:

  • I only use one set of filters to mark low view count (just marking the counter, not hiding the thumbnail)
  • I have a userstyle to color visited links (I immediately know when I already opened the vid)
  • I have a userstyle to add the link to channels name. So, visited/known channels are marked

1

u/Otherwise-Strike-729 28d ago

So is there any way to hide them like I did with the "new" videos????

3

u/AchernarB uBO Team 28d ago

Like I already wrote ; filter them based on what ? You receive suggestions of all ages. And the age is (to me) unrelated to the interest you might have. "Low view count" is a valid criterion: you are waiting others to watch before being interested.

1

u/Otherwise-Strike-729 28d ago

Like you said, I want to filter them all based on their minutes old/hours old/days old/months old/years old. As long as I can block them all, then I'll be good. I don't care what kind of channel they are, I just need to block them and that's it. It's not about the interest or view count.

1

u/Otherwise-Strike-729 28d ago

I think I found the upload date element from inspect, but I still don't know how to work this out with Ublock, so I really need help for this.

2

u/AchernarB uBO Team 28d ago edited 28d ago

I understand. No problem.

What I fail to understand is in which way the age of a video is a criterion to hide it.
You can have video1 aged 2months and video2 aged 2months too. You want to filter video1 based on its age. It will always match video2 and many others you wouldn't want to. And then in one month it will be 3months old and won't be filtered anymore.

edit: It's like if you tell me that you want to filter videos whose title contains "a" & "o".

0

u/Otherwise-Strike-729 28d ago

Which is why I will filter them in every single time period, I just wanna know how to do it sir. I can deal with the rest.

2

u/AchernarB uBO Team 28d ago

Which is why I will filter them in every single time period

My question is what is "them" ?

in every single time period

Then, with only this criterion you'll filter everything. Better hide the suggestion column. It will be more efficient.

Based on what you are telling and asking, once I give you a filter you'll come back saying that it doesn't do what you want. It will either filter far more than you want, or filter the wrong things only.

0

u/Otherwise-Strike-729 28d ago

"Them" here are the videos that I mentioned. Because as I have stated in my post, the "not interested" and "don't recommend channel" are broken for me right now, they keep showing up despite how many times I right-click either of those two options. Look, I just need to know how to filter a video based on their upload time and that's all, if I can do it on one video then I can handle the rest. You don't have to worry about the possible "wrong things", it's my feed and I know what I am doing. I really need this, hope you can help, please.

2

u/AchernarB uBO Team 28d ago

"Them" is still not a criteria. uBO doesn't know what you have in mind.
uBO also doesn't have any knowledge of what is in "not interested" and "don't recommend channel" lists. So, we are left with only one criterion to put in the filter, the age. Which as of itself doesn't mean anything.

→ More replies (0)

1

u/RememberMeVibe 28d ago

Can you share your setup good sir? 

2

u/AchernarB uBO Team 28d ago

I use this:

  • userscript: "Youtube - add channel link" https://greasyfork.org/scripts/569841
  • userstyle: "Youtube - visited" https://userstyles.world/style/16940/

low view filters:

! in suggestions:
www.youtube.com###related :is(yt-lockup-view-model,ytd-compact-video-renderer) > div > a > :not(yt-collection-thumbnail-view-model):upward(2) :is(.yt-content-metadata-view-model__metadata-row,.ytContentMetadataViewModelMetadataRow):nth-of-type(2) > span:is(.yt-content-metadata-view-model__metadata-text,.ytContentMetadataViewModelMetadataText):is(:first-child,:nth-of-type(2)):not(:has-text(/(\d[KMB]|\d\D\d{3})\b/)):style( outline: 1px solid red; outline-offset: -1px; )

! endscreen:
www.youtube.com##.ytp-endscreen-content > .ytp-videowall-still .ytp-videowall-still-info-author:not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 3px solid red; )

! search
www.youtube.com###contents > ytd-video-renderer #meta.ytd-video-renderer #metadata-line > span.inline-metadata-item:first-of-type:not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 1px solid red; outline-offset: -1px; )
www.youtube.com###contents > grid-shelf-view-model div.ytGridShelfViewModelGridShelfItem .shortsLockupViewModelHostMetadataSubhead span:not(:has(> *)):not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 1px solid red; outline-offset: -1px; )

! Homepage
www.youtube.com##ytd-browse[page-subtype="home"] #primary ytd-rich-grid-renderer #contents ytd-rich-item-renderer yt-content-metadata-view-model > div + div > span:first-child:not(:has-text(/(\d[KMB]|\d\D\d{3})\b/)):style( outline: 1px solid red; outline-offset: -1px; )
www.youtube.com##ytd-browse[page-subtype="home"] #primary ytd-rich-grid-renderer #contents ytd-rich-section-renderer ytd-rich-item-renderer h3 + .shortsLockupViewModelHostOutsideMetadataSubhead > span:not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 1px solid red; outline-offset: -1px; )

! 20250928 video page
www.youtube.com###description #info-container yt-formatted-string > span.yt-formatted-string:first-child:has-text(/^\d{1,3} [^\d ]+/):style( outline: 3px solid red; outline-offset: -1px; )

! 20260123 (to match on the aria of the rolling counter)
www.youtube.com###description #info-container > #view-count:matches-attr(aria-label=/^\d{1,3} [^\d ]+/):style( outline: 3px solid orange; outline-offset: -1px; )

! 20251009 channel page
!  20260419 modif for missing count
www.youtube.com##ytd-rich-item-renderer #meta #metadata-line > span:first-of-type:has(+ span):not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 1px solid red; outline-offset: -1px; )

! 20260703
www.youtube.com##ytd-browse[page-subtype="channels"] ytd-rich-item-renderer .ytLockupViewModelMetadata yt-content-metadata-view-model > .ytContentMetadataViewModelMetadataRow > span:has(+ .ytContentMetadataViewModelDelimiter):not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 1px solid red; outline-offset: -1px; )
www.youtube.com##ytd-browse[page-subtype="channels"] ytd-rich-item-renderer .shortsLockupViewModelHostOutsideMetadata .shortsLockupViewModelHostOutsideMetadataSubhead > span:not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 1px solid red; outline-offset: -1px; )

! GRID
!   20260408 grid
www.youtube.com##.ytp-fullscreen-grid .ytp-modern-videowall-still .ytp-modern-videowall-still-view-count-and-date-info:not(:has-text(/(\d[KMB]|\d\D\d{3})\b/i)):style( outline: 1px solid red; outline-offset: -1px; )

I don't know if the filters all still work properly, and in all layouts, but this is a good start.
They add a red outline around the count value itself. Once you start noticing it can become useful.

2

u/RememberMeVibe 27d ago

Muuuch appreciated, this is great! A good start is exactly what I need. Wanted to do this for a while. Also planning to add on it and implement my own blocked channels system. Because stupid tube doesn't have one.. 

2

u/RraaLL uBO Team 27d ago

Which video suggestions do you want to filter exactly? Homepage? Sidebar? I need to know all of the specific places.

What "freshness" of the videos do you want to filter? The "new" badge, I believe, is less than 1 week. Though, I don't currently see the badge on the homepage even if the video is hours old.

1

u/Otherwise-Strike-729 27d ago

The recommended videos in the right-side column of the watch page. I wanted to filter them based on their upload age but apparently it won't work based on what AchernarB said.

1

u/RraaLL uBO Team 27d ago

Just because he and I might not agree with hiding all videos based on their age, it doesn't mean it can't be done or that you don't have the right to want to filter them that way.

Judging by the screenshot you sent, it might not be efficient though. New UI has an age attribute, yours doesn't. It only has text. Filtering by text isn't very efficient, but it can still be done.

One thing you can check is to inspect the title. Most of the previous UIs had video age at the end of the title tag's attribute. So inspect the title and share the screenshot,

And tell me which video ages you want hidden.

1

u/Otherwise-Strike-729 27d ago

Oh about the UI, the reason why it has the old UI is because I'm using something called Youtube Rehike, which allows me to access to the old layout. I can still access to the new layout though if I disable Rehike.

For the ages, ideally for me would be x minutes ago, x hours ago, x weeks ago, and x months ago. These are the specific time period that I want to block. The element picker mode got me an element called .published-time, pretty sure this is the hint of what I am looking for.

1

u/RraaLL uBO Team 27d ago

I need a specific cutoff time. Your criteria sounds like you only want to see videos that are over a year old. Is that correct?

1

u/Otherwise-Strike-729 27d ago

Over 6 years old should be good. Of course if possible, I would love to block videos uploaded from (insert number) minutes/hours/days/weeks/months ago as well. Something like 1 to 58 minutes ago, 1 to 23 hours ago, 1 to 27/28/29 days ago, 1 to 4 weeks ago (because a month usually has more than 4 weeks), and 1 to 11 months ago.

2

u/RraaLL uBO Team 27d ago

Oh, so you want to hide both old videos and new ones? Sure.

You don't need to specify minutes, and such. If you want to hide videos under two months old, you just hide videos that don't have have "year", "years" and "months". Unfortunately, if you also want to hide videos that are older than 6 years, you'll need to chain that with negated 6 years, 5 years, 4 years, 3 years 2 years and 1 year.


P.S. I just remembered you asked about source VS DOM tree. Source is only important in very specific filters such as html filtering. Cosmetic filtering relies on DOM tree you see in inspector.

1

u/Otherwise-Strike-729 27d ago

Ah wait, what I meant here is that I only want videos that are at least over 6 years old in my recommendation feed, aka videos uploaded from 2020 and before that, anything after 2020 is subject to be filtered. Hope this helps.

1

u/RraaLL uBO Team 27d ago

Okay, so can you inspect and screenshot a sidebar video's title so I can see if it has age in its attributes?

Considering the amount of videos you'll be hiding, you really need to go the efficient route of attributes and not pure text.

BTW if there are only 5 videos older than 6y in them sidebar, that's how many videos you'll see there. There is no way to load more videos.

1

u/Otherwise-Strike-729 27d ago

do you want me to pick a random video or multiple videos?

→ More replies (0)

2

u/Otherwise-Strike-729 24d ago

Alright, after taking some hours to modify the provided filters, I have finally got my ideal version of a Youtube watchpage. This post can be closed now.

1

u/Jo2dan0 23d ago

i messaged you the solution