A minimal library to fetch Open Graph metadata from URLs. Version 1.0.37, released under MIT. It works in both Node.js and browser environments with ESM and CJS support. Returns a flat object with og: and twitter: properties, plus image and url shortcuts. No dependencies. Suitable for server-side or client-side scraping of social meta tags.
npm install fetch-opengraphNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to fetch Open Graph data from a URL using the named import and async/await.
Use named import: import { fetch } from 'fetch-opengraph'If you need nested structure, you must transform the result yourself.
Ensure you only pass URLs to HTML pages; wrap in try/catch for network errors.
const { fetch } = require('fetch-opengraph') or import { fetch } from 'fetch-opengraph'npm install fetch-opengraph and ensure tsconfig.json includes node_modules types.
Provide an absolute, valid URL (e.g., 'https://example.com').
No dependency data recorded yet.