Last active
May 16, 2020 16:39
-
-
Save eefret/a6b6362e2c5ff3ee81027e746ea2d6bd to your computer and use it in GitHub Desktop.
Wizard of Legend arcana and relic info from gamepedia
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
// This extracts the arcana and relic information from the gamepedia wiki | |
// just go to the console and paste this script and you will have the full information in a json format | |
// inside arcanaJson and relicJson variables | |
let tables = []; | |
let arcanaTables = []; | |
let arcanaJson = []; | |
let arcanaCsv; | |
let relicTables = []; | |
let relicJson = []; | |
let relicCsv; | |
if (window.location.href == 'https://wizardoflegend.gamepedia.com/Pools') { | |
tables = document.querySelectorAll('.wikitable'); | |
tables.forEach((value, key) => { | |
if (key <= 4) { | |
arcanaTables.push(value); | |
} else { | |
relicTables.push(value); | |
} | |
}); | |
arcanaTables.forEach(value => { | |
value.querySelectorAll('tbody tr').forEach(row => { | |
arcanaJson.push({ | |
arcanaImg: row.querySelector('td:nth-child(1) a img').src, | |
name: row.querySelector('td:nth-child(2) a').title, | |
description: row.querySelector('td:nth-child(3)').innerText, | |
element: row.querySelector('td:nth-child(4) a').title, | |
type: row.querySelector('td:nth-child(5)').innerText, | |
damage: row.querySelector('td:nth-child(6)').innerText, | |
cooldown: row.querySelector('td:nth-child(7)').innerText, | |
knockback: row.querySelector('td:nth-child(8)').innerText, | |
duration: row.querySelector('td:nth-child(9)').innerText, | |
costGems: row.querySelector('td:nth-child(10)').innerText.split('\n')[0].trim(), | |
costGold: row.querySelector('td:nth-child(10)').innerText.split('\n')[1].trim(), | |
pool: row.querySelector('td:nth-child(11)').innerText | |
}); | |
}) | |
}); | |
relicTables.forEach(value => { | |
value.querySelectorAll('tbody tr').forEach(row => { | |
relicJson.push({ | |
relicImg: row.querySelector('td:nth-child(1) a img').src, | |
name: row.querySelector('td:nth-child(2) a').title, | |
description: row.querySelector('td:nth-child(3)').innerText, | |
type: row.querySelector('td:nth-child(4)').innerText, | |
costGems: row.querySelector('td:nth-child(5)').innerText.split('\n')[0].trim(), | |
costGold: row.querySelector('td:nth-child(5)').innerText.split('\n')[1].trim(), | |
pool: row.querySelector('td:nth-child(6)').innerText, | |
}) | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment