Skip to content

Instantly share code, notes, and snippets.

@TheOnlyWayUp
Last active July 8, 2026 07:14
Show Gist options
  • Select an option

  • Save TheOnlyWayUp/4452b0a5c151740417c16f3518fb701e to your computer and use it in GitHub Desktop.

Select an option

Save TheOnlyWayUp/4452b0a5c151740417c16f3518fb701e to your computer and use it in GitHub Desktop.
Like all songs in a Youtube Music Playlist

This script likes all the songs in a Youtube Music Playlist at once.

How to use:

  • Visit a Playlist's page on ytm (URL looks like: https://music.youtube.com/playlist?list=...
  • Press ctrl + shift + j. This opens the Developer Console.
  • Copy the script in this gist (That's in script.js)
  • Paste the code into the Developer Console on the ytm Tab, hit enter.
  • Great, you're done!

Star ⭐ this gist if it was useful. Follows to my GitHub Profile are appreciated.

Follow Badge


TheOnlyWayUp © 2024

// made by https://github.com/TheOnlyWayUp, if it helped, drop a follow!
// source: https://gist.github.com/TheOnlyWayUp/4452b0a5c151740417c16f3518fb701e
let interval = 10 // wait time between chunks in seconds
const chunk = size => array => array.reduce((result, item) => {
if (result[result.length - 1].length < size) {
result[result.length - 1].push(item);
} else {
result.push([item]);
}
return result;
}, [
[]
]); // Thanks https://stackoverflow.com/a/77372180
function likeall() {
let els = document.getElementById("contents").querySelectorAll(
"button[aria-pressed=false][aria-label='Like']")
console.log(`${els.length} to Like`)
let cels = chunk(5)(Array.from(els))
cels.forEach(function(items, index) {
setTimeout(function() {
console.log("start")
items.forEach(el => el.click())
console.log("end")
}, index *
interval * 1000); // Thanks https://stackoverflow.com/a/45500721
});
}
likeall()
@olekii

olekii commented Jun 3, 2025

Copy link
Copy Markdown

The program worked perfectly I used it to like my 3000 songs that I had from spotify over to my youtube music account.

I am hoping you have not gotten banned? How much did you wait between liking songs?

I still have my account and its been over 2 months still use it daily and had no problems. I also believe its due to my accounts age of 10+ years and it being premium for youtube music and I used the default original code without changing the timing between liking songs

@svintit

svintit commented Jun 15, 2025

Copy link
Copy Markdown

None of these seem to work as of today, no songs are selected, and it finishes almost immediately, will try find some time to fix

@svintit

svintit commented Jun 15, 2025

Copy link
Copy Markdown

I got it working with https://github.com/aawezhussain/Youtube-Music-Auto-Playlist-Liker - updating the query selector ID and removing the liked conditional (none of my songs were already liked so worked for me)

@pokemonshowdown1

Copy link
Copy Markdown

I got it working with https://github.com/aawezhussain/Youtube-Music-Auto-Playlist-Liker - updating the query selector ID and removing the liked conditional (none of my songs were already liked so worked for me)

Would you mind posting your fix?

@PostApoc

Copy link
Copy Markdown

I got it working with https://github.com/aawezhussain/Youtube-Music-Auto-Playlist-Liker - updating the query selector ID and removing the liked conditional (none of my songs were already liked so worked for me)

Would you mind posting your fix?

I got it working by changing the following line:
const likeButtons = document.querySelectorAll('tp-yt-paper-icon-button[aria-label="Like"]');
To:
const likeButtons = document.querySelectorAll('.yt-spec-button-shape-next--icon-button[aria-label="Like"]');

@OliOyl

OliOyl commented Jul 16, 2025

Copy link
Copy Markdown

could someone drop a working full fix? the fix above by @PostApoc doesn't work

@mousa-aljasem

Copy link
Copy Markdown

Hello! I've just created my own version of this. yt-music-auto-liker

This one will give a more detailed log of what its doing. By that I mean it will show the count, artist, song name and if its already liked

@TuTAH1

TuTAH1 commented Sep 3, 2025

Copy link
Copy Markdown

I edited some code and made it as userscript: https://greasyfork.org/en/scripts/548226-youtube-music-playlist-liker

@doctorwhosanengineer

Copy link
Copy Markdown

used the userscript by @TuTAH1 with violentmonkey becuase I shifted from Spotify to Yt music (account is old), as of Jan 2026 it is working without issues. Thanks!

@pevanq

pevanq commented Apr 15, 2026

Copy link
Copy Markdown

Thanks for sharing.
For someone who is not familiar with scripting, try this chrome extention!
https://chromewebstore.google.com/detail/phkgaaobgjlplhcdccfcgghmgpogebln?utm_source=item-share-cb

@sudarshansb143

Copy link
Copy Markdown

Thanks for sharing. For someone who is not familiar with scripting, try this chrome extention! https://chromewebstore.google.com/detail/phkgaaobgjlplhcdccfcgghmgpogebln?utm_source=item-share-cb

This extension has been removed

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