Last active
July 31, 2022 09:59
-
-
Save titangene/c3129ea668f6659ccd0b242d3e3158cf to your computer and use it in GitHub Desktop.
copy spotify music title & artists
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
(() => { | |
const title = document.querySelector('[data-testid=context-item-info-title]').textContent; | |
const [...artists] = document.querySelectorAll('[data-testid=context-item-info-artist]'); | |
const artistList = artists.map(artist => artist.textContent).join(' & '); | |
const textArea = document.createElement('textarea'); | |
textArea.value = `${artistList} - ${title}`; | |
document.body.appendChild(textArea); | |
textArea.select(); | |
document.execCommand('Copy'); | |
textArea.remove(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment