Skip to content

Commit

Permalink
refactor: pass uri to cheerio (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Feb 27, 2023
1 parent 51d0d1e commit 340a15b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Binary file modified packages/metascraper-manifest/test/snapshots/index.js.snap
Binary file not shown.
6 changes: 3 additions & 3 deletions packages/metascraper/src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict'

const { isUrl } = require('@metascraper/helpers')
const { load } = require('cheerio')
const whoops = require('whoops')

const { loadRules, mergeRules } = require('./rules')
const loadHTML = require('./load-html')
const getData = require('./get-data')

const MetascraperError = whoops('MetascraperError')
Expand All @@ -13,7 +13,7 @@ module.exports = rules => {
const loadedRules = loadRules(rules)
return async ({
url,
html,
html = '',
rules: inlineRules,
validateUrl = true,
...props
Expand All @@ -27,7 +27,7 @@ module.exports = rules => {

return getData({
url,
htmlDom: loadHTML(html),
htmlDom: load(html, { baseURI: url }),
rules: mergeRules(inlineRules, loadedRules),
...props
})
Expand Down
5 changes: 0 additions & 5 deletions packages/metascraper/src/load-html.js

This file was deleted.

0 comments on commit 340a15b

Please sign in to comment.