Skip to content

Instantly share code, notes, and snippets.

@musatov
Created May 20, 2020 07:53
Show Gist options
  • Save musatov/22f2dcce76e266a18737be16bd7a1807 to your computer and use it in GitHub Desktop.
Save musatov/22f2dcce76e266a18737be16bd7a1807 to your computer and use it in GitHub Desktop.
Run script on the apple music playlist page console and get list of songs and artists as a string. Resulted string can be used to import the collection to other services like yandex music (https://yandex.ru/support/music/library/import.html)
const elements = Array.from(document.querySelectorAll('.song-name-wrapper'));
const playlist = elements.map(element => {
const nameElement = element.querySelector('.typography-label');
const artistElement = element.querySelector('.typography-caption > a');
const name = nameElement.innerText;
const artist = artistElement.innerHTML;
return `${name} ${artist}`;
});
const playListAsString = playlist.join('\r\n');
console.log(playListAsString);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment