@xcrap/extractor 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -60,7 +60,10 @@ class HtmlExtractionModel {
|
|
|
60
60
|
else {
|
|
61
61
|
const element = (0, utils_1.selectFirstElement)(value.query, root);
|
|
62
62
|
if (!element) {
|
|
63
|
-
|
|
63
|
+
if (value.default === undefined) {
|
|
64
|
+
throw new errors_1.HTMLElementNotFoundError(value.query);
|
|
65
|
+
}
|
|
66
|
+
return value.default;
|
|
64
67
|
}
|
|
65
68
|
const source = value.extractor ? (await value.extractor(element)) : element.outerHTML;
|
|
66
69
|
const data = await value.model.extract(source);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xcrap/extractor",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Xcrap Extractor is a package of the Xcrap framework, it was developed to take care of the data extraction part of text files (currently supporting only HTML, JSON and Markdown) using declarative models.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xcrap",
|