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.getElementsByClassName("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.getElementById("items"); l.forEach(function(o){i.appendChild(o.a.parentElement.parentElement.parentElement);});})();
@przemoc

This comment has been minimized.

Copy link
Owner Author

commented Mar 31, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.