# Link preview libraries compared

> Compare linkpeek with link-preview-js, open-graph-scraper, metascraper, unfurl.js, and url-metadata by use case, API shape, security, and footprint.

linkpeek does one job: it turns a URL into a typed preview card on the server, and refuses private addresses and unchecked redirects by default. If you need broader scraping, URL detection in free text, fetched oEmbed data or provider-specific rules, one of the other packages here will serve you better.

Comparing two specific packages? The pages for [link-preview-js](https://linkpeek.js.org/guides/link-preview-js-alternative/), [open-graph-scraper](https://linkpeek.js.org/guides/open-graph-scraper-alternative/), [unfurl.js](https://linkpeek.js.org/guides/unfurl-js-alternative/), [url-metadata](https://linkpeek.js.org/guides/url-metadata-alternative/) and [metascraper](https://linkpeek.js.org/guides/metascraper-alternative/) put the measured numbers side by side with linkpeek and show the migration code.

## Good fit

| Package | Good fit | Tradeoff versus linkpeek |
| --- | --- | --- |
| **linkpeek** | Typed URL previews on Node.js, Bun, Deno, and fetch-based edge runtimes | Deliberately not a full article or provider-rule extraction framework |
| `link-preview-js` | Previewing a URL or finding the first URL in text | Broader input API; a different result shape and runtime focus |
| `open-graph-scraper` | Node-oriented Open Graph scraping with broader scraper controls | Larger install tree; edge parse-only users may prefer its separate lite package |
| `metascraper` | Composable, provider-specific metadata rules | More setup and dependencies for a much broader extraction framework |
| `unfurl.js` | Rich nested metadata and fetched oEmbed data in Node.js | [Archived upstream](https://github.com/jacktuck/unfurl) as of November 2026; not focused on a small edge-runtime preview path |
| `url-metadata` | Broad page metadata in Node.js | Broader output and dependency surface than a preview-card utility |

This is about fit, not a ranking. The evidence is dated, so check the linked notes before you base an architecture decision on it.

## Speed and install size

Measured on November 15, 2026 with the same pages and a local server, so the numbers show library overhead rather than network latency. On large pages linkpeek is fastest because it stops after `</head>`; on small pages the packages are within about two milliseconds of each other. The [benchmarks](https://linkpeek.js.org/benchmarks/) have every result and the method.

**Clean install size.** Clean npm install --ignore-scripts of the pinned published version; metascraper includes the same 7 rule packages.

| Package | node_modules |
| --- | ---: |
| **linkpeek** 3.0.0 | 1.3 MB · 7 packages |
| unfurl.js 6.4.0 | 3.2 MB · 16 packages |
| link-preview-js 6.0.0 | 7.9 MB · 18 packages |
| url-metadata 6.3.1 | 10.4 MB · 30 packages |
| open-graph-scraper 6.13.0 | 11.1 MB · 27 packages |
| metascraper 5.58.6 | 81.1 MB · 128 packages |

## Result fields

Every package gives you a title, but under a different key. In the versions benchmarked, reading it looks like this:

| Package | Typical title access | Fetch ownership |
| --- | --- | --- |
| `linkpeek` | `result.title` | `preview()` fetches; `parseHTML()` parses existing HTML |
| `link-preview-js` | `result.title` | URL and content APIs |
| `open-graph-scraper` | `response.result.ogTitle` | Main package fetches |
| `metascraper` | `result.title` | Your application supplies HTML |
| `unfurl.js` | `result.open_graph?.title` | `unfurl()` fetches |
| `url-metadata` | `result["og:title"]` | Main API fetches |

## URL fetching and security

For a public preview endpoint, parsing is the easy part. What matters is which layer checks an untrusted destination, and every redirect, before the next request goes out.

| Package | Security consideration as of 15 November 2026 |
| --- | --- |
| linkpeek | Blocks credential-bearing input, common secret headers, private/special-use IP literals, and redirect targets by default. By default it does not resolve hostnames. The opt-in `resolveHost` checks DNS answers on every hop but does not pin the connection: platform `fetch` owns DNS, so a hostname that resolves to a private address needs egress controls. |
| `link-preview-js` | Version 6.0.0 resolves each hostname and redirect hop, rejects private results, and pins the connection to the checked addresses in Node.js. Versions through 4.0.0 were affected by [CVE-2026-43897](https://github.com/advisories/GHSA-4gp8-rjrq-ch6q). |
| `open-graph-scraper` | Since 6.13.0 the main package only requests destinations whose resolved addresses are public and checks redirects first, with no opt-out. If you already own the fetch, compare the parse-only [`open-graph-scraper-lite`](https://github.com/jshemas/openGraphScraper/issues/203). |
| `metascraper` | The application supplies HTML, so redirect validation, address policy, timeouts, byte limits, and credentials belong to the caller's fetch implementation. |
| `unfurl.js` | The repository is archived; still-open [PR #117](https://github.com/jacktuck/unfurl/pull/117) documents destination validation proposed after the last published release. |
| `url-metadata` | The Node-oriented API exposes request-filtering agent options. Review its current defaults and options against your threat model rather than assuming every runtime has the same network controls. |

These are dated notes on how each package works, not security ratings. Whichever you pick, a server-side URL fetcher also benefits from rate limiting, cache controls and platform egress policy.

## Migration considerations

```ts
import { preview } from "linkpeek";

const result = await preview(url);

if (result.statusCode >= 400) {
	// Render a fallback and skip caching.
}

const card = {
	title: result.title,
	description: result.description,
	image: result.image,
	url: result.canonicalUrl,
};
```

- HTTP error pages resolve with their metadata and `statusCode`; invalid input, blocked targets, timeouts, and network failures throw.

- Private and special-use addresses are blocked by default. Keep that default for public input and review the documented DNS-resolution limit.

- Discovered oEmbed endpoints are returned in `oEmbedUrl` but are not fetched.

- The default preset scans the head with a 30 kB ceiling. Use `presets.quality` when body JSON-LD or body-image fallback is worth more work.

- Keep preview fetching on the server. Browsers block cross-site reads (CORS), and outbound requests to untrusted URLs belong in code you control.

## Sources and measurements

The dated comparison notes have the latency on the same corpus, install footprints, competitor versions, known runtime constraints, security sources and the commands to reproduce it all. Rerun them before you quote the numbers later.

Related: [Benchmarks](https://linkpeek.js.org/benchmarks/) · [Quick start](https://linkpeek.js.org/quick-start/) · [Security model](https://linkpeek.js.org/security/) · [Detailed comparison notes](https://github.com/thegruber/linkpeek/blob/main/docs/comparison.md)
