Created
March 29, 2024 12:08
-
-
Save mrhammadasif/1bd91b4060a319b1b802935a4869e949 to your computer and use it in GitHub Desktop.
Remove all Songs from Playlist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var song = document.body.querySelectorAll( ".dropdown-trigger.ytmusic-menu-renderer" ) | |
for ( var i = 0; i < song.length; i++ ) { | |
song[i].click(); var dropdown = document.body.querySelector( "ytmusic-menu-popup-renderer[slot='dropdown-content']" ) | |
if ( dropdown != undefined ) { | |
var items = dropdown.querySelector( "tp-yt-paper-listbox#items" ).querySelectorAll( "ytmusic-menu-service-item-renderer" ) | |
if ( items != null ) { | |
items.forEach( async ( element ) => { | |
if ( element.querySelector( 'yt-formatted-string' ).innerHTML == 'Remove from playlist' ) { | |
// element.style.backgroundColor = 'red'; | |
element.click() | |
await new Promise( r => setTimeout( r, 1000 ) ) | |
console.log( "removed from library" ) | |
} | |
} ) | |
} | |
} | |
await new Promise( r => setTimeout( r, 1000 ) ) | |
} |
Author
mrhammadasif
commented
Mar 29, 2024
- Open Youtube Music
- Open any Playlist (from which you want to remove all the songs)
- Then Copy this script and paste in your console, It will remove all songs gradually
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment