Skip to content

Instantly share code, notes, and snippets.

@apricot13
Last active March 18, 2022 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save apricot13/0d8f0ea32138e2d36e6f5ff3de00254b to your computer and use it in GitHub Desktop.
Save apricot13/0d8f0ea32138e2d36e6f5ff3de00254b to your computer and use it in GitHub Desktop.
Highlight short videos on youtube (bookmarklet)
javascript:const milliseconds=(e,t,r)=>1e3*(60*e*60+60*t+r),times=document.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer");[...times].forEach(e=>{const t=e.querySelector("#text").innerHTML.trim().split(":");2===t.length&&t.unshift("0");const r=milliseconds(t[0],t[1],t[2]);r<=6e4&&(e.closest("ytd-grid-video-renderer").style.backgroundColor="#a57070"),isNaN(r)&&(e.closest("ytd-grid-video-renderer").style.backgroundColor="#6e6ebb")});
javascript:const milliseconds=(e,t,s)=>1e3*(60*e*60+60*t+s),times=document.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer");[...times].forEach(e=>{const t=e.querySelector("#text").innerHTML.trim().split(":");2===t.length&&t.unshift("0");const s=milliseconds(t[0],t[1],t[2]);s<=6e4&&(e.closest("ytd-grid-video-renderer").style.display="none"),isNaN(s)&&(e.closest("ytd-grid-video-renderer").style.display="none")});
javascript:const milliseconds=(e,t,s)=>1e3*(60*e*60+60*t+s),times=document.querySelectorAll("ytd-thumbnail-overlay-time-status-renderer");[...times].forEach(e=>{const t=e.querySelector("#text").innerHTML.trim().split(":");2===t.length&&t.unshift("0"),milliseconds(t[0],t[1],t[2])<=6e4&&(e.closest("ytd-grid-video-renderer").style.display="none")});
@apricot13
Copy link
Author

Got annoyed with accidentally clicking on a short video, waiting for the page + video to load while only the audio plays with no option to pause the video to wait. So this just highlights those videos less than 1min it also makes live and premier ones blue.

Create a new bookmark, copy this code into the url section and click.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment