music only

try to take over the world!

  1. // ==UserScript==
  2. // @name music only
  3. // @namespace http://tampermonkey.net/
  4. // @include https://www.youtube.com/*
  5. // @version 0.69
  6. // @description try to take over the world!
  7. // @author tuwuna
  8. // @match http://*/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. setInterval(function() {
  13. 'use strict';
  14. let a = document.getElementsByClassName('ytd-rich-grid-video-renderer');
  15. for (let i = a.length - 1; i >= 0; i--) {
  16. if (a[i].id != 'dismissable') continue;
  17. let s = a[i].children[1].children[1].children[0].children[1].children[0].getAttribute('aria-label');
  18. if (s == null) continue;
  19. if (!s.includes(' - ')) a[i].remove();
  20. }
  21. a = document.getElementsByClassName('title');
  22. for (let i = 0; i < a.length; i++) {
  23. if (a[i].children[0] == undefined) continue;
  24. let s = a[i].children[0].innerText;
  25. if (typeof s != 'string') continue;
  26. console.log(s);
  27. if (s.includes(' ')) continue;
  28. let sad = document.getElementById('upnext');
  29. if (sad == null) continue;
  30. if (sad.innerText == 'Up next' && !s.includes(' - ')) {
  31. document.getElementById('content').remove();
  32. }
  33. }
  34. }, 100);