YouTube Music Auto Looper

Automatically clicks twice on the loop button, making it loop automatically... lol

  1. // ==UserScript==
  2. // @name YouTube Music Auto Looper
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Automatically clicks twice on the loop button, making it loop automatically... lol
  6. // @author Emree.el on Instagram :)
  7. // @match https://music.youtube.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Function to find and click on the repeat button
  16. function clickRepeatButton() {
  17. const repeatButton = document.querySelector('tp-yt-paper-icon-button.repeat');
  18. if (repeatButton && repeatButton.getAttribute('title') === 'Repeat off') {
  19. // Click twice on the repeat button
  20. repeatButton.click();
  21. setTimeout(() => repeatButton.click(), 500);
  22. }
  23. }
  24.  
  25. // Function to check for changes in the repeat button periodically
  26. function checkRepeatButton() {
  27. setInterval(clickRepeatButton, 1000);
  28. }
  29.  
  30. // Start checking for the repeat button
  31. checkRepeatButton();
  32. })();