Skip to content

Commit

Permalink
Add scrapeHtml function in scraper
Browse files Browse the repository at this point in the history
  • Loading branch information
Totalus committed Dec 18, 2021
1 parent 1c98184 commit 21d4186
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,14 @@ export function scrapeElement(htmlElement, template) {
}


export function scrapeHtml(html, template) {
const dom = new JSDOM(html);

if(!dom)
return null;

return scrapeElement(dom.window.document, template);
}

export function scrapeUrl(url, template) {
return new Promise(async (resolve, reject) => {
Expand Down

0 comments on commit 21d4186

Please sign in to comment.