Created
May 7, 2021 03:32
-
-
Save lingsamuel/6d33f8e58f6e183287038b006e90e4a5 to your computer and use it in GitHub Desktop.
Steam cost to CSV file
This file contains 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
console.log(Array.from(document.querySelectorAll('.wallet_table_row')) | |
.filter(x => !(x.children[2].textContent.includes('退款') || x.children[2].textContent.includes('转换') || x.children[1].textContent.includes('钱包资金'))) | |
.map(x => { return { | |
date: x.children[0].innerText, | |
cost: x.children[3].innerText, | |
item: x.children[1].innerText.split("\n").join(' 和 ') } | |
}) | |
.filter(x => x.cost.startsWith("¥")) | |
.map(x => { return { | |
date: x.date, | |
cost: parseFloat(x.cost.split('\n')[0].split(' ')[1].replace(',', '')), | |
item: x.item } | |
}) | |
.map(x=> x.date + ", " + x.cost.toString()+', '+x.item).join("\n") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment