Browse Source
Feature/extend selector handling of scraper for more use cases (#5047)
* Extend selector handling for more use cases
* Update changelog
pull/5048/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
14 additions and
1 deletions
-
CHANGELOG.md
-
apps/api/src/services/data-provider/manual/manual.service.ts
|
|
@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Extended the selector handling of the scraper configuration for more use cases |
|
|
|
- Changed `node main` to `exec node main` in the `entrypoint.sh` file to improve the container signal handling |
|
|
|
- Improved the language localization for Catalan (`ca`) |
|
|
|
- Improved the language localization for Dutch (`nl`) |
|
|
|
|
|
@ -303,9 +303,21 @@ export class ManualService implements DataProviderInterface { |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
|
let value = $(scraperConfiguration.selector).first().text(); |
|
|
|
|
|
|
|
const lines = value?.split('\n') ?? []; |
|
|
|
|
|
|
|
const lineWithDigits = lines.find((line) => { |
|
|
|
return /\d/.test(line); |
|
|
|
}); |
|
|
|
|
|
|
|
if (lineWithDigits) { |
|
|
|
value = lineWithDigits; |
|
|
|
} |
|
|
|
|
|
|
|
return extractNumberFromString({ |
|
|
|
locale, |
|
|
|
value: $(scraperConfiguration.selector).first().text() |
|
|
|
value |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|