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.1 to 2.1.2

8

build/index.d.ts

@@ -25,3 +25,3 @@ interface ILinkPreviewOptions {

contentType: string;
favicons: any[];
favicons: string[];
} | {

@@ -42,3 +42,3 @@ url: string;

}[];
favicons: any[];
favicons: string[];
}>;

@@ -56,3 +56,3 @@ /**

contentType: string;
favicons: any[];
favicons: string[];
} | {

@@ -73,4 +73,4 @@ url: string;

}[];
favicons: any[];
favicons: string[];
}>;
export {};

@@ -10,3 +10,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import cheerio from "cheerio-without-node-native";
import cheerio from "cheerio";
import { fetch } from "cross-fetch";

@@ -266,3 +266,6 @@ import urlObj from "url";

}
const fetchOptions = { headers: (_a = options === null || options === void 0 ? void 0 : options.headers) !== null && _a !== void 0 ? _a : {} };
const fetchOptions = {
headers: (_a = options === null || options === void 0 ? void 0 : options.headers) !== null && _a !== void 0 ? _a : {},
redirect: `follow`,
};
const fetchUrl = (options === null || options === void 0 ? void 0 : options.proxyUrl) ? options.proxyUrl.concat(detectedUrl) : detectedUrl;

@@ -269,0 +272,0 @@ const response = yield fetch(fetchUrl, fetchOptions);

{
"name": "link-preview-js",
"version": "2.1.1",
"version": "2.1.2",
"description": "Javascript module to extract and fetch HTTP link information from blocks of text. ",

@@ -24,3 +24,3 @@ "main": "build/index.js",

"dependencies": {
"cheerio-without-node-native": "0.20.2",
"cheerio": "^1.0.0-rc.5",
"cross-fetch": "3.0.6",

@@ -30,6 +30,5 @@ "url": "0.11.0"

"devDependencies": {
"@types/jest": "^24.0.25",
"@types/jest": "^26.0.19",
"@typescript-eslint/eslint-plugin": "^2.15.0",
"@typescript-eslint/parser": "^2.15.0",
"add": "^2.0.6",
"eslint": "^6.8.0",

@@ -47,3 +46,3 @@ "eslint-config-airbnb": "^18.0.1",

"ts-jest": "^26.4.4",
"typescript": "^4.1.2"
"typescript": "^4.1.3"
},

@@ -50,0 +49,0 @@ "volta": {

@@ -7,10 +7,11 @@ # link-preview-js

A (respectable) browser **DOES NOT ALLOW YOU TO DO CROSS ORIGIN REQUESTS**, you cannot do a request to a different domain from your web application, if do not know how *same-origin-policy* works you can read [this](https://dev.to/lydiahallie/cs-visualized-cors-5b8h) fantastic piece written by @lydiahallie
A (respectable) browser **DOES NOT ALLOW YOU TO DO CROSS ORIGIN REQUESTS**, you cannot do a request to a different domain from your web application, if do not know how *same-origin-policy* works you can read [this](https://dev.to/lydiahallie/cs-visualized-cors-5b8h) fantastic piece
## Security disclaimer
This library uses [cheerio-without-native](https://github.com/oyyd/cheerio-without-node-native) which unfortunately has been abandoned and now has some security vunerabilities (according to github) I'm not responsible for any security implications this might carry
## Disclaimer
As of 23 of April of 2020: Do not use https://google.com it does not return the appropiate meta-tags to be parsed, so test with another domain, don't waste your time
This library no longer depends on a custom fork of cheerio and it is using the official cheerio lib! 🎉 all security issues should be resolved!
As google continues to take over the web and break it on all the ways only convenient to google, sometimes it's domains break the standards, to be more specific: www.google.com does not return a required meta data and YouTube does funny re-directions on mobile which also causes this library to return wrong data... 🖕 Google, feel free to try to fix this issues yourself by opening a PR but I won't spend my time trying to accommodate all edge cases
## Install

@@ -31,3 +32,3 @@

```typescript
import {getLinkPreview} from 'link-preview-js';
import { getLinkPreview, getPreviewFromContent } from 'link-preview-js';

@@ -34,0 +35,0 @@ // pass the link directly

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