UNPKG

n26-puppeteer-scraper

Version:

n26 scraper: a tool to download account informations and transactions archive

29 lines (23 loc) 923 B
const debug = require('debug') const log = debug('n26:determine-start-date-of-archive') module.exports = async function n26getBankStatements (page) { log('navigating to https://app.n26.com/downloads') await page.goto('https://app.n26.com/downloads') // await page.waitForSelector('#start-date-picker') // await page.click('#start-date-picker') const statements = await page.evaluate(() => { const statementAnchors = document.querySelectorAll('[href^="/download-statement"]') const links = [...statementAnchors].filter(Boolean).map(el => el.getAttribute('href')) const statements = links.map(link => { const date = link.match(/statement-(\S+)/)[1] return { date, link: `https://app.n26.com${link}` } }) .sort((a, b) => +new Date(a.date) - +new Date(b.date)) return statements }) log('statements.length', statements.length) return statements }