New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

link-preview-js

Package Overview
Dependencies
Maintainers
1
Versions
41
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 1.4.4 to 1.5.0

8

__tests__/index.spec.js

@@ -71,2 +71,10 @@ const LinkPreview = require('../index.js');

it('should make request with different languages', async () => {
let linkInfo = await LinkPreview.getPreview('https://www.hsbc.ca/', {language: 'fr'});
expect(linkInfo.title).to.be.equal('Particuliers | HSBC Canada');
linkInfo = await LinkPreview.getPreview('https://www.hsbc.ca/');
expect(linkInfo.title).to.be.equal('HSBC Personal Banking | HSBC Canada');
});
it('should handle audio urls', async () => {

@@ -73,0 +81,0 @@ const linkInfo = await LinkPreview.getPreview('https://ondemand.npr.org/anon.npr-mp3/npr/atc/2007/12/20071231_atc_13.mp3');

10

index.js

@@ -25,3 +25,9 @@ const cheerio = require('cheerio-without-node-native');

if (detectedUrl) {
fetch(detectedUrl)
var fetchOptions = {}
if (options && options.language) {
fetchOptions.headers = {
'Accept-Language': options.language
}
}
fetch(detectedUrl, fetchOptions)
.then(function (response) {

@@ -246,3 +252,3 @@

width: width,
height: width
height: height
};

@@ -249,0 +255,0 @@ if (videoType && videoType.indexOf('video/') === 0) {

2

package.json
{
"name": "link-preview-js",
"version": "1.4.4",
"version": "1.5.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -40,2 +40,3 @@

| imagesPropertyType (**optional**) (ex: 'og') | Fetches images only with the specified property, `meta[property='${imagesPropertyType}:image']` |
| language (**optional**) (ex: 'de', 'en-US') | Fetch content with specific language |

@@ -48,2 +49,3 @@

imagesPropertyType: 'og', // fetches only open-graph images
language: 'fr-CA', // fetches site for French language
})

@@ -50,0 +52,0 @@ .then(data => console.debug(data));

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