Skip to content

Instantly share code, notes, and snippets.

@jonaskahn
Last active January 6, 2023 04:53
Show Gist options
  • Save jonaskahn/4d156613231e347d3e4c883c949b330f to your computer and use it in GitHub Desktop.
Save jonaskahn/4d156613231e347d3e4c883c949b330f to your computer and use it in GitHub Desktop.
function exportData() {
const table = $('.table').children("div")
for (let i = 1; i < table.length; i++) {
const rowData = table[i].childNodes
let rank = '';
let name = ''
let country = ''
for (let j = 0; j < rowData[0].childNodes.length; j++) {
const data = rowData[0].childNodes[j]
if ($(data).hasClass('rank')) {
rank = $(data.childNodes[0]).text()
}
if ($(data).hasClass('audience')) {
country = $(data).text()
}
if ($(data).hasClass('contributor')) {
name = $(data).find('div.contributor__name-content').first().text()
}
}
console.log(`${rank}, ${name}, ${country}`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment