We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a690a6e commit c2ad884Copy full SHA for c2ad884
packages/metascraper-readability/index.js
@@ -3,12 +3,16 @@
3
const { createValidator } = require('@metascraper/helpers')
4
const Readability = require('readability')
5
const memoizeOne = require('memoize-one')
6
-const { JSDOM } = require('jsdom')
+const jsdom = require('jsdom')
7
+
8
+const { JSDOM } = jsdom
9
10
const memoFn = (newArgs, oldArgs) => newArgs[0].url === oldArgs[0].url
11
12
+const virtualConsole = new jsdom.VirtualConsole()
13
14
const readability = memoizeOne(({ htmlDom, url }) => {
- const dom = new JSDOM(htmlDom.html(), { url })
15
+ const dom = new JSDOM(htmlDom.html(), { virtualConsole, url })
16
const reader = new Readability(dom.window.document)
17
return reader.parse()
18
}, memoFn)
0 commit comments