Skip to content

Instantly share code, notes, and snippets.

@adrienjoly
Last active December 28, 2015 23:38
Show Gist options
  • Save adrienjoly/7579919 to your computer and use it in GitHub Desktop.
Save adrienjoly/7579919 to your computer and use it in GitHub Desktop.
scrape payment history from HSBC website (limited to 2 months, unfortunately...)
var lines = [];
var win = document.getElementsByName("FrameWork")[0].contentWindow;
var doc = win.document;
function nextPage() {
//doc.getElementsByClassName("pagination")[0].getElementsByTagName("a")
win.location.href = "javascript:suivante()";
}
function scrapeLine(tr) {
var line = [];
for (var i=0;i<tr.children.length;++i)
line.push(tr.children[i].innerText);
return line;
}
function appendLines() {
var trs = doc.getElementsByTagName("tr");
for (var i=0;i<trs.length;++i)
lines.push(scrapeLine(trs[i]));
console.log("appended lines starting after date:", lines[0][0]);
}
appendLines();
nextPage(appendLines);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment