Package Exports
- open-graph
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (open-graph) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Open Graph for Node.js
An Open Graph implementation for Node.js. Simple to use; give it a URL and it'll give you the open graph meta properties scraped from that URL.
Install
npm install open-graph
Usage
const og = require('open-graph');
const url = 'http://github.com/samholmes/node-open-graph/raw/master/test.html';
og(url, function (err, meta) {
console.log(meta);
});
Outputs:
{
title: 'OG Testing',
type: 'website',
url: 'http://github.com/samholmes/node-open-graph/raw/master/test.html',
site_name: 'irrelavent',
description: 'This is a test bed for Open Graph protocol.',
image: {
url: 'http://google.com/images/logo.gif',
width: '100',
height: '100'
}
}
Todo
- Better parser Meta data should be parsed into pure JSON and arrays should be handled at root nodes, not leaf nodes
- Better data types Convert properties to numbers, etc.
- Fallback data If Open Graph data isn't present, scrap img elements and document titles off the page.