Skip to content

Instantly share code, notes, and snippets.

@hopeseekr
Last active September 21, 2020 13:13
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 hopeseekr/63f4d66b0111a20a1d518c688d3124f1 to your computer and use it in GitHub Desktop.
Save hopeseekr/63f4d66b0111a20a1d518c688d3124f1 to your computer and use it in GitHub Desktop.
Sort YouTube Videos by Duration, Descending
# Sorts YouTube duration, descending, in the Videos Tab
# Add as a bookmarklet
# See https://mreidsma.github.io/bookmarklets/installing.html (https://archive.is/zTp0O)
# Demo: ![image](https://user-images.githubusercontent.com/1125541/93770778-49596f00-fbe2-11ea-8095-9feee6ba6753.png)
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 b.l-a.l});i=document.querySelector("#primary #items");l.forEach(function(o){i.appendChild(o.a.parentElement.parentElement.parentElement)})})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment