JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q53204F
  • License MIT

A ridiculously lightweight metadata extractor for the given url

Package Exports

  • gmeta
  • gmeta/gmeta.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gmeta) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

GMeta

A ridiculously lightweight metadata extractor for the given url or html

NPM

Installation

npm install gmeta --save

Usage from URL

const gmeta = require('gmeta');

// Using callback
gmeta(url,function(err,data){
    console.log(data);
});

// Using Promise (Async/Await) 
const response = await gmeta(url);
console.log(response);

Usage from HTML

const gmeta = require('gmeta');

// Using Callback
gmeta(html,function(err,data){
    console.log(data);
},true);

// Using Promise (Async/Await) 
const response = await gmeta(html,true);
console.log(response);

Example #1

const gmeta = require('gmeta');

const response = await gmeta('https://github.com');
console.log(response);
/* output =>
{ 
    description: 'GitHub brings together the world’s largest community of developers to discover, share, and build better software. From open source projects to private team repositories, we’re your all-in-one platform for collaborative development.',
    viewport: 'width=device-width',
    'google-site-verification': 'KT5gs8h0wvaagLKAVWq8bbeNwnZZK1r1XQysX3xurLU',
    'theme-color': '#1e2327',
    'fb:app_id': '1401488693436528',
    'og:url': 'https://github.com',
    'og:title': 'Build software better, together',
    'og:description': 'GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 85 million projects.',
    'og:image': 'https://assets-cdn.github.com/images/modules/open_graph/github-logo.png',
    title: 'The world’s leading software development platform · GitHub',
    lang: 'en',
    icon: 'https://assets-cdn.github.com/favicon.ico',
    canonical: 'https://github.com/' 
}
*/
});

Example #2

const gmeta = require('gmeta');

let html = '<title>GitHub</title><meta name="description" content="GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 85 million projects.">';

gmeta(html,function(err,data){
    console.log(data);
    /* output =>
    { description: 'GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 85million projects.',
    title: 'GitHub' }
    */
},true);

API

gmeta(source, function(err, obj) {...},isHTML); - Callback Way

source (String): URL or HTML

callback (Function): Callback (err,obj)

isHTML Optional (Boolean [defaut:false]): if source is a HTML you need set it true

gmeta(source,isHTML); - Promise Way

source (String): URL or HTML

isHTML Optional (Boolean [defaut:false]): if source is a HTML you need set it true

Data Supported

  • title
  • description
  • keywords
  • lang
  • manifest
  • canonical
  • icon
  • fluid-icon
  • copyright
  • language
  • robots
  • generator
  • viewport
  • google-site-verification
  • msvalidate.01
  • twitter:card
  • twitter:site
  • twitter:creator
  • twitter:title
  • twitter:description
  • twitter:image
  • summary
  • classification
  • author
  • designer
  • owner
  • url
  • category
  • distribution
  • rating
  • date
  • apple-mobile-web-app-title
  • apple-mobile-web-app-capable
  • apple-touch-fullscreen
  • apple-mobile-web-app-status-bar-style
  • format-detection
  • msapplication-starturl
  • msapplication-window
  • msapplication-navbutton-color
  • application-name
  • msapplication-tooltip
  • msapplication-task
  • application-name
  • msapplication-TileColor
  • msapplication-square70x70logo
  • msapplication-square150x150logo
  • msapplication-wide310x150logo
  • msapplication-square310x310logo
  • msapplication-notification
  • dcterms.creator
  • dc.language
  • dcterms.title
  • dcterms.description
  • csrf-param
  • csrf-token
  • theme-color
  • geo.region
  • geo.position
  • ICBM
  • thumbnail
  • fb:app_id
  • og:url
  • og:type
  • og:title
  • og:description
  • og:image
  • charset
  • hostname
  • google-analytics