Comparing version 1.0.1 to 1.0.2
#!/usr/bin/env node | ||
/*! | ||
* @license :readmeta - V1.0.1 - 26/08/2020 | ||
* @license :readmeta - V1.0.2 - 26/08/2020 | ||
* https://github.com/ujjwalguptaofficial/getmeta | ||
@@ -149,3 +149,3 @@ * Copyright (c) 2020 @Ujjwal Gupta; Licensed MIT | ||
var fetchMeta = function (url) { return __awaiter(void 0, void 0, void 0, function () { | ||
var spinner, prefix, browser, page, pendingXHR, result, key, error_1; | ||
var spinner, prefix, browser, page, pendingXHR, result, print_1, category, categoryContent, meta, metaContent, error_1; | ||
return __generator(this, function (_a) { | ||
@@ -189,9 +189,14 @@ switch (_a.label) { | ||
var head = document.head; | ||
var title = document.querySelector("title"); | ||
var description = head.querySelector('meta[name=description]'); | ||
var keywords = head.querySelector('meta[property=keywords]'); | ||
var ogTitle = head.querySelector('meta[property="og:title"]'); | ||
var ogDescription = head.querySelector('meta[property="og:description"]'); | ||
var ogSiteName = head.querySelector('meta[property="og:site_name"]'); | ||
var ogImage = head.querySelector('meta[property="og:image"]'); | ||
var ogImageWidth = head.querySelector('meta[property="og:image:width"]'); | ||
var ogImageHeight = head.querySelector('meta[property="og:image:height"]'); | ||
var ogTitle = head.querySelector('meta[property="og:title"]'); | ||
var ogDescription = head.querySelector('meta[property="og:description"]'); | ||
var ogType = head.querySelector('meta[property="og:type"]'); | ||
var ogUrl = head.querySelector('meta[property="og:url"]'); | ||
var fbAppId = head.querySelector('meta[property="fb:app_id"]'); | ||
var twitterSite = head.querySelector('meta[name="twitter:site"]'); | ||
@@ -202,16 +207,28 @@ var twitterTitle = head.querySelector('meta[name="twitter:title"]'); | ||
var twitterCard = head.querySelector('meta[name="twitter:card"]'); | ||
var twitterImageAlt = head.querySelector('meta[name="twitter:image:alt"]'); | ||
return { | ||
title: head.getElementsByTagName('title')[0].innerText, | ||
descripton: description ? description.content : null, | ||
ogTitle: ogTitle ? ogTitle.content : null, | ||
ogDescription: ogDescription ? ogDescription.content : null, | ||
ogImage: ogImage ? ogImage.content : null, | ||
ogImageWidth: ogImageWidth ? ogImageWidth.content : null, | ||
ogImageHeight: ogImageHeight ? ogImageHeight.content : null, | ||
ogType: ogType ? ogType.content : null, | ||
twitterSite: twitterSite ? twitterSite.content : null, | ||
twitterTitle: twitterTitle ? twitterTitle.content : null, | ||
twitterDescription: twitterDescription ? twitterDescription.content : null, | ||
twitterImage: twitterImage ? twitterImage.content : null, | ||
twitterCard: twitterCard ? twitterCard.content : null, | ||
general: { | ||
title: title ? title.innerText : null, | ||
descripton: description ? description.content : null, | ||
keywords: keywords ? keywords.content : null, | ||
}, | ||
facebook: { | ||
"og:title": ogTitle ? ogTitle.content : null, | ||
"og:description": ogDescription ? ogDescription.content : null, | ||
"og:site_name": ogSiteName ? ogSiteName.content : null, | ||
"og:image": ogImage ? ogImage.content : null, | ||
"og:image:width": ogImageWidth ? ogImageWidth.content : null, | ||
"og:image:height": ogImageHeight ? ogImageHeight.content : null, | ||
"og:type": ogType ? ogType.content : null, | ||
"og:url": ogUrl ? ogUrl.content : null, | ||
"fb:app_id": fbAppId ? fbAppId.content : null, | ||
}, | ||
twitter: { | ||
"twitter:site": twitterSite ? twitterSite.content : null, | ||
"twitter:title": twitterTitle ? twitterTitle.content : null, | ||
"twitter:description": twitterDescription ? twitterDescription.content : null, | ||
"twitter:image": twitterImage ? twitterImage.content : null, | ||
"twitter:card": twitterCard ? twitterCard.content : null, | ||
"twitter:image:alt": twitterImageAlt ? twitterImageAlt.content : null, | ||
} | ||
}; | ||
@@ -223,7 +240,19 @@ })]; | ||
console.log("\n \n "); | ||
for (key in result) { | ||
if (result[key]) { | ||
console.log(key + " : \"" + result[key] + "\""); | ||
console.log(""); | ||
print_1 = function (message) { | ||
console.log(message); | ||
}; | ||
for (category in result) { | ||
categoryContent = result[category]; | ||
if (Object.keys(categoryContent).length == 0) { | ||
return [2 /*return*/]; | ||
} | ||
console.log("--------------------------" + category + "------------------------------"); | ||
console.log(""); | ||
for (meta in categoryContent) { | ||
metaContent = categoryContent[meta]; | ||
if (metaContent) { | ||
console.log(meta + " : \"" + metaContent + "\""); | ||
console.log(""); | ||
} | ||
} | ||
} | ||
@@ -240,2 +269,3 @@ return [4 /*yield*/, browser.close()]; | ||
console.info("please contact author of this Project"); | ||
process.exit(); | ||
return [3 /*break*/, 10]; | ||
@@ -242,0 +272,0 @@ case 10: return [2 /*return*/]; |
{ | ||
"name": "readmeta", | ||
"version": "1.0.1", | ||
"description": "meta tag previewer for web application", | ||
"version": "1.0.2", | ||
"description": "Cli for previewing meta tags for web application.", | ||
"main": "./dist/app.js", | ||
@@ -13,7 +13,7 @@ "bin": { | ||
"deploy": "NODE_ENV=production npm run build", | ||
"build:install": "npm run buildpack && sudo npm i getmeta-1.0.0.tgz -g" | ||
"build:install": "npm run buildpack && sudo npm i readmeta-1.0.0.tgz -g" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ujjwalguptaofficial/getmeta.git" | ||
"url": "git+https://github.com/ujjwalguptaofficial/readmeta.git" | ||
}, | ||
@@ -30,5 +30,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/ujjwalguptaofficial/getmeta/issues" | ||
"url": "https://github.com/ujjwalguptaofficial/readmeta/issues" | ||
}, | ||
"homepage": "https://github.com/ujjwalguptaofficial/getmeta#readme", | ||
"homepage": "https://github.com/ujjwalguptaofficial/readmeta#readme", | ||
"dependencies": { | ||
@@ -35,0 +35,0 @@ "bufferutil": "^4.0.1", |
Sorry, the diff of this file is not supported yet
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
36035
414