LincWorld / metafetch

NodeJS package that fetches a given URL's title, description, images, links etc.

Home Page:https://www.npmjs.org/package/metafetch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Coverage Coverage Dependency Status Dev Dependencies Status Known Vulnerabilities

NPM

Metafetch fetches a given URL's title, description, images, links etc.

Installation

Use NPM to install:

npm install metafetch

Usage

var metafetch = require('metafetch');

metafetch.fetch('http://www.facebook.com'[, options], function(err, meta) {
    console.log('title: ', meta.title);
    console.log('description: ', meta.description);
    console.log('type: ', meta.type);
    console.log('url: ', meta.url);
    console.log('siteName: ', meta.siteName);
    console.log('charset: ', meta.charset);
    console.log('image: ', meta.image);
    console.log('meta: ', meta.meta);
    console.log('images: ', meta.images);
    console.log('links: ', meta.links);
});

Optional flags to disable parsing images and links and http timeout or headers

metafetch.fetch('http://www.facebook.com', { flags: { images: false, links: false }, http: { timeout: 30000, headers: {'Accept': '*/*'} } }, function(err, meta) {
    console.log('title: ', meta.title);
    console.log('description: ', meta.description);
    console.log('type: ', meta.type);
    console.log('url: ', meta.url);
    console.log('siteName: ', meta.siteName);
    console.log('charset: ', meta.charset);
    console.log('image: ', meta.image);
    console.log('meta: ', meta.meta);
});

Response Data

  • title : Page title or og:title meta tag.
  • description : Page description or og:description meta tag.
  • image : og:image meta tag.
  • url : Page url or og:url meta tag.
  • uri : Page uri object, parsed by uri-js.
  • images : All images on this page.
  • links : All links on this page.
  • meta : All the meta tags that with a property or name attribute. e.g <meta property="author" content="Example">, <meta name="description" content="Example.">

License

(The MIT License)

Copyright (c) 2017 Afzaalace;

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

NodeJS package that fetches a given URL's title, description, images, links etc.

https://www.npmjs.org/package/metafetch

License:MIT License


Languages

Language:JavaScript 100.0%