Skip to content

Instantly share code, notes, and snippets.

@asbjornu
Created November 10, 2020 11:40
Show Gist options
  • Save asbjornu/ebfc6f1c6cd4671f14a718d2f24d3d6c to your computer and use it in GitHub Desktop.
Save asbjornu/ebfc6f1c6cd4671f14a718d2f24d3d6c to your computer and use it in GitHub Desktop.
WildMag converter
// Converts http://wildmag.de/compo/?order=round to tab separated values logged to the console.
for (const row of document.getElementsByTagName('tr')) {
const cols = row.getElementsByTagName('td');
if (cols.length == 0) {
continue;
}
const roundText = cols.item(0).innerText;
const round = parseInt(roundText, 10);
const rank = cols.item(1).innerText.replace('.', '');
const points = cols.item(2).innerText;
const authorentry = cols.item(3).innerText;
const splittereen = authorentry.split('–');
const author = splittereen[0].trim();
const entry = splittereen[1].trim();
if (round != previousRound) {
console.debug(`---------------- Round ${round} -------------------------`);
}
console.debug(`${rank}\t${entry}\t${author}\t${points}`);
// console.debug(`${rankText}\t${entry}\t${author}\t${pointsText}`);
previousRound = round;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment