Skip to content

Instantly share code, notes, and snippets.

@merlijn-sebrechts
Last active February 10, 2026 15:55
Show Gist options
  • Select an option

  • Save merlijn-sebrechts/f65d7b62b8214a94a136e997ecd7dca9 to your computer and use it in GitHub Desktop.

Select an option

Save merlijn-sebrechts/f65d7b62b8214a94a136e997ecd7dca9 to your computer and use it in GitHub Desktop.
How to add an entire YouTube Music playlist to "liked songs"

How to add an entire YouTube Music playlist to "liked songs"

After migrating from Spotify to YouTube Music, I had the issue that my "liked songs" became a playlist on YouTube Music, instead of "liked songs".

I automatically added this entire playlist to likes song using the following steps.

  1. Open YouTube Music in your browser.
  2. Open the playlist you want to like.
  3. Scroll to the very bottom so all songs load.
  4. Press F12 to open Developer Tools → go to the Console tab.
  5. Paste the script below → hit Enter.

Note that this script starts from the bottom up, because that was the chronological order of my playlist.

Note that it might catch some unwanted "likes" at the bottom and the top, due to recommendations using the same labels. Either remove these manually from the page before running the script, or remove them from liked songs after running the script.

async function likeAllSongsBottomUp() {
  const delay = ms => new Promise(res => setTimeout(res, ms));

  // Fetch all unliked buttons
  let buttons = Array.from(
    document.querySelectorAll(
      'ytmusic-like-button-renderer[like-status="INDIFFERENT"] button[aria-label="Like"][aria-pressed="false"]'
    )
  );

  console.log("Found", buttons.length, "songs to like.");

  // Reverse order so we start at the bottom
  buttons.reverse();

  for (let i = 0; i < buttons.length; i++) {
    const btn = buttons[i];
    btn.click();
    console.log(`Liked ${i + 1}/${buttons.length}`);
    await delay(500); // You can increase this if YTM begins to miss clicks
  }

  console.log("Done (bottom → top)!");
}

likeAllSongsBottomUp();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment