link-preview-info
v1.2.7
Published
A JavaScript module that extracts information from HTTP/HTTPS to preview links.
Downloads
117
Maintainers
Readme
Link-preview-info
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.