A simple node script that calculates the total amount spent on food ordering services, based in Greece.
At root level, there's a file named .test.env
. Rename it to just .env
and replace the values of *_ACCESS_TOKEN
to your access tokens.
To get a token from each service, visit the required service, login (if not already logged-in), open your browser's dev tools, select Console and type:
- e-food:
window.app.userSid
. - box:
window.localStorage.getItem('Box:token')
- wolt:
JSON.parse((Object.fromEntries(document.cookie.split('; ').map(v=>v.split(/=(.*)/s).map(decodeURIComponent)))).__wtoken).accessToken
If you have nvm/yvm installed, at root level there are .nvmrc
and .yvmrc
files which help install the correct versions of node and yarn.
If you don't, then advise these files to download and install the correct versions.
nvm use && yvm use
yarn install
To calculate total expenses, run the following command
yarn calculate --service=<efood/box/wolt>
If for any reason installation failed, run yarn clean
and start all over again.
[{ ... }]
Number of shops: <X>.
Total amount of orders: <Y>.
Period from <YYYY-MM-DD> to <YYYY-MM-DD>.
Total amount spent in <SERVICE> is €<Z>.
- Finish tests
- Prettier format for stats
- Add more stats
Add more services