Youtube Music Playlist Dumping

Via Google Play Music, I have some old Youtube Music playlists. But there does not seem to be a way to export them into a useful form. Takeout lets you export them, but you just get video IDs and a timestamp which is not immediately helpful and for uploaded music prohibitive to make sense of.

Here’s a javascript snippet that can be pasted into the web inspector while viewing a playlist on, to dump the track metadata. It exports tab-separated values.

// Scroll to bottom of playlist.
// To save results, right click and "Copy Object".
// Double-check the number of results; if entries are missing, you might need to scroll further.
// (Sometimes the number of entries simply doesn't match the playlist's count. May be limited to auto playlists.)
const playlistName = document.getElementsByTagName('ytmusic-detail-header-renderer')[0][0].text;
const playlist = document.getElementsByTagName('ytmusic-playlist-shelf-renderer')[0];
const entries = ["Video Id\tTitle\tArtist\tAlbum"];
function textFromColumnIfPresent(col) {
  return col.musicResponsiveListItemFlexColumnRenderer.text.runs ? col.musicResponsiveListItemFlexColumnRenderer.text.runs[0].text : "";
for (const item of {
  const renderer = item.musicResponsiveListItemRenderer;q
  const id = renderer.playlistItemData ? renderer.playlistItemData.videoId : ""; // Track may be unavailable
  const title = textFromColumnIfPresent(renderer.flexColumns[0]);
  const artist = textFromColumnIfPresent(renderer.flexColumns[1]);
  const album = textFromColumnIfPresent(renderer.flexColumns[2]);
  entries.push(id + "\t" + title + "\t" + artist + "\t" + album);
console.log("Found " + (entries.length-1) + " tracks");
console.log("Playlist: " + playlistName);