Socket
Socket
Sign inDemoInstall

open-graph

Package Overview
Dependencies
2
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    open-graph

An Open Graph implementation for Node.js.


Version published
Weekly downloads
1.8K
decreased by-19.44%
Maintainers
1
Install size
4.77 MB
Created
Weekly downloads
 

Readme

Source

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

  1. Better parser Meta data should be parsed into pure JSON and arrays should be handled at root nodes, not leaf nodes
  2. Better data types Convert properties to numbers, etc.
  3. Fallback data If Open Graph data isn't present, scrap img elements and document titles off the page.

Keywords

FAQs

Last updated on 03 Aug 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc