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 3.0.3 to 3.0.4

20

build/__tests__/index.spec.js

@@ -358,2 +358,22 @@ "use strict";

}); });
it('should handle video tags without type or secure_url tags', function () { return __awaiter(void 0, void 0, void 0, function () {
var res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, (0, index_1.getLinkPreview)("https://newpathtitle.com/falling-markets-how-to-stop-buyer-from-getting-out/", { followRedirects: "follow" })];
case 1:
res = _a.sent();
expect(res.siteName).toEqual("New Path Title");
expect(res.title).toEqual("Falling Markets: How To Stop A Buyer From Getting Out | New Path Title");
expect(res.description).toBeTruthy();
expect(res.mediaType).toEqual("article");
expect(res.images.length).toBeGreaterThan(0);
expect(res.videos.length).toBeGreaterThan(0);
expect(res.videos[0].url).toEqual("https://www.youtube.com/embed/nqNXjxpAPkU");
expect(res.favicons.length).toBeGreaterThan(0);
expect(res.contentType.toLowerCase()).toEqual("text/html");
return [2 /*return*/];
}
});
}); });
});

@@ -360,0 +380,0 @@ describe("#getPreviewFromContent", function () {

8

build/index.js

@@ -165,8 +165,8 @@ "use strict";

video = node.attribs.content;
nodeType = nodeTypes[index];
if (nodeType.type === "tag") {
nodeType = nodeTypes === null || nodeTypes === void 0 ? void 0 : nodeTypes[index];
if ((nodeType === null || nodeType === void 0 ? void 0 : nodeType.type) === "tag") {
videoType = nodeType ? nodeType.attribs.content : null;
}
nodeSecureUrl = nodeSecureUrls[index];
if (nodeSecureUrl.type === "tag") {
nodeSecureUrl = nodeSecureUrls === null || nodeSecureUrls === void 0 ? void 0 : nodeSecureUrls[index];
if ((nodeSecureUrl === null || nodeSecureUrl === void 0 ? void 0 : nodeSecureUrl.type) === "tag") {
videoSecureUrl = nodeSecureUrl ? nodeSecureUrl.attribs.content : null;

@@ -173,0 +173,0 @@ }

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

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

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