Skip to content
/ rog Public
forked from 1000ch/rog

Retrieve open graph data from passing URL.

Notifications You must be signed in to change notification settings

cathcheeno/rog

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rog Build Status Dependency Status

Retrieve open graph data from passing URL.

Installation

$ npm i rog

Usage

const rog = require('rog');

rog('http://google.com').then(data => {
  console.log(data.title);       // => <meta property="og:title" content="...">
  console.log(data.type);        // => <meta property="og:type" content="...">
  console.log(data.url);         // => <meta property="og:url" content="...">
  console.log(data.image);       // => <meta property="og:image" content="...">
  console.log(data.site);        // => <meta property="og:site" content="...">
  console.log(data.description); // => <meta property="og:description" content="...">
  console.log(data.locale);      // => <meta property="og:locale" content="...">
}).catch(error => {
  console.error(error);
});

It will retrieve alternative data if <meta property="og:..."> does not exist. For example, if <meta property="og:url" content="..."> does not exist, it will retrieve <meta name="twitter:url"> or <link rel="canonical">.

License

MIT: http://1000ch.mit-license.org

About

Retrieve open graph data from passing URL.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%