פרויקט התממשקות עם הבנק
-
בהמשך להודעה של @Avi_av לגבי הקוד פתוח להתממשקות עם הבנק, שינסתי מותני ונכנסתי בעומק סוגיית NODEJS.
אבל יש בעיות, ואשמח לעזרה
התקנתי את החבילה, בפקודה
npm install israeli-bank-scrapers --save
אבל זה מחזיר לי שגיאה
ERROR: Failed to download Chromium r637110! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download. { Error: unable to verify the first certificate at TLSSocket.onConnectSecure (_tls_wrap.js:1051:34) at TLSSocket.emit (events.js:189:13) at TLSSocket._finishInit (_tls_wrap.js:633:8) -- ASYNC -- at BrowserFetcher.<anonymous> (D:\dev\nodejs\node_modules\puppeteer\lib\helper.js:108:27) at Object.<anonymous> (D:\dev\nodejs\node_modules\puppeteer\install.js:64:16) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12) at Function.Module._load (internal/modules/cjs/loader.js:531:3) at Function.Module.runMain (internal/modules/cjs/loader.js:754:12) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3) code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' } npm WARN enoent ENOENT: no such file or directory, open 'D:\dev\nodejs\package.json' npm WARN nodejs No description npm WARN nodejs No repository field. npm WARN nodejs No README data npm WARN nodejs No license field. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! puppeteer@1.13.0 install: `node install.js` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the puppeteer@1.13.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\ShowF\AppData\Roaming\npm-cache\_logs\2019-03-06T09_11_14_371Z-debug.log
אולי הבעייה בנטפרי
התקנתי על השרת, והחזיר שגיאהChromium downloaded to /root/node_modules/puppeteer/.local-chromium/linux-637110 npm WARN saveError ENOENT: no such file or directory, open '/root/package.json' npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN enoent ENOENT: no such file or directory, open '/root/package.json' npm WARN root No description npm WARN root No repository field. npm WARN root No README data npm WARN root No license field.
אבל כשאני מריץ את הסקריפט הבא
import { createScraper } from 'israeli-bank-scrapers'; const credentials = { username: <'******'>, password: <'******'> }; const options = { companyId: 'leumi', // mandatory; one of 'hapoalim', 'leumi', 'discount', 'otsarHahayal', 'visaCal', 'leumiCard', 'isracard', 'amex' // startDate: Date, // the date to fetch transactions from (can't be before the minimum allowed time difference for the scraper) combineInstallments: false, // if set to true, all installment transactions will be combine into the first one showBrowser: true, // shows the browser while scraping, good for debugging (default false) verbose: true // include more debug info about in the output }; 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}`); }
זה מחזיר לי
(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:657:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19)
לא לזלזל, אני עושה היכרות עם NODEJS...
-
תודה
עכשיו השגיאה היאusername: <*****>, ^ 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:657:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19)
-
אוקיי הבנתי את כוונתך, הייתי צריך למחוק את ה<>
אז מחקתי ועכשיו יש שגיאהconst scrapeResult = await scraper.scrape(credentials); ^^^^^ SyntaxError: await is only valid in async function 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:657:28) at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3) at Function.Module.runMain (internal/modules/cjs/loader.js:742:12) at startup (internal/bootstrap/node.js:283:19)
-
תודה רבה התקדמנו לשגיאה הבאה..
מקווה שאני לא משגע אותך(node:28869) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome! /root/node_modules/puppeteer/.local-chromium/linux-637110/chrome-linux/chrome: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md at onClose (/root/node_modules/puppeteer/lib/Launcher.js:342:14) at Interface.helper.addEventListener (/root/node_modules/puppeteer/lib/Launcher.js:331:50) at Interface.emit (events.js:187:15) at Interface.close (readline.js:379:8) at Socket.onend (readline.js:157:10) at Socket.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12) at process._tickCallback (internal/process/next_tick.js:63:19) (node:28869) 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:28869) [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.
-
@yossiz תודה
@WWW כעשרים שניות בערך. אני מאמין שבלינוקס זה יותר מהריש עדיין שגיאה בלינוקס
(node:1306) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome! [1317:1317:0306/124807.187852:ERROR:zygote_host_impl_linux.cc(89)] Running as root without --no-sandbox is not supported. See https://crbug.com/638180. TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md at onClose (/root/node_modules/puppeteer/lib/Launcher.js:342:14) at Interface.helper.addEventListener (/root/node_modules/puppeteer/lib/Launcher.js:331:50) at Interface.emit (events.js:187:15) at Interface.close (readline.js:379:8) at Socket.onend (readline.js:157:10) at Socket.emit (events.js:187:15) at endReadableNT (_stream_readable.js:1094:12) at process._tickCallback (internal/process/next_tick.js:63:19) (node:1306) 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:1306) [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.
אני רואה שיש דף בגיטהב של troubleshooting, לא הבנתי הכל שמה אבל אני מנסה לאט לאט
-
נכון
אז עברתי ליוזר אחר, והגיעה שגיאה חדשה..(node:2056) UnhandledPromiseRejectionWarning: Error: Failed to launch chrome! MobaXterm X11 proxy: Unsupported authorisation protocol (chrome:2067): Gtk-WARNING **: 12:58:14.700: cannot open display: localhost:11.0
-
@dovid לפי ההוראות שלך:
const createScraper = require('israeli-bank-scrapers').createScraper; const credentials = { userCode: '123456', password: '7890123' }; const options = { companyId: 'hapoalim', // mandatory; one of 'hapoalim', 'leumi', 'discount', 'otsarHahayal', 'visaCal', 'leumiCard', 'isracard', 'amex' //startDate: Date, // the date to fetch transactions from (can't be before the minimum allowed time difference for the scraper) combineInstallments: false, // if set to true, all installment transactions will be combine into the first one //showBrowser: true, // shows the browser while scraping, good for debugging (default false) verbose: true // include more debug info about in the output }; const scraper = createScraper(options); scraper.scrape(credentials).then(function(scrapeResult) { 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}`); } });
נסיתי גם username לפנ"כ ואותה שגיאה.