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
parent
commit
3fcd611e29
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 14
      apps/api/src/services/data-provider/manual/manual.service.ts

1
CHANGELOG.md

@ -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`)

14
apps/api/src/services/data-provider/manual/manual.service.ts

@ -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
});
}
}

Loading…
Cancel
Save