0

I have a lot of playlists in YouTube Music (over 50). Each of them has a URL so I can share it with people, but if I want to share all of the URLs with someone it's a pain to manually copy and paste the URLs for each playlist.

Is there a way that I can get all of the playlists along with their URLs in a list?

1 Answer 1

1

Instructions:

  1. Go to your Playlists page.
  2. Make sure all of the playlists you want to share are at least "Unlisted" if not "Public". You can change this by clicking the three dots on one of the playlists -> "Edit playlist" -> "Privacy" drop down. Unfortunately you have to do this by hand for each playlist.
  3. Scroll to the bottom of the Playlists page (making sure that all your playlists have loaded).
  4. Press F12 to open your console.
  5. Paste this JavaScript into your console.
    const playlists = [];
    
    document.querySelectorAll("ytmusic-two-row-item-renderer").forEach(playlist => {
      const title = playlist.querySelector(".details > .title-group").innerText; 
      const url = playlist.querySelector("a").href;
    
      if(title !== "New playlist" && title !== "Your Likes")
        playlists.push({title, url});
    });
    
  6. (optional) To sort it, enter this:
    playlists.sort((a,b) => (a.title > b.title) ? 1 : ((b.title > a.title) ? -1 : 0));
    
  7. Do what you'd like with the array of objects. I provide a few options below.

If you want the output in JSON form, just stringify it:

JSON.stringify(tracklistObj, null, '\t');

If you want a plain text version:

let myString = "";
playlists.forEach(list => myString += `${list.title} - ${list.url}\n`);
myString;

If you want to have the output be an HTML list:

let myHTML = "<ul>";
playlists.forEach(list => myHTML += `<li><a href="${list.url}" target="_blank">${list.title}</a></li>` );
myHTML += "</ul>";

Note: Shared YouTube Music playlists do not show uploaded songs to other users besides the one who made the playlist. There's nothing that you can do about this to my knowledge.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.