Skip to content

Instantly share code, notes, and snippets.

@audacus
Created October 22, 2016 21:11
Show Gist options
  • Save audacus/9204d77fb94a8fda43be23746f4bdcc2 to your computer and use it in GitHub Desktop.
Save audacus/9204d77fb94a8fda43be23746f4bdcc2 to your computer and use it in GitHub Desktop.
Get fuel prices from http://www.garage-howald.ch/
function getFuelPrices() {
var tableBody = document.querySelectorAll('body table table table table')[1].childNodes[1];
var data = [];
for (var i = 1; i <= 5; i = i + 2) {
var row = {
label: tableBody.childNodes[i].childNodes[1].childNodes[0].data,
price: tableBody.childNodes[i].childNodes[3].childNodes[0].data
};
data.push(row);
}
return data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment