maxun-core 0.0.31 → 0.0.32
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.
- package/build/interpret.js +7 -1
- package/package.json +1 -1
package/build/interpret.js
CHANGED
|
@@ -399,7 +399,13 @@ class Interpreter extends events_1.EventEmitter {
|
|
|
399
399
|
return;
|
|
400
400
|
}
|
|
401
401
|
yield this.ensureScriptsLoaded(page);
|
|
402
|
-
const
|
|
402
|
+
const normalizedSchema = Object.fromEntries(Object.entries(schema).map(([key, value]) => [
|
|
403
|
+
key,
|
|
404
|
+
typeof value === 'string'
|
|
405
|
+
? { selector: value, tag: '', attribute: 'innerText', shadow: '' }
|
|
406
|
+
: value,
|
|
407
|
+
]));
|
|
408
|
+
const scrapeResult = yield page.evaluate((schemaObj) => window.scrapeSchema(schemaObj), normalizedSchema);
|
|
403
409
|
if (!this.cumulativeResults || !Array.isArray(this.cumulativeResults)) {
|
|
404
410
|
this.cumulativeResults = [];
|
|
405
411
|
}
|