Skip to content

Instantly share code, notes, and snippets.

@BjoernRave
Last active March 29, 2024 10:41
Show Gist options
  • Save BjoernRave/0a9a6e1168ca5956cda345cd76fb6518 to your computer and use it in GitHub Desktop.
Save BjoernRave/0a9a6e1168ca5956cda345cd76fb6518 to your computer and use it in GitHub Desktop.
Function to get a decklist of a cardmarket wanted list. Just go to your wanted list, right click somewhere, click inspect, go to console, paste this in and hit enter
(function scrapeData() {
const tbody = document.querySelector('tbody');
const trElements = tbody.querySelectorAll('tr');
const result = [];
trElements.forEach((tr) => {
const amountElement = tr.querySelector('.amount');
const nameElement = tr.querySelector('.name');
if (amountElement && nameElement) {
result.push(`${amountElement.textContent.trim()} ${nameElement.textContent.trim()}`);
}
});
return result.join('\n');
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment