link-preview-js
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -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 () { |
@@ -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", |
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
672327
3359