# minimal-metainspector

> NPM package for scraping given URL and give its title, image, description and keywords (if any). Ideal for generating preview from links.

Latest version **1.1.1** (published 2015-04-23) · 0 weekly downloads

## Install

```sh
npm install minimal-metainspector
pnpm add minimal-metainspector
yarn add minimal-metainspector
bun add minimal-metainspector
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2015-04-23 |
| First published | 2015-04-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.4.0 |
| Dependencies | 3 |
| Known vulnerabilities | 0 (+3 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ketan Bhatt |
| Maintainers | ketanbhatt |
| Keywords | scraping, preview generation, parse, url meta |

## Links

- npm: https://www.npmjs.com/package/minimal-metainspector
- Repository: https://github.com/ketanbhatt/node-metainspector
- Homepage: http://github.com/ketanbhatt/node-metainspector
- Issues: https://github.com/ketanbhatt/node-metainspector/issues
- npm.io page: https://npm.io/package/minimal-metainspector

## Dependencies (3)

- [uri-js](https://npm.io/package/uri-js.md) 1.4.2
- [cheerio](https://npm.io/package/cheerio.md) 0.10.8
- [request](https://npm.io/package/request.md) 2.20.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2015-04-23
- 1.0.1 — 2015-04-22
- 1.0.0 — 2015-04-22

## README

### Node-Metainspector

minimal-metainspector is forked and modified from the node-metainspector package by [gabceb](http://github.com/gabceb/node-metainspector)

### Scraped data

```
client.url                	# URL of the page
client.scheme             	# Scheme of the page (http, https)
client.host               	# Hostname of the page (like, markupvalidator.com, without the scheme)
client.rootUrl 			  	# Root url (scheme + host, i.e http://simple.com/)
client.title              	# title of the page, as string
client.description        	# returns the meta description, or the first long paragraph if no meta description is found
client.image              	# Most relevant image, if defined with og:image
client.keywords				# All keywords if defined in the Meta tag. 

```

## Usage

```javascript
var MetaInspector = require('minimal-metainspector');
var client = new MetaInspector("http://www.google.com", {});

client.on("fetch", function(){
    console.log(client.image);
});

client.on("error", function(err){
	console.log(error);
});

client.fetch();

```

## Generate Previews from Links (using Express)

```javascript
var express = require('express');
var router = express.Router();

var MetaInspector = require('minimal-metainspector');

router.get('/', function (req, res) {

	var client = new MetaInspector(req.query.url, {});
 
	client.on("fetch", function(){
		var details = {
			"title": client.title,
			"description": client.description,
			"keywords": client.keywords,
			"image": client.image
		}
		res.json(details);
	});
	 
	client.on("error", function(err){
	    console.log(error);
	});
	 
	client.fetch();

})


module.exports = router;

```

Copyright (c) 2015 Ketan Bhatt, released under the MIT license

---
_Source: https://npm.io/package/minimal-metainspector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
