Skip to content

Latest commit

 

History

History
59 lines (37 loc) · 1.49 KB

README.md

File metadata and controls

59 lines (37 loc) · 1.49 KB

Metadata Parser

Request an http(s) url and scrape its metadata. It requires node-html-parser

Build Status

Install

npm install url-metadata-parser

Usage

Promise-based:

import {UrlMetadataParser} from 'url-metadata-parser';
UrlMetadataParser.parse('https://www.google.com').toPromise().then(metadata => {
  const description = metadata.getContentByPropertyName('description');
  console.log('Here, Google website description', description);
});

Observable-based:

UrlMetadataParser.parse('https://www.google.com').subscribe(metadata => {
  const description = metadata.getContentByPropertyName('description');
  console.log('Here, Google website description', description);
});

API

  • getContentByPropertyName(propertyName: string)
  • getContentByName(name: string)
  • getNameByContent(content: string)

Where do I go for help?

If you need, open an issue.

Tests

npm test runs the jest tests.

npm run-script coverage runs the tests and reports code coverage.

Contributing

If you want to contribute to the project (awesome!!), just pull request.