Link Preview JS

Extract titles, descriptions, images, and other Open Graph link information with link-preview-js.

github.com/OP-Engineering/link-preview-js
Link Preview JS homepage screenshot

About Link Preview JS

Link Preview JS is an open source library for extracting link information, such as titles, descriptions, images, and videos, from web pages. It works by fetching a page's HTML, parsing it, and reading the OpenGraph tags. It is published as an npm package and runs on Node.js servers and on mobile runtimes such as React Native and Cordova. The getLinkPreview function accepts a URL or a block of text, and returns data for the first valid HTTP or HTTPS link it finds. The getPreviewFromContent function accepts a response object that has already been fetched.

The library has clear limits. It only returns useful data when the target page has OpenGraph tags, and it will usually fail when the page has none. If a target site redirects to a login page, the preview will parse that login page instead. Some sites redirect to sign-up or consent screens, and developers need to work around those themselves, for example by changing the user-agent header. Browsers block cross-origin requests, so the library cannot run from a web page in a browser. The maintainer warns against fetching content directly from a user's device, because this exposes the device to potentially malicious links.

Key features

  • Extracts title, description, images, and videos from OpenGraph tags
  • Accepts a URL or text containing a URL and returns data for the first valid link
  • Accepts a pre-fetched response object through getPreviewFromContent
  • Node.js entry point includes resolveDNSHost SSRF and DNS-rebinding protection
  • Mobile entry point supports React Native, Cordova, and other non-Node runtimes
  • Mobile entry point has no undici or node:net dependency
Best for: Developers building server-side or mobile applications that need link preview data from pages with OpenGraph tags.
Good for
  • Open source, with source code and a license in the repository
  • Separate Node.js and mobile entry points for different runtimes
  • Node.js variant includes SSRF and DNS-rebinding protection
Watch out for
  • Previews usually fail for pages that have no OpenGraph tags
  • Previews fail when a target site redirects to a login page
  • Browsers block cross-origin requests, so it cannot run directly from a web page

Link Preview JS at a glance

Type
Open-source project
Pricing
Not confirmed. Check the site
Open source
Yes · Source code
Language
English
Last checked
Oct 6, 2026 · Online when checked
Listed
Oct 5, 2026

Link Preview JS alternatives

Tools and sites you could use instead, ranked by how closely they match.

All 24 alternatives

Popular in Developer Tools

Well-known listings from the same topic.

All 423

Link Preview JS FAQ

Can this library be called from a page running in a browser?
No. Browsers block cross-origin requests (CORS), so the library must run on a server or in a supported mobile runtime.
What happens if a website has no OpenGraph tags?
The preview will most likely fail. The library has some fallbacks, but in general it will not work for those pages.
What happens if a target site redirects to a login page?
The preview will fail, because the library will parse the login page instead of the intended content.
Is something wrong or out of date?

Tell us and an editor will check it.

Own this website?

Claim the listing and suggest updates yourself. An editor checks every claim first.

Claim this listing