web-meta-json
v2.1.2
Published
Get meta data of any web app as JSON
Downloads
18
Maintainers
Readme
web-meta-json
Package used to get the META data information of any given website(URL) as JSON
- v1.0.0 - Support only URL as input.
- v2.0.0 - Support both URL or HTML content as input.
How to use it
Install
web-meta-json
npm i web-meta-json --save
Import
web-meta-json
const WebMetaJson = require('web-meta-json');
Call the
GetData
function inWebMetaJson
and send the URL(example: https://babymanisha.com) as a parameter, which will return promise as output.WebMetaJson.GetData('https://babymanisha.com').then(response => { console.log(response); }).catch(error => { console.log(error); });
#v2.0.0 - Call the
ExtractData
function inWebMetaJson
and send the raw html data as a first param and URL(example: https://babymanisha.com) as a second parameter (optional), which will return JSON as output.const htmlData = ` <!DOCTYPE html> <html> <head> <title>This is Sample Page</title> </head> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> ` console.log(WebMetaJson.ExtractData(htmlData));
- Refer this for more examples.
Sample output format
Title will shows with
title
keywordAll
<meta>
tag contents will be shows with keywords that start with keymeta-
All
<link>
tag contents will be shows with keywords that start with keylink-
Example-1: https://babymanisha.com
{ "title":"BabyManisha.Sunkara - Personal Portfolio Template", "meta-keywords":"BabyManisha, Profile, Maneesha", "meta-description":"BabyManisha\\'s Profile", "link-shortcut icon":"images/star.png" }
Example-2: https://medium.com/@maneeshamanshumahadevsunkara/babymanisha-sunkara-68690a68cba8
{ "title":"“BabyManisha.Sunkara”. Senior Front-End Developer | by BabyManisha. Sunkara | Medium", "meta-theme-color":"#000000", "meta-twitter:app:name:iphone":"Medium", "meta-twitter:app:id:iphone":"828256236", "meta-al:ios:app_name":"Medium", "meta-al:ios:app_store_id":"828256236", "meta-al:android:package":"com.medium.reader", "meta-fb:app_id":"542599432471018", "meta-og:site_name":"Medium", "meta-og:type":"article", "meta-article:published_time":"2021-08-12T07:15:03.545Z", "meta-title":"“BabyManisha.Sunkara”. Senior Front-End Developer | by BabyManisha. Sunkara | Medium", "meta-og:title":"“BabyManisha.Sunkara”", "meta-twitter:title":"“BabyManisha.Sunkara”", "meta-twitter:site":"@Medium", "meta-twitter:app:url:iphone":"medium://p/68690a68cba8", "meta-al:android:url":"medium://p/68690a68cba8", "meta-al:ios:url":"medium://p/68690a68cba8", "meta-al:android:app_name":"Medium", "meta-description":"Senior Front-End Developer. ““BabyManisha.Sunkara”” is published by BabyManisha. Sunkara.", "meta-og:description":"Senior Front-End Developer", "meta-twitter:description":"Senior Front-End Developer", "meta-og:url":"https://medium.com/@maneeshamanshumahadevsunkara/babymanisha-sunkara-68690a68cba8", "meta-al:web:url":"https://medium.com/@maneeshamanshumahadevsunkara/babymanisha-sunkara-68690a68cba8", "meta-og:image":"https://miro.medium.com/max/960/1*8JSHHvur3cyfEly_K0TqgQ.jpeg", "meta-twitter:image:src":"https://miro.medium.com/max/960/1*8JSHHvur3cyfEly_K0TqgQ.jpeg", "meta-twitter:card":"summary_large_image", "meta-article:author":"https://medium.com/@maneeshamanshumahadevsunkara", "meta-twitter:creator":"@ManshuMahadev", "meta-author":"BabyManisha. Sunkara", "meta-robots":"index,follow,max-image-preview:large", "meta-twitter:label1":"Reading time", "meta-twitter:data1":"2 min read", "link-apple-touch-icon-152x152":"https://miro.medium.com/fit/c/152/152/1*sHhtYhaCe2Uc3IU0IgKwIQ.png", "link-apple-touch-icon-120x120":"https://miro.medium.com/fit/c/120/120/1*sHhtYhaCe2Uc3IU0IgKwIQ.png", "link-apple-touch-icon-76x76":"https://miro.medium.com/fit/c/76/76/1*sHhtYhaCe2Uc3IU0IgKwIQ.png", "link-apple-touch-icon-60x60":"https://miro.medium.com/fit/c/60/60/1*sHhtYhaCe2Uc3IU0IgKwIQ.png", "link-mask-icon":"https://cdn-static-1.medium.com/_/fp/icons/Medium-Avatar-500x500.svg", "link-author":"https://medium.com/@maneeshamanshumahadevsunkara", "link-canonical":"https://medium.com/@maneeshamanshumahadevsunkara/babymanisha-sunkara-68690a68cba8", "link-alternate":"android-app://com.medium.reader/https/medium.com/p/68690a68cba8" }
Total Time of Execution - On an Average 20 ms
| URL | URL Load Time | WEB-META-JSON Response Time | | ----------- | ----------- |----------- | | https://babymanisha.com | 170 ms | 200 ms | | https://www.google.com | 550 ms | 670 ms | | https://medium.com/@maneeshamanshumahadevsunkara/babymanisha-sunkara-68690a68cba8 | 288 ms | 298 ms |
Pro Tip
It also has the API service refer this for more information.
Reach [email protected], if you need any further assistance on this.
Happy Coding!
--
Thanks
BabyManisha.Sunkara