Fetch an HTML and parse it as a cheerio object
Clone or download

README.md

fetch-cheerio-object

npm version Build Status Build status Coverage Status

Fetch an HTML and parse it as a cheerio object

const fetchCheerioObject = require('fetch-cheerio-object');

(async () => {
  const $ = await fetchCheerioObject('https://example.org/');
  $('title').text(); //=> 'Example Domain'
})();

Installation

Use npm.

npm install fetch-cheerio-object

API

const fetchCheerioObject = require('fetch-cheerio-object');

fetchCheerioObject(url [, options])

url: string
options: Object (directly passed to cheerio.load)
Return: Object (Promise)

The API is quite similar to the node-fetch's. The only difference between them is that fetch-cheerio-object parses fetched contents as a cheerio object and will be fulfilled with the parsed contents as its first argument.

License

ISC License © 2017 Shinnosuke Watanabe