# @jitl/recipe-data-scraper

> web scraper for recipe data

Latest version **2.0.0** (published 2022-09-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @jitl/recipe-data-scraper
pnpm add @jitl/recipe-data-scraper
yarn add @jitl/recipe-data-scraper
bun add @jitl/recipe-data-scraper
```

## Health

**Score 35/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2022-09-23 |
| First published | 2022-09-23 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 2.1 MB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 15 |
| Author | Nadine Kinnen |
| Maintainers | jitl |

## Links

- npm: https://www.npmjs.com/package/@jitl/recipe-data-scraper
- Repository: https://github.com/thelifenadine/recipe-data-scraper
- Homepage: https://github.com/thelifenadine/recipe-data-scraper#readme
- Issues: https://github.com/thelifenadine/recipe-data-scraper/issues
- npm.io page: https://npm.io/package/@jitl/recipe-data-scraper

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) 0.25.0
- [cheerio](https://npm.io/package/cheerio.md) 1.0.0-rc.10
- [microdata-node](https://npm.io/package/microdata-node.md) 2.0.0
- [iso8601-duration](https://npm.io/package/iso8601-duration.md) 1.3.0

## Recent versions

- 2.0.0 (latest) — 2022-09-23

## README

[![Build Status](https://travis-ci.com/thelifenadine/recipe-data-scraper.svg?token=zksFH4xCnprxMjskVPuR&branch=master)](https://travis-ci.com/thelifenadine/recipe-data-scraper) [![Coverage Status](https://coveralls.io/repos/github/thelifenadine/recipe-data-scraper/badge.svg?branch=master)](https://coveralls.io/github/thelifenadine/recipe-data-scraper?branch=master)

A node library that takes a given url and scrapes that webpage for recipe data. This library supports websites that utilize either [microdata](https://schema.org/Recipe) or [JSON-LD](https://developers.google.com/search/docs/data-types/recipe). The function returns a promise where on success will return the recipe and on fail will throw an error with the message: 'Could not find recipe data'

```
npm install recipe-data-scraper
```

Example Usage:

```javascript
import recipeDataScraper from  'recipe-data-scraper';

async function (...) {
  try {
    // pass a full url to a page that contains a recipe
    const recipe = await recipeDataScraper(url);
    res.json({ recipe });
  } catch (error) {
    res.status(500).json({ message: err.message });
  }
}

```

Or:

```javascript
import recipeDataScraper from 'recipe-data-scraper';

recipeDataScraper(url)
  .then((recipe) => res.json({ recipe }))
  .catch((err) => res.status(500).json({ message: err.message }));
```

#### Recipe Model:

| property                | type             |
| ----------------------- | ---------------- |
| url                     | string           |
| name                    | string           |
| image                   | string           |
| description             | string           |
| cookTime                | string           |
| cookTimeOriginalFormat  | string           |
| prepTime                | string           |
| prepTimeOriginalFormat  | string           |
| totalTime               | string           |
| totalTimeOriginalFormat | string           |
| recipeYield             | string           |
| recipeIngredients       | array of strings |
| recipeInstructions      | array of strings |
| recipeCategories        | array of strings |
| recipeCuisines          | array of strings |
| recipeTypes             | array of strings |
| keywords                | array of strings |

# CLI:

If you want to try this library without a UI, you can clone it locally and run it via the command line.

```
git clone git@github.com:thelifenadine/recipe-data-scraper.git
npm install
npm run test-url
```

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