link-preview-js
Advanced tools
Comparing version 2.1.13 to 2.1.14
@@ -6,2 +6,3 @@ interface ILinkPreviewOptions { | ||
timeout?: number; | ||
followRedirects?: boolean; | ||
} | ||
@@ -8,0 +9,0 @@ interface IPreFetchedResource { |
@@ -339,3 +339,5 @@ "use strict"; | ||
headers: (_b = options === null || options === void 0 ? void 0 : options.headers) !== null && _b !== void 0 ? _b : {}, | ||
redirect: "follow", | ||
redirect: (options === null || options === void 0 ? void 0 : options.followRedirects) | ||
? "follow" | ||
: "error", | ||
signal: controller.signal, | ||
@@ -342,0 +344,0 @@ }; |
{ | ||
"name": "link-preview-js", | ||
"version": "2.1.13", | ||
"version": "2.1.14", | ||
"description": "Javascript module to extract and fetch HTTP link information from blocks of text.", | ||
@@ -18,4 +18,4 @@ "main": "build/index.js", | ||
"build": "tsc", | ||
"publish": "tsc && jest --detectOpenHandles && npm publish", | ||
"bump": "./bump-version.sh" | ||
"bump": "./bump-version.sh", | ||
"prepare": "tsc" | ||
}, | ||
@@ -22,0 +22,0 @@ "keywords": [ |
@@ -19,4 +19,16 @@ <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. | ||
> **READ BEFORE CREATING AN ISSUE** | ||
> | ||
> It's more than likely there is nothing wrong with the library for some simple reasons: | ||
> | ||
> - It's very simple: fetch html, parse html, look for OpenGraph html tags. | ||
> - The library will never break unless the entire web all of the sudden decides to break itself (by changing ALL OpenGraph tags ALL AT ONCE) | ||
> - If the target website you are trying to preview redirects you to a login page **the preview will "fail"** | ||
> - If the target website does not have OpenGraph tags **the preview will most likely "fail"** | ||
> - **You cannot preview (read: HTTP get) another web page from YOUR web page. This is an intentional security feature of browsers called CORS** | ||
> | ||
> If you haven't read this and create an issue "Amazon/Youtube/Instagram/Whatever doesn't work" I will just close the issue | ||
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. via **Facebook OpenGraph** tags. | ||
## GOTCHAs | ||
@@ -72,8 +84,8 @@ | ||
| Property Name | Result | | ||
| -------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------: | | ||
| imagesPropertyType (**optional**) (ex: 'og') | Fetches images only with the specified property, `meta[property='${imagesPropertyType}:image']` | | ||
| headers (**optional**) (ex: { 'user-agent': 'googlebot', 'Accept-Language': 'en-US' }) | Add request headers to fetch call | | ||
| timeout (**optional**) (ex: 1000) | Timeout for the request to fail | | ||
| followRedirects (**optional**) (default false) | For security reasons, the library does not automatically follow redirects, a malicious agent can exploit redirects to steal data, turn this on at your own risk | | ||
| Property Name | Result | | ||
| -------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------: | | ||
| imagesPropertyType (**optional**) (ex: 'og') | Fetches images only with the specified property, `meta[property='${imagesPropertyType}:image']` | | ||
| headers (**optional**) (ex: { 'user-agent': 'googlebot', 'Accept-Language': 'en-US' }) | Add request headers to fetch call | | ||
| timeout (**optional**) (ex: 1000) | Timeout for the request to fail | | ||
| followRedirects (**optional**) (default false) | For security reasons, the library does not automatically follow redirects, a malicious agent can exploit redirects to steal data, turn this on at your own risk | | ||
@@ -80,0 +92,0 @@ ```javascript |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31486
522
171