Skip to content

Instantly share code, notes, and snippets.

@lingsamuel
Created May 7, 2021 03:32
Show Gist options
  • Save lingsamuel/6d33f8e58f6e183287038b006e90e4a5 to your computer and use it in GitHub Desktop.
Save lingsamuel/6d33f8e58f6e183287038b006e90e4a5 to your computer and use it in GitHub Desktop.
Steam cost to CSV file
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