项目作者: viniciusgava

项目描述 :
Download Itaú exportable files using node and Puppeteer. OFX, OFC and TXT(CSV)
高级语言: JavaScript
项目地址: git://github.com/viniciusgava/itauscraper.git
创建时间: 2019-03-11T04:31:46Z
项目社区:https://github.com/viniciusgava/itauscraper

开源协议:MIT License

下载


Itau Scraper

Download Itaú exportable files using node and Puppeteer.
Available file formats:

  • PDF
  • TXT - It’s a CSV with semi-colon (DEFAULT)
  • OFX - Money 2000
  • OFC 1.0 - Money 1995 a Money 1999
  • OFC 1.06 - Money
  • OFC 1.06 - Quicken

Usage

  1. node run.js --branch=0000 --account=00000-0 --password=000000 --days 5

Usage - Docker

  1. Download this seccomp for chrome on docker. It will be used in the docker run:

    1. wget https://raw.githubusercontent.com/jessfraz/dotfiles/master/etc/docker/seccomp/chrome.json
  2. Execute:

    1. docker run -v $(pwd):/home/node/itauscrapper/download \
    2. -rm \
    3. -u $UID:$GID \
    4. --security-opt seccomp=./chrome.json \
    5. -e BRANCH='0000' \
    6. -e ACCOUNT='00000-0' \
    7. -e PASSWORD='000000' \
    8. -e DAYS='000000' \
    9. viniciusgava/itauscraper:latest

    Details about the dockerfile

    This dockerfile has several fixes to be able to executed headless and safe.
    If you wanna know more, check the links bellow:

Help

  1. Usage: node run.js [options]
  2. Options:
  3. --help Show help [boolean]
  4. --version Show version number [boolean]
  5. -b, --branch Itaú branch number, format: 0000 [string] [required]
  6. -c, --account Itaú account number, format: 00000-0 [string] [required]
  7. -n, --name Itaú account name, format: Joao [string]
  8. -p, --password Itaú account digital password(6 digits) [number] [required]
  9. -d, --days Transaction log days
  10. [number] [required] [choices: 3, 5, 7, 15, 30, 60, 90]
  11. -f, --file_format File format to export
  12. [choices: "pdf", "txt", "ofx", "ofc10", "ofc106", "ofc106quicken"] [default:
  13. "txt"]
  14. --node_env Node environment
  15. [choices: "development", "production", "docker"] [default: "production"]

In order to use multiple account holders names(Conta Conjunta), please, inform the option -name.
Otherwise, it will not work.

Crontab

  1. Create bash like this:
    ````bash

    !/bin/bash

    SCRIPTPATH=”$( cd “$(dirname “$0”)” ; pwd -P )”

print current date for debuging proposes

date

try 5 times

n=0
until [ $n -ge 2 ]
do
echo “trying $n”
/usr/bin/docker run -v $SCRIPTPATH/download:/home/node/itauscrapper/download \
—env-file “$SCRIPTPATH/env-configs” \
—rm \
-u $UID:$GID \
—security-opt seccomp=./chrome.json \
viniciusgava/viniciusgava/itauscraper:latest 2>&1 && break
n=$[$n+1]
sleep 15
done

  1. **Mac tip:** You must pass docker full path to works at crontab
  2. ``/usr/local/bin/docker``
  3. 2. add all env variables at ``env-configs``.
  4. Example:
  5. ```bash
  6. BRANCH=0000
  7. ACCOUNT=00000-0
  8. PASSWORD=000000
  9. DAYS=5
  10. ```
  11. **DO NOT** use quotation to define values on env files.
  12. 3. run ``crontab -e`` and add the follow cron.
  13. Example:
  14. ````bash
  15. 0 */4 * * * sh /home/username/automate/itauscraper/run.sh >> /home/username/automate/itauscraper/log.log

The example bellow runs every 4 hours of everyday

You can generate a different crontab config on https://crontab-generator.org