mozilla / page-metadata-parser

DEPRECATED - A Javascript library for parsing metadata on a web page.
https://www.npmjs.com/package/page-metadata-parser
Mozilla Public License 2.0
270 stars 42 forks source link

Possible documentation issue #105

Closed imikemiller closed 5 years ago

imikemiller commented 5 years ago

This didnt work for me:

const {getMetadata} = require('page-metadata-parser');

const url = 'https://github.com/mozilla/page-metadata-parser';
const response = await fetch(url);
const html = await response.text();
const doc = new JSDOM(html);
const metadata = getMetadata(doc, url);

I need to pass doc.window.document to the getMetaData call. Working code is:

const {getMetadata} = require('page-metadata-parser');

const url = 'https://github.com/mozilla/page-metadata-parser';
const response = await fetch(url);
const html = await response.text();
const dom = new JSDOM(html);
const metadata = getMetadata(dom.window.document, url); //changed this call
jaredlockhart commented 5 years ago

Thanks for pointing this out @imikemiller! You're right I had switched away from using jsdom for domino but didn't update the docs. Fixed now, let me know if you have any other issues with the library.