npm.io
1.2.7 • Published 2 years ago

link-preview-info

Licence
ISC
Version
1.2.7
Deps
4
Size
5 kB
Vulns
0
Weekly
0

Very easy NPM package for getting info from a website by using GOT as http library and JSDOM for conversion of http result to DOM.

Installation

npm i link-preview-info

Usage

The function linkPreviewInfo is asynchronous, do not forget to await the result!

import linkPreviewInfo from 'link-preview-info';
const info = await linkPreviewInfo('https://something.com/');

console.log(info);
{
  title: 'Title',
  description: 'Description',
  imgUrl: 'someurl.png'
}
Good to know

if the function finds no image url or the image url returns 404, value of imageUrl will be set to null.

Keywords