Skip to content

Instantly share code, notes, and snippets.

@titangene
Last active July 31, 2022 09:59
Show Gist options
  • Save titangene/c3129ea668f6659ccd0b242d3e3158cf to your computer and use it in GitHub Desktop.
Save titangene/c3129ea668f6659ccd0b242d3e3158cf to your computer and use it in GitHub Desktop.
copy spotify music title & artists
(() => {
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