Skip to content

Instantly share code, notes, and snippets.

@Lesik
Created November 4, 2021 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lesik/0d983568728a50931d1a4601cfb8b68d to your computer and use it in GitHub Desktop.
Save Lesik/0d983568728a50931d1a4601cfb8b68d to your computer and use it in GitHub Desktop.
Dump all transactions from your ING DiBa account to JSON // Auszug aller Zahlungsein/ausgänge vom ING-DiBa-Konto in JSON
/** Run this on https://banking.ing.de/app/umsatzanzeige, the final object will be
* inside a Promise in your console from where you can copy it into your data
* processing software.
*/
// load all transactions
loadMoreFn = (resolve, reject) => {
const btn = document.querySelector('.g2p-transaction__card__load-more');
if (btn) {
btn.click();
setTimeout(() => loadMoreFn(resolve, reject), 2_000);
} else {
resolve();
}
};
loadMore = new Promise(loadMoreFn);
getTypeAndReference = (element) => {
const typeEl = element.querySelector('.g2p-transaction-summary__type').cloneNode(true);
const referenceEl = typeEl.querySelector('.g2p-transaction-summary__reference');
if (referenceEl) {
typeEl.removeChild(referenceEl);
}
return [
typeEl.textContent.trim(),
referenceEl?.textContent.trim().replace('/', '').trim(),
];
};
(async () => {
await loadMore;
const transactionElements = document.querySelectorAll('.g2p-transaction-item');
const transactions = [...transactionElements].map((element) => {
const recipient = element.querySelector('.g2p-transaction-summary__recipient').textContent.trim();
const [type, reference] = getTypeAndReference(element);
const amount = element.querySelector('.g2p-transaction-summary__amount').textContent.trim();
return {
recipient,
type,
reference,
amount,
};
});
return transactions;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment