Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

link-preview-js

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

link-preview-js - npm Package Compare versions

Comparing version 2.1.8 to 2.1.9

9

package.json
{
"name": "link-preview-js",
"version": "2.1.8",
"version": "2.1.9",
"description": "Javascript module to extract and fetch HTTP link information from blocks of text.",
"main": "build/index.js",
"exports": {
"require": "./build/index.js",
"import": "./build/index.js"
".": {
"require": "./build/index.js",
"import": "./build/index.js"
},
"./package.json": "./package.json"
},

@@ -10,0 +13,0 @@ "types": "build/index.d.ts",

@@ -1,19 +0,27 @@

# Link Preview JS
<h1 align="center">Link Preview JS</h1>
Allows you to extract information from a HTTP url/link (or parse a HTML string) and retrieve meta information such as title, description, images, videos, etc. The information is extracted from facebook's OpenGraph protocol.
<div align="center">
<img src="https://user-images.githubusercontent.com/1634213/127743288-9f8a99f3-75d8-42c5-9a69-b47c661b7e18.jpg" height="500"/>
Created by [Oscar Franco](www.twitter.com/ospfranco).
<pre align="center">
npm i link-preview-js
</pre>
<a align="center" href="https://github.com/ospfranco?tab=followers">
<img src="https://img.shields.io/github/followers/ospfranco?label=Follow%20%40ospfranco&style=social" />
</a>
<br />
<a align="center" href="https://twitter.com/ospfranco">
<img src="https://img.shields.io/twitter/follow/ospfranco?label=Follow%20%40ospfranco&style=social" />
</a>
</div>
Allows you to extract information from a HTTP url/link (or parse a HTML string) and retrieve meta information such as title, description, images, videos, etc.
## GOTCHAs
- **You cannot request a different domain from your web app (Browsers block cross-origin-requests).** If do not know how _same-origin-policy_ works, [here is a good intro](https://dev.to/lydiahallie/cs-visualized-cors-5b8h), therefore this library works on node (back-end environments) and certain mobile run-times (cordova or react-native).
- This library fetches the website and parses its html, **as if the user would visit the page**, this means: YouTube re-directs you to the mobile site and Instagram (and other social sites) might redirect you to a sign up page, you can try to change the user-agent header (try with `google-bot`) and the response you get then might be mangled, but there is nothing wrong with this library, you need to work around these issues yourself.
- You cannot request a different domain from your web app (Browsers block cross-origin-requests). If you don't know how _same-origin-policy_ works, [here is a good intro](https://dev.to/lydiahallie/cs-visualized-cors-5b8h), therefore **this library works on node (back-end environments) and certain mobile run-times (cordova or react-native)**.
- **This library acts as if the user would visit the page, sites might re-direct you to sign-up pages, consent screens, etc.** You can try to change the user-agent header (try with `google-bot` or with `Twitterbot`), but you need to work around these issues yourself.
- When you are testing this library do not use **google.com**, it does not return the necessary headers and you will think the library is broken.
## Install
```
yarn add link-preview-js
```
## API

@@ -20,0 +28,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc