Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Feature/improve handling of scraper configuration (#757)
Thomas Kaul4826a51199a8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex f2c8aff604..ce8e7faca5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).+## Unreleased++### Changed++- Improved the error handling in the scraper configuration+## 1.126.0 - 14.03.2022### Addeddiff --git a/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts b/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.tsindex 35c53bc7a0..bd126e2358 100644--- a/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts+++ b/apps/api/src/services/data-provider/ghostfolio-scraper-api/ghostfolio-scraper-api.service.ts@@ -50,16 +50,18 @@ export class GhostfolioScraperApiService implements DataProviderInterface {const [symbolProfile] = await this.symbolProfileService.getSymbolProfiles([symbol]);- const scraperConfiguration = symbolProfile?.scraperConfiguration;+ const { selector, url } = symbolProfile.scraperConfiguration;- const get = bent(scraperConfiguration?.url, 'GET', 'string', 200, {});+ if (selector === undefined || url === undefined) {+ return {};+ }++ const get = bent(url, 'GET', 'string', 200, {});const html = await get();const $ = cheerio.load(html);- const value = this.extractNumberFromString(- $(scraperConfiguration?.selector).text()- );+ const value = this.extractNumberFromString($(selector).text());return {[symbol]: {