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

react-native-link-preview

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-link-preview - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

36

index.js

@@ -51,3 +51,4 @@ /**

images: getImages(doc, url, options.imagesPropertyType),
videos: getVideos(doc)
videos: getVideos(doc),
favicons: getFavicons(doc, url)
};

@@ -186,2 +187,35 @@ };

// returns an array of URL's to favicon images
const getFavicons = function(doc, rootUrl) {
let images = [],
nodes = [],
src;
const relSelectors = ['rel=icon', 'rel="shortcut icon"', 'rel=apple-touch-icon'];
relSelectors.forEach((relSelector) => {
// look for all icon tags
nodes = doc(`link[${relSelector}]`);
// collect all images from icon tags
if (nodes.length) {
nodes.each((index, node) => {
src = node.attribs.href;
if (src) {
src = urlObj.resolve(rootUrl, src);
images.push(src);
}
});
}
});
// if no icon images, use default favicon location
if (images.length <= 0) {
src = '/favicon.ico';
images.push(urlObj.resolve(rootUrl, src));
}
return images;
};
// const parseMediaResponse = function(res, contentType, url) {

@@ -188,0 +222,0 @@ // if (contentType.indexOf('image/') === 0) {

2

package.json
{
"name": "react-native-link-preview",
"version": "1.3.0",
"version": "1.3.1",
"description": "",

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

@@ -32,4 +32,4 @@

| Property Name | Result |
| ------------- |:-------------:|
| Property Name | Result |
| ------------- |:-------------:|
| imagesPropertyType (**optional**) (ex: 'og') | Fetches images only with the specified property, `meta[property='${imagesPropertyType}:image']` |

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

LinkPreview.getPreview(
'https://www.youtube.com/watch?v=MejbOFk7H6c',
'https://www.youtube.com/watch?v=MejbOFk7H6c',
{

@@ -57,3 +57,4 @@ imagesPropertyType: 'og', // fetches only open-graph images

mediaType: "video",
videos: []
videos: [],
favicons:["https://www.youtube.com/yts/img/favicon_32-vflOogEID.png","https://www.youtube.com/yts/img/favicon_48-vflVjB_Qk.png","https://www.youtube.com/yts/img/favicon_96-vflW9Ec0w.png","https://www.youtube.com/yts/img/favicon_144-vfliLAfaB.png","https://s.ytimg.com/yts/img/favicon-vfl8qSV2F.ico"]
}

@@ -60,0 +61,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