Code Monkey home page Code Monkey logo

israeli-bank-scrapers's Introduction

Israeli Bank Scrapers - Get closer to your own data!

Logo

NPM

npm version dependencies Status devDependencies Status

Important!

The scrapers are set to use timezone Asia/Jerusalem to avoid conflicts in case you're running the scrapers outside Israel.

What's here?

What you can find here is scrapers for all major Israeli banks and credit card companies. That's the plan at least. Currently only the following banks are supported:

Prerequisites

To use this you will need to have Node.js >= 16.x installed.

Getting started

To use these scrapers you'll need to install the package from npm:

npm install israeli-bank-scrapers --save

Then you can simply import and use it in your node module:

import { CompanyTypes, createScraper } from 'israeli-bank-scrapers';

(async function() {
  try {
    // read documentation below for available options
    const options = {
      companyId: CompanyTypes.leumi, 
      startDate: new Date('2020-05-01'),
      combineInstallments: false,
      showBrowser: true 
    };

    // read documentation below for information about credentials
    const credentials = {
      username: 'vr29485',
      password: 'sometingsomething'
    };

    const scraper = createScraper(options);
    const scrapeResult = await scraper.scrape(credentials);

    if (scrapeResult.success) {
      scrapeResult.accounts.forEach((account) => {
        console.log(`found ${account.txns.length} transactions for account number ${account.accountNumber}`);
      });
    }
    else {
      throw new Error(scrapeResult.errorType);
    }
  } catch(e) {
    console.error(`scraping failed for the following reason: ${e.message}`);
  }
})();

Check the options declaration here for available options.

Regarding credentials, you should provide the relevant credentials for the chosen company. See this file with list of credentials per company.

The structure of the result object is as follows:

{
  success: boolean,
  accounts: [{
    accountNumber: string,
    balance?: number, // Account balance. Not implemented for all accounts.
    txns: [{
      type: string, // can be either 'normal' or 'installments'
      identifier: int, // only if exists
      date: string, // ISO date string
      processedDate: string, // ISO date string
      originalAmount: double,
      originalCurrency: string,
      chargedAmount: double,
      description: string,
      memo: string, // can be null or empty
      installments: { // only if exists
        number: int, // the current installment number
        total: int, // the total number of installments
      },
      status: string //can either be 'completed' or 'pending'
    }],
  }],
  errorType: "INVALID_PASSWORD"|"CHANGE_PASSWORD"|"ACCOUNT_BLOCKED"|"UNKNOWN_ERROR"|"TIMEOUT"|"GENERIC", // only on success=false
  errorMessage: string, // only on success=false
}

You can also use the SCRAPERS list to get scraper metadata:

import { SCRAPERS } from 'israeli-bank-scrapers';

The return value is a list of scraper metadata:

{
  <companyId>: {
    name: string, // the name of the scraper
    loginFields: [ // a list of login field required by this scraper
      '<some field>' // the name of the field
    ]
  }
}

Two-Factor Authentication Scrapers

Some companies require two-factor authentication, and as such the scraper cannot be fully automated. When using the relevant scrapers, you have two options:

  1. Provide an async callback that knows how to retrieve real time secrets like OTP codes.
  2. When supported by the scraper - provide a "long term token". These are usually available if the financial provider only requires Two-Factor authentication periodically, and not on every login. You can retrieve your long term token from the relevant credit/banking app using reverse engineering and a MITM proxy, or use helper functions that are provided by some Two-Factor Auth scrapers (e.g. OneZero).
import { CompanyTypes, createScraper } from 'israeli-bank-scrapers';
import { prompt } from 'enquirer';

// Option 1 - Provide a callback

const result = await scraper.login({
 email: relevantAccount.credentials.email,
 password: relevantAccount.credentials.password,
 phoneNumber,
 otpCodeRetriever: async () => {
  let otpCode;
  while (!otpCode) {
   otpCode = await questions('OTP Code?');
  }

  return otpCode[0];
 }
});

// Option 2 - Retrieve a long term otp token (OneZero)
await scraper.triggerTwoFactorAuth(phoneNumber);

// OTP is sent, retrieve it somehow
const otpCode='...';

const result = scraper.getLongTermTwoFactorToken(otpCode);
/*
result = {
  success: true;
  longTermTwoFactorAuthToken: 'eyJraWQiOiJiNzU3OGM5Yy0wM2YyLTRkMzktYjBm...';
}
 */

Getting deployed version of latest changes in master

This library is deployed automatically to NPM with any change merged into the master branch.

Israeli-bank-scrapers-core library

TL;DR this is the same library as the default library. The only difference is that it is using puppeteer-core instead of puppeteer which is useful if you are using frameworks like Electron to pack your application.

In most cases you will probably want to use the default library (read Getting Started section).

Israeli bank scrapers library is published twice:

  1. israeli-bank-scrapers - the default variation, great for common usage as node dependency in server application or cli.
  2. israeli-bank-scrapers-core - extremely useful for applications that bundle node_modules like Electron applications.

Differences between default and core variations

The default variation israeli-bank-scrapers is using puppeteer which handles the installation of local chroumium on its' own. This behavior is very handy since it takes care on all the hard work figuring which chromium to download and manage the actual download process. As a side effect it increases node_modules by several hundred megabytes.

The core variation israeli-bank-scrapers-core is using puppeteer-core which is exactly the same library as puppeteer except that it doesn't download chromium when installed by npm. It is up to you to make sure the specific version of chromium is installed locally and provide a path to that version. It is useful in Electron applications since it doesn't bloat the size of the application and you can provide a much friendlier experience like loading the application and download it later when needed.

To install israeli-bank-scrapers-core:

npm install israeli-bank-scrapers-core --save

Getting chromium version used by puppeteer-core

When using the israeli-bank-scrapers-core it is up to you to make sure the relevant chromium version exists. You must:

  1. query for the specific chromium revision required by the puppeteer-core library being used.
  2. make sure that you have local version of that revision.
  3. provide an absolute path to israeli-bank-scrapers-core scrapers.

Please read the following to learn more about the process:

  1. To get the required chromium revision use the following code:
import { getPuppeteerConfig } from 'israeli-bank-scrapers-core';

const chromiumVersion = getPuppeteerConfig().chromiumRevision;
  1. Once you have the chromium revision, you can either download it manually or use other liraries like download-chromium to fetch that version. The mentioned library is very handy as it caches the download and provide useful helpers like download progress information.

  2. provide the path to chromium to the library using the option key executablePath.

Specific definitions per scraper

Bank Hapoalim scraper

This scraper expects the following credentials object:

const credentials = {
  userCode: <user identification code>,
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Bank Leumi scraper

This scraper expects the following credentials object:

const credentials = {
  username: <user name>,
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Discount scraper

This scraper expects the following credentials object:

const credentials = {
  id: <user identification number>,
  password: <user password>,
  num: <user identificaiton code>
};

This scraper supports fetching transaction from up to one year (minus 1 day).

Mercantile scraper

This scraper expects the following credentials object:

const credentials = {
  id: <user identification number>,
  password: <user password>,
  num: <user identificaiton code>
};

This scraper supports fetching transaction from up to one year (minus 1 day).

Known Limitations

  • Missing memo field

Mizrahi scraper

This scraper expects the following credentials object:

const credentials = {
  username: <user identification number>,
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Beinleumi & Massad

These scrapers are essentially identical and expect the following credentials object:

const credentials = {
  username: <user name>,
  password: <user password>
};

Bank Otsar Hahayal scraper

This scraper expects the following credentials object:

const credentials = {
  username: <user name>,
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Visa Cal scraper

This scraper expects the following credentials object:

const credentials = {
  username: <user name>,
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Max scraper (Formerly Leumi-Card)

This scraper expects the following credentials object:

const credentials = {
  username: <user name>,
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Isracard scraper

This scraper expects the following credentials object:

const credentials = {
  id: <user identification number>,
  card6Digits: <6 last digits of card>
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Amex scraper

This scraper expects the following credentials object:

const credentials = {
  username: <user identification number>,
  card6Digits: <6 last digits of card>
  password: <user password>
};

This scraper supports fetching transaction from up to one year.

Yahav

This scraper expects the following credentials object:

const credentials = {
  username: <user name>,
  password: <user password>,
  nationalID: <user national ID>
};

This scraper supports fetching transaction from up to six months.

Beyhad Bishvilha

This scraper expects the following credentials object::

const credentials = {
  id: <user identification number>,
  password: <user password>
};

Known projects

These are the projects known to be using this module:

  • Israeli YNAB updater - A command line tool for exporting banks data to CSVs, formatted specifically for YNAB
  • Israel Finance Telegram Bot - A simple telegram bot that sends notifications about new transactions and interacts with them
  • Caspion - An app for automatically sending transactions from Israeli banks and credit cards to budget tracking apps
  • Finance Notifier - A simple script with the ability to send custom financial alerts to multiple contacts and platforms
  • Moneyman - Automatically save transactions from all major Israeli banks and credit card companies, using GitHub actions (or a self hosted docker image)
  • Firefly iii Importer - A tool to import your banks data into Firefly iii, a free and open source financial manager.

Built something interesting you want to share here? Let me know.

License

The MIT License

israeli-bank-scrapers's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

israeli-bank-scrapers's Issues

Account balance

Went through the docs and inspected the returned objects, couldn't find a way to get the account balance. Is this supported?

Support multiple accounts

In case a scraper can return more than one account from the same bank / credit card web sites, it should be able to return them.

Visa-Cal seems to be broken for few days now

@eshaham

Visa-cal scraper fails for my accounts since the beginning of the month. At the beginning I thought it might be a temporary error as the message indicate, now I'm not that confident about it since it continue to fail. It might be something with my own credentials, although they passes the login phase.

I added the missing handling to catch and notify those errors here #139. I want to check if there is an actual error but this scraper is not using a browser, instead it is using a dedicated rest service of visa cal that is not documented anywhere. what do you think? @nirgin can take a look?

Separate scrappers for it's own lib

what do you think of separate the scrapper in its own lib/repo?
I case of bugs(in scrapper) we'll have the option to rollback only the scrapper older version without changing the lib and other scrapper code.

what do you think about it?

Dependency update stratgy

What do you think is your dependency update strategy?

Probably now you are probably updating just when you need an update for some reason.

What do you think about using a tool like RenovateBot, to keep dependencies up to date?
As most of the code here is being used daily I believe that even without tests we can have good confidence of finding bugs relatively fast.

If we keep dependencies untouched for a long while, there is more chance upgrading would become a pain.

Wonder about your thoughts

Consider returning a serialized response

Hi @eshaham!

When working with israeli-bank-scraper, I prefer to save the results to a JSON file and work with it instead, to avoid being risked in getting my IP blocked the Bank.

Since the scraper returns a Date object in the results, It defers from the serialized cached response and requires an extra step to convert the dates back when deserializing.

I would like to suggest that instead of Date Object, the response will return with Date strings (ISO format)

screen shot 2018-02-03 at 9 33 03 pm

screen shot 2018-02-03 at 9 34 47 pm

What do you think?

I can send a PR if you're interested

Add an extra description property (Memo) for transactions

@eshaham you created an essential project that is missing in the Israeli financial atmosphere! I really liked the way you scaffold the project and provided an infrastructure that is easy to follow and extend.

I'm working on a crawler for the Leumi Bank where they provide an extra field relevant to transfers into your account. This field describe the actual payee and it is an essential field for many transfer transactions like bit, הוראות קבע, salaries, internet wired transfers etc. Bank Hapoalim also exposes this information and I believe it is available for the others banking institutes as-well.

I think the transaction should have an optional field named 'memo' of type string where we can provide this information.

I would appreciate your insights on that matter.
Eran.

transaction information

I found out that Isracard provides more information that currently exposes in the transaction object:

{
      type: string, // can be either 'normal' or 'installments'
      identifier: int, // only if exists
      date: string, // ISO date string
      processedDate: string, // ISO date string
      originalAmount: double,
      originalCurrency: string,
      chargedAmount: double,
      description: string,
      memo: string, // can be null or empty
      installments: {
        number: int, // the current installment number
        total: int, // the total number of installments
      },
      status: string //can either be 'completed' or 'pending'
    }

screen shot 2018-07-26 at 11 48 45 am

I know that other vendors(mostly banks) don't hold this kind of infomation but it looks like super intersting infomation and we can use it to accurate the date objects(from just date to date + time).

Error when providing a start date after previous statement in Leumi Card

When the user provides a start date which occurs after the previous statement in Leumi card, the scraper crashes.
We need to lookup the date of the previous statement and in case it is older than the requested start date, we should not try to fetch NisTransactions and ForeignTransactions, but rather only the future transactions.

Typescript

what do you think about moving to Typescript?

false filtering when setting combineInstallments to false

Hi,

export function filterOldTransactions(txns, startMoment, combineInstallments) {
return txns.filter((txn) => {
const combineNeededAndInitialOrNormal =
combineInstallments && (isNormalTransaction(txn) || isInitialInstallmentTransaction(txn));
return (!combineInstallments && startMoment.isSameOrBefore(txn.processedDate)) ||

when combineInstallments === false the function filterOldTransactions filters the transactions using the processedDate property.

This is function fails to exclude transactions that were processed in a relevant month but were created in a previous month. Is there a reason we cannot always filter by Date?

Thanks
Eran.

The cli values that were used

? What would you like to do? Run an individual scraper
? Which bank would you like to scrape? Leumi Card
? Combine installment transactions? No
? What date would you like to start scraping from? Nov 1, 2017
? Save folder? /Users/eransakal/Downloads/Transactions

Resulted report
image

Leumi bank scraper times out

I'm using the latest version of israeli-ynab-updater which uses israeli-bank-scrapers version 0.5.5.

When I'm trying to scrape Leumi I get the following output:

Bank Leumi: START_SCRAPING
Bank Leumi: INITIALIZING
Bank Leumi: LOGGING_IN
Bank Leumi: TERMINATING
Bank Leumi: END_SCRAPING
success: false
error type: generic
error: waiting failed: timeout 30000ms exceeded

Visa Cal scraper returning error

I'm using the Israeli ynab updater with the latest version of bank scrapers (0.5.3) and I'm getting the following error when trying to use the Visa Cal scraper:

➜  israeli-ynab-updater git:(master) ✗ npm start

> [email protected] start /Users/ifeins/Development/web/israeli-ynab-updater
> babel-node src

? Which bank would you like to scrape? Visa Cal
? Combine installment transactions? Yes
visaCal: START_SCRAPING
visaCal: LOGGING_IN
visaCal: LOGIN_SUCCESS
visaCal: END_SCRAPING
success: false
error type: generic
error: unknown transaction type 7

launch puppeteer browser outside the lib

I found it hard to control the launch command of puppeteer.
I would be super nice If I could pass browser object to createScraper(option) function.

First of all: how do you feel about it❓
as I see it there is couple of options:

option 1 :

  const options = {
    companyId: 'isracard', 
    startDate: '01-06-2018', 
    combineInstallments: false,
    verbose: true, // include more debug info about in the output
    browser: browser,
  };

where browser is const browser = await puppeteer.launch(SomeParams);

option2: createScraper(options,maybeBrowser)

both options will need to something like this:

if(browser !=null) {
  this.browser = browser;
}else {
  this.browser  = await puppeteer.launch();
}

anything else?

Exception when running example

Steps I did in order to check:
$ npm init
$ npm install israeli-bank-scrapers --save

Node version: v10.12.0

It might be trivial, but what am I missing ?

Thanks,
Ramon.

/home/rfried/scraper/index.js:1
(function (exports, require, module, __filename, __dirname) { import { createScraper } from 'israeli-bank-scrapers';
                                                                     ^
SyntaxError: Unexpected token {
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:656:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)

Add a charged currency property to transactions

In some cases when users have a foreign currency account in their banks, transactions in that foreign currency get charged directly against the foreign currency bank account, and conversion to ILS is not needed.

Currently this module always assumes chargedAmount is returned in ILS.
We should introduce a new chargedCurrency property to transactions that will hold the actual currency used.

CI support

we can add Travis CI (free to open source projects) so we'll have default test runs + pr checks

options should supports date range

currently, options object contains only startDate.

given that credit cards (as far as I know) are working by months while bank transactions support date ranges, I'm missing the option to provide endDate or maybe spilt it to credit card vendors(input will be months e.g 07/2018) and date ranges for bank transactions(e.g. 01/01/2018 -
01/02/2018)

Missing dependency while using puppetter

Hi

Tried to build a simple Vue js project to run the scraper at the click of a button and got the following error:
This dependency was not found:

  • readline in ./node_modules/puppeteer/lib/Launcher.js, ./node_modules/puppeteer/node6/lib/Launcher.js

I understand that you are using this library also and you are not the owner but i'm unable to use your package due to this problem
Are you familiar with this one ?

Support providing a different log level

The user should be able to pass a different log level in the options object.
This log level should be respected throughout notifications in the scrapers, and also passed along to the phantom object.

scrape charged currency for credit cards

We are missing charged currency when scraping credit cards. This information is needed as the user can choose whether to link his credit card to local bank account or foreign bank account. Without charged currency the value of charged amount means nothing.

I implemented that support for leumi card scraper in branch charged-currency. the following shows the scraping of my card from with support to all 3 use cases (ILS->ILS, USD->ILS, USD->USD):
image

@eshaham, If you find it relevant we can use that branch to add support for other cards. wdyt?

Mizrahi Tefahot scraping brainstorming

Hi,

I've tried to reverse engineer scraping of Mizrahi.

They work with the stupid dot net session thing.

Couldn't find a way to do proper scraping. Anyone here tried to scrape them?

Leumi Card Error: unknown transaction type

node.js terminates after multiple leumi-card module returns error code:
(node:4061) UnhandledPromiseRejectionWarning:
Error: unknown transaction type חודשי + ריבית

leumi-card.co.il shows regular transactions abroad as "חודשי + ריבית"
For trying to temporarily debug the issue, changing the variable (line 177) on the leumi-card.js generated module to:
var MONTHLY_CHARGE_TYPE_NAME = 'חודשי + ריבית';
confirmed working with no issue.

I suggest adding another transaction type, rebuilding the transaction types scheme, or including "חודשי + ריבית" as well as "רגילה" to the NORMAL_TYPE_NAME transaction name in the leumi-card module.

Btw, nice project idea!

Status property

Sometimes, recent transactions may change.

For example, in Bank Hapoalim, transactions above the fold are still "pending":
screen shot 2018-01-25 at 9 30 46 pm

Having a status field will be useful to differentiate between pending and posted transactions

Example for Bank Hapoalim:

status: txn.serialNumber === 0 ? 'pending' : 'posted'

Leumi Card scrapper stopped working

I get the following error. Seems like it logs in ok but the return value after login is not recgnized:
Leumi Card: START_SCRAPING
Leumi Card: INITIALIZING
Leumi Card: LOGGING_IN
Leumi Card: TERMINATING
Leumi Card: END_SCRAPING
success: false
error type: generic
error: unexpected login result "undefined"
Error: unexpected login result "undefined"
at /Users/bsorek/Dev/git/personal/bankapp/israeli-ynab-updater/src/scrape/scrape-base.js:62:11
at Generator.next ()
at step (/Users/bsorek/Dev/git/personal/bankapp/israeli-ynab-updater/src/scrape/scrape-base.js:47:191)
at /Users/bsorek/Dev/git/personal/bankapp/israeli-ynab-updater/src/scrape/scrape-base.js:47:361
(node:7970) UnhandledPromiseRejectionWarning: Error: unexpected login result "undefined"
at /Users/bsorek/Dev/git/personal/bankapp/israeli-ynab-updater/src/scrape/scrape-base.js:62:11
at Generator.next ()
at step (/Users/bsorek/Dev/git/personal/bankapp/israeli-ynab-updater/src/scrape/scrape-base.js:47:191)
at /Users/bsorek/Dev/git/personal/bankapp/israeli-ynab-updater/src/scrape/scrape-base.js:47:361
(node:7970) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:7970) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Leumi card login result undefined

Hello

When I try to use a simple code to read the transactions from Leumi card.
I get an error "'unexpected login result "undefined"'"

Code
it is surrond by an iife to be able to run the await
and the credentials are initialize correctly (same as your example)
image

The error:
image

Can you please find the reason for this?

Getting extra input from the user

I'm working on the business version of Hapoalim.

I got it all running locally including getting the foreign and credit card transactions

The thing is, that in a business account once you have a successful login they send you SMS with a code.
I've added a command prompt locally to get it working easily for me, but I wonder what would you think would be the best way to add something like that in the current way the code and the login flow is set up?

thanks

Account summary alongside the transactions data

My use case, for now, of using this library is getting all of my finance information in one place. For this matter, transactions data is less important for me, but accounts summaries are more useful. e.g. getting the current balance of my bank account(s), or knowing the my expected credit card(s) charge for this month.
Is this something this project willing to include?
I already wrote a code for myself for Bank Hapoalim and Leumi Card with new properties of 'balance' (in the case of the bank) and 'charge' (in the case of the credit card), in the returned object (alongside the success and txns properties).

In a related manner, what about investing data?
I have an Intergemel account, and I'm finding it useful to get data of "what my money did today" for it. I can contribute code for handling Intergemel accounts, with basic information about the type of account, its number, its nick name and its current balance of each of the customer accounts.

Leumi Card - unknown transaction type

Hi

I think you are missing a transaction type for Leumi Card.
I get the following error :
{"success":false,"errorType":"generic","errorMessage":"unknown transaction type עסקת 30 פלוס\t"}

TypeError: createScraper is not a function

Hi

Tried to run the code and got the error
TypeError: createScraper is not a function

Adding my code:
`const createScraper = require('israeli-bank-scrapers');

const express = require('express');
const app = express();
const port = 3000;

app.get('/', (request, response) => {
connect();
response.send('Hello from Express!')

});

app.listen(port, (err) => {
if (err) {
return console.log('something bad happened', err)
}

console.log(server is listening on ${port})
});

async function connect() {
const credentials = {
userCode: 'aaa',
password: 'aaa'
}; // different for each bank
const options = {companyId: 'leumi'};
const scraper = createScraper(options);
const scrapeResult = await scraper.scrape(credentials);

if (scrapeResult.success) {
scrapeResult.accounts.forEach((account) => {
console.log(found ${account.txns.length} transactions for account number ${account.accountNumber});
});
}
else {
console.error(scraping failed for the following reason: ${scrapeResult.errorType});
}
}`

Credit funding on credit cards

Hi,

I'm planning to use this library for accounting automation.

In order to do accounting automation, you need to include the transactions that come from your bank account.

For most of you it's on a fixed date. For businesses it might be several times a months, to release some credit in the card.

I'm planning to add this feature to Amex/Mastercard.

Since it's not my project, I wanna know what @eshaham thinks of that, and how we can embed it, without hurting his vision about the project.

I was thinking about adding some sort of an option.

What do you think?

Multiple accounts for Bank Hapoalim scarper

Hi,

I'm looking into implementing multiple acounts for Bank Hapoalim scarper, but I couldn't get data for accounts other than the primary one.
Currently the scarper uses this url to get transactions data:
${apiSiteUrl}/current-account/transactions?accountId=${accountNumber}&numItemsPerPage=150&retrievalEndDate=${endDateStr}&retrievalStartDate=${startDateStr}&sortCode=1
And I couldn't succeeded using it with other accounts.
Maybe @sebikaplun know how to crack it?

Besides that, I'm trying to implement account summary for the scraper. I guess with access to every account, the balance of every account will be located in the last transaction. But what about the credit limit of the account?
Again, @sebikaplun , do you have any idea, beside browser scarping?

LeumiCard scraper fails on v0.5.2

The LeumiCard scarper fails with version 0.5.2 of israeli-bank-scrapers

It throws TypeError: Cannot read property 'timeout' of undefined when trying to log in.

I dag into the code and found that the error is originally thrown by waitUntil, but swallowed by its catch block on line 25:

function wait() {
asyncTest().then((value) => {
if (value === true) {
resolve();
} else {
setTimeout(wait, interval);
}
}).catch(() => {
reject();
});
}

The original error message is: Cannot find context with specified id undefined
Which seems related to puppeteer/puppeteer#1325

My first attempt was to downgrade puppeteer back to 0.13.0 but it does not solve the problem.
Using version 0.5.1 of israeli-bank-scrapers did, so it has to be some other recent change.
Here's the diff between the two versions, could be related to the transition from "id" to "selector"?

Here's the full diff: v0.5.1...master

I made a simple test case to demonstrate the bug:

const { createScraper } = require('israeli-bank-scrapers');

async function run () {
  const scraperName = 'leumiCard';

  const scraper = createScraper({
    companyId: 'leumiCard',
    verbose: true
  });

  const credentials = {
    username: '<user name>',
    password: '<user password>'
  };

  scraper.onProgress((companyId, payload) => {
    console.log(`${companyId}: ${payload.type}`);
  });

  let scapeResults;
  try {
    scapeResults = await scraper.scrape(credentials);
  } catch (e) {
    // fails with TypeError: Cannot read property 'timeout' of undefined
    console.error(e);
    return;
  }

  console.log(scapeResults)
}

run();

Leumi card scrapers fails to report errors during scraping

await page.goto(url);
const txns = await getCurrentTransactions(page);

Bug Overview

the scraper currently ignore failures for line 234 goto command, resulting with "valid" scraping of 0 transactions instead of failing the process.

Reproduce Scenario

change the value of the url to invalid value, for example path: 'Registred/Transactions/invalid-page-name.aspx

path: 'Registred/Transactions/ChargesDeals.aspx',

Expected result

an error should be thrown, stopping the process and providing informative information about the error.

Actual result

the process complete with status success as shown here
image

and the resulted csv file content is:
image

Leumi-card scraper ends with error

Leumi Card: START_SCRAPING
Leumi Card: INITIALIZING
Leumi Card: LOGGING_IN
Leumi Card: LOGIN_SUCCESS
Leumi Card: TERMINATING
Leumi Card: END_SCRAPING
success: false
error type: generic
error: Unknown transaction type קרדיט

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.