Browse Source
Bugfix/fix exception in scraper configuration (#4196)
* Fix exception in scraper configuration
* Update changelog
pull/4197/head
Thomas Kaul
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
26 additions and
27 deletions
-
CHANGELOG.md
-
apps/api/src/services/data-provider/manual/manual.service.ts
|
|
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed an issue with the renaming of activities with type `FEE`, `INTEREST`, `ITEM` or `LIABILITY` |
|
|
|
- Handled an exception in the scraper configuration introduced by the migration from `got` to `fetch` |
|
|
|
|
|
|
|
## 2.133.1 - 2025-01-09 |
|
|
|
|
|
|
|
|
|
@ -273,8 +273,8 @@ export class ManualService implements DataProviderInterface { |
|
|
|
private async scrape( |
|
|
|
scraperConfiguration: ScraperConfiguration |
|
|
|
): Promise<number> { |
|
|
|
try { |
|
|
|
let locale = scraperConfiguration.locale; |
|
|
|
|
|
|
|
const response = await fetch(scraperConfiguration.url, { |
|
|
|
headers: scraperConfiguration.headers as HeadersInit, |
|
|
|
signal: AbortSignal.timeout( |
|
|
@ -282,8 +282,9 @@ export class ManualService implements DataProviderInterface { |
|
|
|
) |
|
|
|
}); |
|
|
|
|
|
|
|
if (response.headers['content-type'].includes('application/json')) { |
|
|
|
if (response.headers['content-type']?.includes('application/json')) { |
|
|
|
const data = await response.json(); |
|
|
|
|
|
|
|
const value = String( |
|
|
|
jsonpath.query(data, scraperConfiguration.selector)[0] |
|
|
|
); |
|
|
@ -303,8 +304,5 @@ export class ManualService implements DataProviderInterface { |
|
|
|
value: $(scraperConfiguration.selector).first().text() |
|
|
|
}); |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
throw error; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|