Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save MarkReeder/86054655336408228522776742db3776 to your computer and use it in GitHub Desktop.
Save MarkReeder/86054655336408228522776742db3776 to your computer and use it in GitHub Desktop.
const headers = {};
const songs = [];
document.querySelectorAll('tr').forEach(row => {
row.querySelectorAll('th').forEach((headerElem, i) => {
headers[i] = headerElem.innerText;
});
const song = {};
row.querySelectorAll('td').forEach((bodyElem, i) => {
song[headers[i]] = bodyElem.innerText;
});
if (Object.keys(song).length) {
songs.push(song);
}
});
copy(songs.map((song, i) => `${i+1} - ${song.Artist} - ${song.Title}`).join("\r\n"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment