metascraper-readability 5.49.25 → 5.50.1

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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/index.js +1 -11
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "metascraper-readability",
3
3
  "description": "A Readability connector for metascraper",
4
4
  "homepage": "https://github.com/microlinkhq/metascraper/packages/metascraper-readability",
5
- "version": "5.49.25",
5
+ "version": "5.50.1",
6
6
  "types": "src/index.d.ts",
7
7
  "main": "src/index.js",
8
8
  "author": {
@@ -23,7 +23,7 @@
23
23
  "readability"
24
24
  ],
25
25
  "dependencies": {
26
- "@metascraper/helpers": "5.49.25",
26
+ "@metascraper/helpers": "5.50.1",
27
27
  "@mozilla/readability": "~0.6.0",
28
28
  "async-memoize-one": "~1.1.9",
29
29
  "happy-dom": "~20.3.4"
@@ -44,5 +44,5 @@
44
44
  "ava": {
45
45
  "timeout": "15s"
46
46
  },
47
- "gitHead": "b656312fda1e8c1cd65b4e92cdf9713a16cfdd3b"
47
+ "gitHead": "688ff08cd5618a0fd9afa55e31552e95136814f2"
48
48
  }
package/src/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const { memoizeOne, composeRule } = require('@metascraper/helpers')
3
+ const { memoizeOne, composeRule, getHtml } = require('@metascraper/helpers')
4
4
  const { Readability } = require('@mozilla/readability')
5
5
  const asyncMemoizeOne = require('async-memoize-one')
6
6
  const { Window } = require('happy-dom')
@@ -41,16 +41,6 @@ const readability = asyncMemoizeOne(async (url, html, readabilityOpts) => {
41
41
  }
42
42
  }, memoizeOne.EqualityFirstArgument)
43
43
 
44
- const htmlCache = new WeakMap()
45
-
46
- const getHtml = htmlDom => {
47
- if (!htmlCache.has(htmlDom)) {
48
- htmlCache.set(htmlDom, htmlDom.html())
49
- }
50
-
51
- return htmlCache.get(htmlDom)
52
- }
53
-
54
44
  module.exports = ({ readabilityOpts } = {}) => {
55
45
  const getReadbility = composeRule(($, url) =>
56
46
  readability(url, getHtml($), readabilityOpts)