Find Duplicated Songs in Playlist - Youtube Music

Published: 2020-06-08, Updated: 2020-06-08

  1. Go to the playlist that you want to find the duplicated songs, then press F12 to open the Chrome JavaScript console

  1. Run the following script, it will enumate all playlist songs and print the duplicated song names to the console
let songs = {};
let total= 0;
document.querySelectorAll("ytmusic-playlist-shelf-renderer .title-column").forEach(it => {
    let k = it.textContent.replace(/[\n\r]/g, '').replace(/[\s]{2,}/g, '');
    if(songs[k] == undefined){
        songs[k] = 0;
    } else {
        total++;
        songs[k]++;
        console.info(`Duplicated song: ${k}, times=${songs[k]}`);
    }
    
});
console.info("total duplicated songs: ", total);

Now you can find the names on the browser using CTRL + F and remove them.


Change Mouse Cursor at Any Linux Distribution Jvmti/JDI Bookmarks

Comments