Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/fetch-cheerio-object
Fetch an HTML and parse it as a cheerio object
https://github.com/shinnn/fetch-cheerio-object
async cheerio fetch get html javascript nodejs parse promise request
Last synced: 26 days ago
JSON representation
Fetch an HTML and parse it as a cheerio object
- Host: GitHub
- URL: https://github.com/shinnn/fetch-cheerio-object
- Owner: shinnn
- License: isc
- Created: 2014-04-20T04:49:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-12-16T18:46:41.000Z (almost 6 years ago)
- Last Synced: 2024-10-16T19:42:03.843Z (28 days ago)
- Topics: async, cheerio, fetch, get, html, javascript, nodejs, parse, promise, request
- Language: JavaScript
- Homepage:
- Size: 64.5 KB
- Stars: 6
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# fetch-cheerio-object
[![npm version](https://img.shields.io/npm/v/fetch-cheerio-object.svg)](https://www.npmjs.com/package/fetch-cheerio-object)
[![Build Status](https://travis-ci.com/shinnn/fetch-cheerio-object.svg?branch=master)](https://travis-ci.com/shinnn/fetch-cheerio-object)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/fetch-cheerio-object.svg)](https://coveralls.io/github/shinnn/fetch-cheerio-object?branch=master)A [Node.js](https://nodejs.org/) module to [fetch](https://fetch.spec.whatwg.org/) an HTML and parse it as a [cheerio](https://cheerio.js.org/) object
```javascript
const fetchCheerioObject = require('fetch-cheerio-object');(async () => {
const $ = await fetchCheerioObject('https://example.org/');
$('title').text(); //=> 'Example Domain'
})();
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install fetch-cheerio-object
```## API
```javascript
const fetchCheerioObject = require('fetch-cheerio-object');
```### fetchCheerioObject(*url* [, *options*])
*url*: `string`
*options*: `Object` (directly passed to [`cheerio.load()`](https://github.com/cheeriojs/cheerio#loading))
Return: `Promise`The API is quite similar to the [node-fetch](https://github.com/bitinn/node-fetch)'s. The only difference between them is that *fetch-cheerio-object* parses fetched contents as a [cheerio](https://github.com/cheeriojs/cheerio) object and returns a `Promise` for it.
## License
[ISC License](./LICENSE) © 2017 - 2018 Shinnosuke Watanabe