Skip to content

Instantly share code, notes, and snippets.

@przemoc
Last active September 8, 2019 01:49
Show Gist options
  • Save przemoc/d94af3f525caa57a539b6eafb7cbb7ee to your computer and use it in GitHub Desktop.
Save przemoc/d94af3f525caa57a539b6eafb7cbb7ee to your computer and use it in GitHub Desktop.
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
Copy link
Author

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
Copy link
Author

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