Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bookmarklet for YouTube: Sort videos by length in videos tab
javascript:(function(){l=[].map.call(document.querySelectorAll("span.ytd-thumbnail-overlay-time-status-renderer"),function(e){l=e.innerHTML.trim().split(":").map(function(t){return parseInt(t)}).reduce(function(p,c){return p*60+c});return{a:e.parentElement.parentElement.parentElement,l:l}}).sort(function(a,b){return a.l-b.l});i=document.querySelector("#primary #items");l.forEach(function(o){i.appendChild(o.a.parentElement.parentElement.parentElement)})})()
@przemoc

This comment has been minimized.

Copy link
Owner Author

@przemoc przemoc commented Mar 31, 2019

Tested in Firefox (69). Unfortunately in Chrome (76) it triggers reloading list of videos, but I haven't investigated why and how to fix it.

@przemoc

This comment has been minimized.

Copy link
Owner Author

@przemoc przemoc commented Sep 8, 2019

Basic description is available in my other gist:
Bookmarklet for YouTube: Sort videos by length in videos tab.

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