Created
February 11, 2019 11:39
-
-
Save pingec/73878df1f603fd8ba54511f109788484 to your computer and use it in GitHub Desktop.
Dumps bitstamp transactions from html table to csv string (including transaction IDs)
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
/* Dumps bitstamp transactions from html table to csv string (including transaction IDs) */ | |
let bitStampTrxToCsv = () => { | |
let trxs = $("table.transactions").find("tr"); | |
let csv = ""; | |
for (let i = 0; i < trxs.length - 1; i++) { | |
if (trxs.eq(i).is(".details")) { | |
continue; | |
} | |
let line = ""; | |
trxs.eq(i).find("td").each((_, td) => { | |
line += `"${$(td).text()}",`; | |
}); | |
if (trxs.eq(i + 1).is(".details")) { | |
let text = trxs.eq(i + 1).find("td").text(); | |
line += `,"${text.split("(TXID): ")[1]}"`; | |
} | |
else { | |
line += "," | |
} | |
csv += line + "\r\n"; | |
} | |
return csv; | |
} | |
console.log(bitStampTrxToCsv()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment