@dkh-dev/html-metadata-parser
v1.0.0
Published
HTML Metadata Parser
Downloads
3
Readme
html-metadata-parser
HTML Metadata Parser
Parser rules from mozilla/page-metadata-parser.
Installation
npm install @dkh-dev/html-metadata-parser
Examples
'use strict'
const { parse } = require('@dkh-dev/html-metadata-parser')
const url = 'https://github.com/'
const html = `
<!DOCTYPE html>
<html>
<head>
<title>GitHub</title>
<meta name="description" content="GitHub is where people build software.">
</head>
<!-- ... -->
</html>`
const main = async () => {
const metadata = await parse(url, html)
console.log(metadata)
// => {
// url: 'https://github.com/',
// icon: 'https://github.com/favicon.ico',
// provider: 'github.com',
// title: 'GitHub',
// description: 'GitHub is where people build software.'
// }
}
main()