html-extract-meta

2.0.0 • Public • Published

html-meta-meta

The inverse of html-inject-meta

Example

const extract = require('html-extract-meta')
process.stdin.pipe(extract(onMeta))
process.stdin.resume()

function onMeta(err, meta) {
  ...
}

API

extract(cb) returns a transparent trhough stream (its output is the same as its input). Upon having seen the <head> tag in the input, it calls cb(err, meta), where meta has these propertues:

  • name
  • description
  • author
  • generator (coming from <meta name="generator">
  • http (an object with http headers coming from <meta http-equiv> tags

If there are meta tags with name or property attributes containing a colon (:), they are considered "namespaced meta tags" and occur in meta.namespaced. For example, <meta name="twitter:creator" conent="regular"/> shows up as meta.namespaced.twitter.ceator

CLI

html-extract-meta < in.html > out.json [--through]

Reads html from stdin and outputs meta json to stdout. if --through is given, outputs meta json to stderr and outputs html to stdout.

License: MIT

Readme

Keywords

none

Package Sidebar

Install

npm i html-extract-meta

Weekly Downloads

6

Version

2.0.0

License

MIT

Unpacked Size

9.91 kB

Total Files

8

Last publish

Collaborators

  • regular