# open-graph

> An Open Graph implementation for Node.js.

Latest version **0.2.6** (published 2021-08-03) · BSD license · 0 weekly downloads

## Install

```sh
npm install open-graph
pnpm add open-graph
yarn add open-graph
bun add open-graph
```

## Health

**Score 33/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.2.6 |
| Published | 2021-08-03 |
| First published | 2013-08-16 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | separate (@types/open-graph) |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 79 |
| Author | Sam Holmes |
| Maintainers | samholmes |
| Keywords | open graph, open, graph, opengraph, og |

## Links

- npm: https://www.npmjs.com/package/open-graph
- Repository: https://github.com/samholmes/node-open-graph
- Homepage: https://github.com/samholmes/node-open-graph#readme
- Issues: https://github.com/samholmes/node-open-graph/issues
- npm.io page: https://npm.io/package/open-graph

## Dependencies (2)

- [cheerio](https://npm.io/package/cheerio.md) ^0.22.0
- [request](https://npm.io/package/request.md) ^2.73.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.2.6 (latest) — 2021-08-03
- 0.2.4 — 2018-11-05
- 0.2.3 — 2017-03-07
- 0.2.2 — 2016-11-14
- 0.2.1 — 2016-09-28
- 0.2.0 — 2016-09-28
- 0.1.7 — 2016-08-25
- 0.1.6 — 2016-07-09
- 0.1.5 — 2014-10-08
- 0.1.4 — 2013-08-17
- 0.1.3 — 2013-08-17
- 0.1.2 — 2013-08-17
- 0.1.1 — 2013-08-17
- 0.1.0 — 2013-08-16

## README

# Open Graph for Node.js

An [Open Graph](http://ogp.me/) 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

```js
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:

```js
{
  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.

---
_Source: https://npm.io/package/open-graph · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
