New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

metaget

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metaget

A Node.js module to fetch HTML meta tags (including Open Graph) from a remote URL

  • 1.0.7
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

metaget

A Node.js module to fetch HTML meta tags (including Open Graph) from a remote URL

Github stars

Actions Status

Installation

npm install metaget --save

Usage

Promise:

const metaget = require('metaget');
try{
    const metaResponse = await metaget.fetch('https://wordpress.com');
    console.log('metaResponse', metaResponse);
}catch(ex){
    console.log('Fail', ex);
}

Callback:

const metaget = require('metaget');
metaget.fetch('https://wordpress.com', (err, metaResponse) => {
    if(err){
        console.log(err);
    }else{
        console.log(metaResponse);
    }
});

Response will be an Object containing all the meta tags from the URL. All tags are output in the example above. Some tags with illegal characters can be accessed by:

metaResponse['og:title'];

Options

It's possible to set any HTTP headers in the request. This can be done by specifying them as options in the call. If no options are provided the only default header is a User-Agent of "request".

This is how you would specify a "User-Agent" of a Google Bot:

try{
    const metaResponse = await metaget.fetch('https://wordpress.com', { headers: { 'User-Agent': 'Googlebot' } });
    console.log('metaResponse', metaResponse);
}catch(ex){
    console.log('Fail', ex);
}

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Keywords

FAQs

Package last updated on 04 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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