52 lines
25 KiB
JSON
52 lines
25 KiB
JSON
|
{
|
||
|
"name": "cheerio",
|
||
|
"version": "0.17.0",
|
||
|
"description": "Tiny, fast, and elegant implementation of core jQuery designed specifically for the server",
|
||
|
"author": {
|
||
|
"name": "Matt Mueller",
|
||
|
"email": "mattmuelle@gmail.com",
|
||
|
"url": "mat.io"
|
||
|
},
|
||
|
"keywords": [
|
||
|
"htmlparser",
|
||
|
"jquery",
|
||
|
"selector",
|
||
|
"scraper",
|
||
|
"parser",
|
||
|
"html"
|
||
|
],
|
||
|
"repository": {
|
||
|
"type": "git",
|
||
|
"url": "git://github.com/MatthewMueller/cheerio.git"
|
||
|
},
|
||
|
"main": "./index.js",
|
||
|
"engines": {
|
||
|
"node": ">= 0.6"
|
||
|
},
|
||
|
"dependencies": {
|
||
|
"CSSselect": "~0.4.0",
|
||
|
"entities": "~1.1.1",
|
||
|
"htmlparser2": "~3.7.2",
|
||
|
"dom-serializer": "~0.0.0",
|
||
|
"lodash": "~2.4.1"
|
||
|
},
|
||
|
"devDependencies": {
|
||
|
"benchmark": "~1.0.0",
|
||
|
"expect.js": "~0.3.1",
|
||
|
"jsdom": "~0.8.9",
|
||
|
"jshint": "~2.3.0",
|
||
|
"mocha": "*",
|
||
|
"xyz": "~0.3.0"
|
||
|
},
|
||
|
"scripts": {
|
||
|
"test": "make test"
|
||
|
},
|
||
|
"readme": "# cheerio [![Build Status](https://secure.travis-ci.org/cheeriojs/cheerio.svg?branch=master)](http://travis-ci.org/cheeriojs/cheerio)\n\nFast, flexible, and lean implementation of core jQuery designed specifically for the server.\n\n## Introduction\nTeach your server HTML.\n\n```js\nvar cheerio = require('cheerio'),\n $ = cheerio.load('<h2 class=\"title\">Hello world</h2>');\n\n$('h2.title').text('Hello there!');\n$('h2').addClass('welcome');\n\n$.html();\n//=> <h2 class=\"title welcome\">Hello there!</h2>\n```\n\n## Installation\n`npm install cheerio`\n\n## Features\n__❤ Familiar syntax:__\nCheerio implements a subset of core jQuery. Cheerio removes all the DOM inconsistencies and browser cruft from the jQuery library, revealing its truly gorgeous API.\n\n__ϟ Blazingly fast:__\nCheerio works with a very simple, consistent DOM model. As a result parsing, manipulating, and rendering are incredibly efficient. Preliminary end-to-end benchmarks suggest that cheerio is about __8x__ faster than JSDOM.\n\n__❁ Incredibly flexible:__\nCheerio wraps around @FB55's forgiving [htmlparser2](https://github.com/fb55/htmlparser2/). Cheerio can parse nearly any HTML or XML document.\n\n## What about JSDOM?\nI wrote cheerio because I found myself increasingly frustrated with JSDOM. For me, there were three main sticking points that I kept running into again and again:\n\n__• JSDOM's built-in parser is too strict:__\n JSDOM's bundled HTML parser cannot handle many popular sites out there today.\n\n__• JSDOM is too slow:__\nParsing big websites with JSDOM has a noticeable delay.\n\n__• JSDOM feels too heavy:__\nThe goal of JSDOM is to provide an identical DOM environment as what we see in the browser. I never really needed all this, I just wanted a simple, familiar way to do HTML manipulation.\n\n## When I would use JSDOM\n\nCheerio will not solve all your problems. I would still use JSDOM if I needed to work in a browser-like environment on the server, particularly if I wanted to automate functional tests.\n\n## API\n\n### Markup example we'll be using:\n\n```html\n<ul id=\"fruits\">\n <li class=\"apple\">Apple</li>\n <li class=\"orange\">Orange</li>\n <li class=\"pear\">Pear</li>\n</ul>\n```\n\nThis is the HTML markup we will be using in all of the API examples.\n\n### Loading\nFirst you need to load in the HTML. This step in jQuery is implicit, since jQuery operates on the one, baked-in DOM. With Cheerio, we need to pass in the HTML document.\n\nThis is the _preferred_ method:\n\n```js\nvar cheerio = require('cheerio'),\n $ = cheerio.load('<ul id=\"fruits\">...</ul>');\n```\n\nOptionally, you can also load in the HTML by passing the string as the context:\n\n```js\n$ = require('cheerio');\n$('ul', '<ul id=\"fruits\">...</ul>');\n```\n\nOr as the root:\n\n```js\n$ = require('cheerio');\n$('li', 'ul', '<ul id=\"fruits\">...</ul>');\n```\n\nYou can also pass an extra object to `.load()` if you need to modify any\nof the default parsing options:\n\n```js\n$ = cheerio.load('<ul id=\"fruits\">...</ul>', {\n normalizeWhitespace: true,\n xmlMode: true\n});\n```\n\nThese parsing options are taken directly from [htmlparser2](https://github.com/fb55/htmlparser2/wiki/Parser-options), therefore any options that can be used in `htmlparser2` are valid in cheerio as well. The default options are:\n\n```js\n{\n normalizeWhitespace: false,\n xmlMode: false,\n decodeEntities: true\n}\n\n```\n\nFor a full list of options and their effects, see [this](https://github.com/fb55/DomHandler) and\n[htmlparser2's options](https://github.com/fb55/htmlparser2/wiki/Parser-options).\n\n### Selectors\n\nCheerio's selector implementation is nearly identical to jQuery's, so the API is very similar.\n\n#### $( selector, [context], [root] )\n`selector` searches within the `context` scope which searches within the `root` scope. `selector` and `context` can be an string expression, DOM Element, array of DOM elements, or cheerio object. `root` is typically the HTML document string.\n\nThis selector met
|
||
|
"readmeFilename": "Readme.md",
|
||
|
"bugs": {
|
||
|
"url": "https://github.com/MatthewMueller/cheerio/issues"
|
||
|
},
|
||
|
"_id": "cheerio@0.17.0",
|
||
|
"_from": "cheerio@"
|
||
|
}
|