Last active
March 31, 2026 14:51
-
-
Save shiftgeist/b96190f0af72d45e05489b8131f42106 to your computer and use it in GitHub Desktop.
Soundcloud: Add all liked songs to playlist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1. Start on https://soundcloud.com/you/likes | |
| // 2. Scroll all the way to the bottom (may only add 300 items at a time because of soundcloud api) | |
| // (playlists are limited to 500 songs) | |
| playlistName = 'Likes' // <== your playlist | |
| list = Array.from(document.querySelectorAll('.badgeList__item .sc-button-more')) | |
| console.log('Found', list.length, 'liked songs') | |
| function addToPlaylist(item) { | |
| // open menu | |
| item.click() | |
| document.querySelector('.sc-button-addtoset').click() | |
| setTimeout(() => { | |
| playlists = Array.from(document.querySelectorAll('.addToPlaylistItem')) | |
| playlist = playlists.find(p => { | |
| titleLink = p.querySelector('.addToPlaylistItem__titleLink').innerText | |
| return titleLink.toLowerCase() === playlistName.toLowerCase() | |
| }) | |
| if (!playlist) { | |
| console.error('No playlist with name', playlistName) | |
| } | |
| // click add to playlist after animation | |
| button = playlist.querySelector('.addToPlaylistButton') | |
| if (button.innerText.toLowerCase() === 'added') { | |
| console.warn('Song already in playlist') | |
| } else { | |
| console.info('Song added to playlist') | |
| button.click() | |
| } | |
| document.querySelector('.modal').click() | |
| }, 300) | |
| } | |
| function delay(i) { | |
| addToPlaylist(list[i]) | |
| if (i < list.length) { | |
| setTimeout(() => { | |
| i++; | |
| delay(i); | |
| }, 500); | |
| } else { | |
| console.warn('End of list reached', i) | |
| } | |
| } | |
| delay(0) |
This script will be detected by soundcloud and you might get you ip banned:
We detected unusual activity from your device or network.
Reasons may include:
Rapid taps or clicks
JavaScript disabled or not working
Automated (bot) activity on your network
Use of developer or inspection tools
updated script:
// 1. Start on https://soundcloud.com/you/likes
// 2. Scroll all the way to the bottom (may only add 300 items at a time because of soundcloud api)
// (playlists are limited to 500 songs)
playlistName = 'Likes' // <== your playlist name
// Updated selector: SoundCloud removed .badgeList__item, use broader selector
list = Array.from(document.querySelectorAll('.soundActions .sc-button-more, button[title="More"]'))
// Deduplicate in case both selectors match the same elements
list = [...new Set(list)]
console.log('Found', list.length, 'liked songs')
if (list.length === 0) {
console.error('No songs found! Try running this in the browser console on https://soundcloud.com/you/likes after scrolling to the bottom.')
}
function addToPlaylist(item) {
// open "more" menu
item.click()
// Try both old and new selector for "Add to playlist" button
const addToSetBtn = document.querySelector('.sc-button-addtoset, button[title="Add to playlist"]')
if (!addToSetBtn) {
console.error('Could not find "Add to playlist" button in menu')
// close any open menu by pressing Escape
document.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape' }))
return
}
addToSetBtn.click()
setTimeout(() => {
// Try both old and new selectors for playlist items
playlists = Array.from(document.querySelectorAll('.addToPlaylistItem, [class*="addToPlaylist"]'))
playlist = playlists.find(p => {
const titleEl = p.querySelector('.addToPlaylistItem__titleLink, [class*="titleLink"]')
if (!titleEl) return false
return titleEl.innerText.toLowerCase() === playlistName.toLowerCase()
})
if (!playlist) {
console.error('No playlist with name', playlistName)
// close modal
const modal = document.querySelector('.modal, [class*="modal"]')
if (modal) modal.click()
return
}
// click add to playlist after animation
button = playlist.querySelector('.addToPlaylistButton, [class*="addToPlaylist"] button')
if (!button) {
console.error('Could not find add button in playlist item')
return
}
if (button.innerText.toLowerCase() === 'added') {
console.warn('Song already in playlist')
} else {
console.info('Song added to playlist')
button.click()
}
const modal = document.querySelector('.modal, [class*="modal"]')
if (modal) modal.click()
}, 300)
}
function delay(i) {
if (i >= list.length) {
console.warn('End of list reached', i)
return
}
addToPlaylist(list[i])
setTimeout(() => {
delay(i + 1)
}, 500)
}
delay(0)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
VM885:10 Uncaught TypeError: Cannot read properties of undefined (reading 'click')
at addToPlaylist (:10:8)
at delay (:41:3)
at :53:1