Skip to content

Instantly share code, notes, and snippets.

@jmgunn87
Created March 16, 2014 22:02
Show Gist options
  • Save jmgunn87/9590509 to your computer and use it in GitHub Desktop.
Save jmgunn87/9590509 to your computer and use it in GitHub Desktop.
scrape all the statements!
function Transaction(data) {
this.paidIn = parseFloat(data.paidIn);
this.paidOut = parseFloat(data.paidOut);
this.balance = parseFloat(data.balance);
this.description = data.descritpion;
this.Date = data.date;
this.type = data.type;
}
//turm 'em all into CSV
$('.hsbcRowSeparator tbody tr a').each(function (i, a) {
var month = [];
var html = $.ajax({ type: "GET", url: a.href, async: false }).responseText;
var table = $($(html).find('table')[1]);
table.find('tr').each(function (i, r) {
var transaction = [];
$(r).find('td').each(function (i, d) {
transaction.push($.trim(d.textContent));
});
month.push(transaction.join(','));
});
console.log(month.join('\n'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment