Created
November 4, 2021 10:37
-
-
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
This file contains hidden or 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
/** 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