🔍 Glancify is a lightweight TypeScript library that generates a link preview from any public URL by extracting the page's title, description, and Open Graph image.
- Automatically extracts:
-
<title>
tag - Meta
description
tag - Open Graph meta tags:
og:title
,og:description
,og:image
-
- Returns a clean and simple JSON object
- Written entirely in TypeScript
- Designed for server-side usage (Node.js)
npm install glancify
import { glancify } from 'glancify';
(async () => {
const preview = await glancify('https://example.com');
console.log(preview);
})();
Example output:
{
"title": "Example Page Title",
"description": "This is the meta description of the page.",
"image": "https://example.com/og-image.jpg"
}
- Works only with publicly accessible HTTP/HTTPS URLs
- Ideal for backends, social previews, content scrapers
- Assumes HTML is UTF-8 encoded
- Support for non-UTF-8 charsets
- Add timeout and retry logic
- Use a real HTML parser for improved robustness (e.g.
cheerio
)