1.1.2 • Published 7 years ago

request-url-open-graph v1.1.2

Weekly downloads
5
License
GNU GPLv2
Repository
github
Last release
7 years ago

request-url-open-graph

Build status

Returns an open graph protocol for a web page.

Support

Getting started

Install

npm i request-url-open-graph --save

or

npm install request-url-open-graph -g

Get Open Graph

URL

const urlOpenGraph = require('request-url-open-graph');

urlOpenGraph({url: 'http://bit.ly/2gR95sb'}, (oError, oTags) => {
	console.log(oTags)
});

HTML Content

const urlOpenGraph = require('request-url-open-graph');

urlOpenGraph({contentHTML: '<html>...</html>'}, (oError, oTags) => {
	console.log(oTags)
});

CLI

You can view Open Graph without leaving the terminal.

request-url-open-graph fetch --url=http://bit.ly/2hpP7rY

Result

{
  "description": "I remember when I, a few months ago, needed to learn how to write JavaScript web applications using Express, NodeJS and PostgreSQL as my...",
  "card": "summary_large_image",
  "site": "@scotch_io",
  "creator": "",
  "title": "Getting Started with Node, Express and Postgres Using Sequelize",
  "url": "https://scotch.io/tutorials/getting-started-with-node-express-and-postgres-using-sequelize",
  "type": "article",
  "image": [
    {
      "url": "https://scotch.io/wp-content/uploads/2016/12/nrMHOlRR6imGBoKkDZLJ_getting-started-with-node-express-postgres-sequelize.png.jpg"
    }
  ]
}