Created
January 9, 2022 20:43
-
-
Save MarkReeder/86054655336408228522776742db3776 to your computer and use it in GitHub Desktop.
This file contains 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 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