link-preview-js
Advanced tools
Comparing version 2.1.5 to 2.1.6
{ | ||
"name": "link-preview-js", | ||
"version": "2.1.5", | ||
"version": "2.1.6", | ||
"description": "Javascript module to extract and fetch HTTP link information from blocks of text. ", | ||
"main": "build/index.js", | ||
"exports": { | ||
"import": "build/index.js" | ||
"require": "./build/index.js", | ||
"import": "./build/index.js" | ||
}, | ||
@@ -9,0 +10,0 @@ "types": "build/index.d.ts", |
@@ -7,11 +7,12 @@ # Link Preview JS | ||
**BROWSERS DO NOT ALLOW YOU TO DO CROSS ORIGIN REQUESTS (CORS)**, you cannot request a different domain from your web app, period. | ||
**Browsers do not allow you to do requests to a different domain, you cannot request a different domain from your web app.** | ||
If do not know how *same-origin-policy* works you can read [this](https://dev.to/lydiahallie/cs-visualized-cors-5b8h) | ||
If do not know how *same-origin-policy* works, [here is a good intro](https://dev.to/lydiahallie/cs-visualized-cors-5b8h) | ||
This library therefore works on node (back-end environments) and certain mobile run-times (cordova or react-native) | ||
Therefore this library works on node (back-end environments) and certain mobile run-times (cordova or react-native). | ||
## Disclaimer | ||
## GOTCHAs | ||
As Google continues to wage war upon the internet and break it on all the ways only convenient to Google, sometimes its 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. The trillion dollar corporations are not your friends. | ||
- www.google.com does not return a required meta data, test with another domain. | ||
- If you are running on a mobile, **please think about what you are doing**, this library does not do magic it simply fetches the website and parses data, therefore it as if the user would visit the page, YouTube re-directs you to the mobile site and Instagram (and other social sites) might redirect you to registration pages, you can try to change the user-agent header (try with google-bot), but there is nothing wrong with this library, work around these issues yourself. | ||
@@ -26,9 +27,11 @@ Created by **Oscar Franco** | ||
### Install the lib | ||
### Install | ||
``` | ||
yarn add link-preview-js | ||
-- OR -- | ||
npm install link-preview-js | ||
``` | ||
### Use the methods | ||
### API | ||
@@ -35,0 +38,0 @@ `getLinkPreview`: you have to pass a string, doesn't matter if it is just a URL or a piece of text that contains a URL, the library will take care of parsing it and returning the info of first valid HTTP(S) URL info it finds. (URL parsing is done via: https://gist.github.com/dperini/729294). |
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
28841
163