Last active
March 29, 2024 10:41
-
-
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
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
(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