Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
Remove all divs the contain "months" or "years" on the youtube homescreen

How do I with a simple a jquery string in the console remove/restyle all elements that contain the innerHTML strings "years" and "months" on the youtube homescreen?

The goal is to remove or highlight all old video containers so i don't have to look at it and can focus on the new stuff since youtube recycle their content too much.

What i have done so far:

Step 1: First load jquery (works)

var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// ... give time for script to load, then type (or see below for non wait option)
jQuery.noConflict();

Step 2 (fails): If i use ":contains" it remove everything and if i use ":has" nothing happens. How do i get it to not remove everything but only the specefic video elements?

$( "div:has('months')" ).css( "display", "none" );

This i the jQuery documentation i was following: https://api.jquery.com/category/selectors/content-filter-selector/

If any good ideas in how to clean up this homescreen please add a suggestion. With the Chrome "Multi Search & Multi Jump" plugin you can scroll to the bottom of the feed highlight all strings but would be much nicer to remove them all.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Something like this perhaps (no need for jQuery) - tested in Chrome...

document.querySelectorAll('.ytd-video-meta-block').forEach(meta => { const metaText = meta.innerText; if(metaText.indexOf("month") !== -1 || metaText.indexOf("year") !== -1){ const old = meta.closest('.ytd-rich-grid-row'); if(old){ old.remove() }} })
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!