function downloadNubankCSV({ date }) {
const transactions = angular.element(document.body).injector().get('Bills').all.map(bill => bill.more.line_items).flat()
const regExp = new RegExp(date, 'g')
const csv = transactions
// filtering wanted/unwanted datapoints
.filter(info => info.post_date.match(regExp) && !info.title.match(/Pagamento recebido/g))
.sort((a, b) =>Number(a.post_date.slice(-2)) - Number(b.post_date.slice(-2)))
.map(info =>
[
info.post_date,
info.title,
(info.description || ''),
(info.amount || 0) / 100,
].join(','),
)
.join('\n')
const element = document.createElement('a')
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(csv))
element.setAttribute('download', `${date}-nubank.csv`)
element.style.display = 'none'
document.body.appendChild(element)
element.click()
document.body.removeChild(element)
}
- Access your nubank account in webmode
- Open chrome dev tool on network tab
- Run the fn:
downloadNubankCSV({ date: '2019-10' })
- Profits
Convert this into a chrome extension that has a select input so you can download Year/Month you would like
- Check corner cases
- Add agnostic way to filter (fobiddenList)