opensource-link-previewer

1.0.1 • Public • Published

Link Previewer

Generate link previews with social metadata, For example, social apps can use the metadata to present shared links as cards with a title, a description of the linked content, and a preview image.

Installation

$ npm i --save opensource-link-previewer

In Node.js

// CommonJS
var LinkPreviewer = require("opensource-link-previewer");
// Load the link previewer
const link = new LinkPreviewer();
 
link.preview("https://web.whatsapp.com")
.then((response) => {
/*
    Response is look like: 
    [ { title: 'WhatsApp Web' },
    { description: 'Quickly send and receive WhatsApp messages right from your computer.' },
    { 'og:description': 'Quickly send and receive WhatsApp messages right from your computer.' },
    { 'og:title': 'WhatsApp Web' },
    { 'og:image': 'https://www.whatsapp.com/img/fb-post.jpg' } ]
*/
    console.log(`RESPONSE: ${response}`);
})
.catch((reason) => {
    console.log(`Error: ${reason}`);
});

Thankyou 😀🎉

Package Sidebar

Install

npm i opensource-link-previewer

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

3.63 kB

Total Files

4

Last publish

Collaborators

  • bhautikchudasama