Skip to content

Instantly share code, notes, and snippets.

@ssledz
Last active March 7, 2025 17:41
Show Gist options
  • Save ssledz/c13079abd769da9ccf6b29396e6c55dd to your computer and use it in GitHub Desktop.
Save ssledz/c13079abd769da9ccf6b29396e6c55dd to your computer and use it in GitHub Desktop.
Remove all youtube subscriptions

https://www.youtube.com/playlist?list=LL

let cnt = 0;
setInterval(() => {
   let items = document.querySelectorAll('ytd-playlist-video-renderer button');
   console.log('tick');
    if (items.length > 0) {
        items[cnt++].click();
        setTimeout(() => {
          let btn = document.querySelectorAll('ytd-menu-popup-renderer ytd-menu-service-item-renderer')[4];
          btn.click();  
        }, 500);
        
    } else {
        clearInterval();
    }
}, 1000);

https://www.youtube.com/feed/channels

let cnt = 1;
setInterval(() => {
    let buttons = document.querySelectorAll('ytd-subscribe-button-renderer button');
    if (buttons.length === 0) {
        console.log("All subscriptions removed!");
        clearInterval();
    } else {
        buttons[cnt++].click();
        setTimeout(() => {
            let confirmButton = document.querySelector('yt-button-renderer#confirm-button button');
            if (confirmButton) confirmButton.click();
        }, 500);
    }
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment