{"_id":"@divriots/cheerio","_rev":"5-5f4e0eb5d88bace907509f17de3d73ca","name":"@divriots/cheerio","dist-tags":{"latest":"1.0.0-rc.12"},"versions":{"1.0.0-rc.12":{"name":"@divriots/cheerio","version":"1.0.0-rc.12","keywords":["htmlparser","jquery","selector","scraper","parser","dom","xml","html"],"author":{"name":"Matt Mueller","email":"mattmuelle@gmail.com"},"license":"MIT","_id":"@divriots/cheerio@1.0.0-rc.12","maintainers":[{"name":"muryoh","email":"muryoh@gmail.com"},{"name":"gqio","email":"quinio.gregory@gmail.com"},{"name":"georges-gomes","email":"georges.gomes@gmail.com"},{"name":"gluck","email":"francois.valdy@gmail.com"},{"name":"_divriots_","email":"admin+npm@divriots.com"}],"homepage":"https://cheerio.js.org/","bugs":{"url":"https://github.com/cheeriojs/cheerio/issues"},"dist":{"shasum":"d8561ad12d97be8bad22e681f1e21b1e45165a55","tarball":"https://registry.npmjs.org/@divriots/cheerio/-/cheerio-1.0.0-rc.12.tgz","fileCount":140,"integrity":"sha512-kQUVEgMDj0yE7LOdrDhKOC8JkfUzUKsUqp8m9WQDiSxim8Bnga+80opjXaCtHLhO3/W3DIZMow8QXtXUqNS+zA==","signatures":[{"sig":"MEYCIQCPbnJlOIpgsWsx0AV31oKIhwoierDLZkH2Y8RIRG4ixAIhAOVcVaBHMPqRH9ujJ2yEBJ4zHHtLh/y/DfcAqZiNJCR1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":620676},"jest":{"preset":"ts-jest","testEnvironment":"node","coverageProvider":"v8","moduleNameMapper":{"^(.*)\\.js$":["$1.js","$1"]},"testPathIgnorePatterns":["/__fixtures__/"]},"main":"lib/index.js","types":"lib/index.d.ts","module":"lib/esm/index.js","engines":{"node":">= 6"},"exports":{".":{"import":{"node":"./lib/esm/batteries.js","default":"./lib/esm/index.js"},"require":"./lib/index.js"},"./lib/slim":{"import":"./lib/esm/slim.js","require":"./lib/slim.js"},"./lib/utils":{"import":"./lib/esm/utils.js","require":"./lib/utils.js"},"./lib/batteries":{"import":"./lib/esm/batteries.js","require":"./lib/batteries.js"}},"funding":"https://github.com/cheeriojs/cheerio?sponsor=1","gitHead":"37fdde71931b61a5c13a4bd007572accff599e8a","scripts":{"lint":"npm run lint:es && npm run lint:prettier","test":"npm run lint && npm run test:jest","bench":"npm run benchmark","build":"npm run build:cjs && npm run build:esm","format":"npm run format:es && npm run format:prettier","lint:es":"eslint --ignore-path .gitignore .","prepare":"husky install","benchmark":"npm run build:cjs && ts-node benchmark/benchmark.ts --regex \"^(?!.*highmem)\"","build:cjs":"tsc --sourceRoot https://raw.githubusercontent.com/cheeriojs/cheerio/$(git rev-parse HEAD)/src/","build:esm":"npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json","format:es":"npm run lint:es -- --fix","test:jest":"jest","lint:prettier":"npm run format:prettier:raw -- --check","test:jest:cov":"npm run test:jest -- --coverage","prepublishOnly":"npm run build","format:prettier":"npm run format:prettier:raw -- --write","update-sponsors":"ts-node --esm -TO '{\"module\":\"node16\",\"target\":\"es2019\"}' scripts/fetch-sponsors.mts","format:prettier:raw":"prettier \"**/*.{{m,c,}{j,t}s{x,},md,json,yml}\" --ignore-path .gitignore"},"_npmUser":{"name":"georges-gomes","email":"georges.gomes@gmail.com"},"prettier":{"tsdoc":true,"tabWidth":2,"proseWrap":"always","singleQuote":true},"repository":{"url":"git://github.com/cheeriojs/cheerio.git","type":"git"},"_npmVersion":"8.19.2","description":"The fast, flexible & elegant library for parsing and manipulating HTML and XML.","directories":{},"lint-staged":{"*.js":["prettier --write","npm run lint:es -- --fix"],"*.{json,md,ts,yml}":["prettier --write"]},"_nodeVersion":"16.18.0","dependencies":{"parse5":"^7.1.2","undici":"^5.22.1","domutils":"^3.1.0","domhandler":"^5.0.3","htmlparser2":"^9.0.0","cheerio-select":"^2.1.0","dom-serializer":"^2.0.0","whatwg-mimetype":"^3.0.0","encoding-sniffer":"^0.0.2","parse5-parser-stream":"^7.1.2","parse5-htmlparser2-tree-adapter":"^7.0.0"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","husky":"^8.0.3","jsdom":"^22.0.0","eslint":"^8.40.0","jquery":"^3.7.0","ts-jest":"^29.1.0","ts-node":"^10.9.1","prettier":"^2.8.8","benchmark":"^2.1.4","typescript":"^5.0.4","@types/jest":"^29.5.1","@types/node":"^20.1.3","lint-staged":"^13.2.2","@types/jsdom":"^21.1.1","@imgix/js-core":"^3.8.0","eslint-plugin-n":"^15.7.0","@octokit/graphql":"^5.0.5","@types/benchmark":"^2.1.2","eslint-plugin-jest":"^27.2.1","eslint-plugin-jsdoc":"^44.2.3","eslint-plugin-unicorn":"^47.0.0","prettier-plugin-jsdoc":"0.4.2","@types/whatwg-mimetype":"^3.0.0","eslint-config-prettier":"^8.8.0","@typescript-eslint/parser":"^5.59.5","eslint-plugin-expect-type":"^0.2.3","@typescript-eslint/eslint-plugin":"^5.59.5"},"_npmOperationalInternal":{"tmp":"tmp/cheerio_1.0.0-rc.12_1683907117130_0.38500735721498436","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-05-12T15:58:37.024Z","modified":"2025-09-03T07:23:58.753Z","1.0.0-rc.12":"2023-05-12T15:58:37.311Z"},"bugs":{"url":"https://github.com/cheeriojs/cheerio/issues"},"author":{"name":"Matt Mueller","email":"mattmuelle@gmail.com"},"license":"MIT","homepage":"https://cheerio.js.org/","keywords":["htmlparser","jquery","selector","scraper","parser","dom","xml","html"],"repository":{"url":"git://github.com/cheeriojs/cheerio.git","type":"git"},"description":"The fast, flexible & elegant library for parsing and manipulating HTML and XML.","maintainers":[{"email":"quinio.gregory@gmail.com","name":"gqio"},{"email":"francois.valdy@gmail.com","name":"gluck"},{"email":"georges.gomes@gmail.com","name":"georges-gomes"},{"email":"muryoh@gmail.com","name":"muryoh"},{"email":"admin+npm@divriots.com","name":"_divriots_"}],"readme":"<h1 align=\"center\">cheerio</h1>\n\n<h5 align=\"center\">The fast, flexible, and elegant library for parsing and manipulating HTML and XML.</h5>\n\n<div align=\"center\">\n  <a href=\"https://github.com/cheeriojs/cheerio/actions/workflows/ci.yml\">\n    <img src=\"https://github.com/cheeriojs/cheerio/actions/workflows/ci.yml/badge.svg\" alt=\"Build Status\">\n  </a>\n  <a href=\"https://coveralls.io/github/cheeriojs/cheerio\">\n    <img src=\"https://img.shields.io/coveralls/github/cheeriojs/cheerio/main\" alt=\"Coverage\">\n  </a>\n  <a href=\"#backers\">\n    <img src=\"https://img.shields.io/opencollective/backers/cheerio\" alt=\"OpenCollective backers\">\n  </a>\n  <a href=\"#sponsors\">\n    <img src=\"https://img.shields.io/opencollective/sponsors/cheerio\" alt=\"OpenCollective sponsors\">\n  </a>\n</div>\n\n<br>\n\n[中文文档 (Chinese Readme)](https://github.com/cheeriojs/cheerio/wiki/Chinese-README)\n\n```js\nconst cheerio = require('cheerio');\nconst $ = cheerio.load('<h2 class=\"title\">Hello world</h2>');\n\n$('h2.title').text('Hello there!');\n$('h2').addClass('welcome');\n\n$.html();\n//=> <html><head></head><body><h2 class=\"title welcome\">Hello there!</h2></body></html>\n```\n\n## Installation\n\n`npm install cheerio`\n\n## Features\n\n**&#10084; Proven syntax:** Cheerio implements a subset of core jQuery. Cheerio\nremoves all the DOM inconsistencies and browser cruft from the jQuery library,\nrevealing its truly gorgeous API.\n\n**&#991; Blazingly fast:** Cheerio works with a very simple, consistent DOM\nmodel. As a result parsing, manipulating, and rendering are incredibly\nefficient.\n\n**&#10049; Incredibly flexible:** Cheerio wraps around\n[parse5](https://github.com/inikulin/parse5) for parsing HTML and can optionally\nuse the forgiving [htmlparser2](https://github.com/fb55/htmlparser2/). Cheerio\ncan parse nearly any HTML or XML document. Cheerio works in both browser and\nserver environments.\n\n## API\n\n### Loading\n\nFirst you need to load in the HTML. This step in jQuery is implicit, since\njQuery operates on the one, baked-in DOM. With Cheerio, we need to pass in the\nHTML document.\n\n```js\n// ES6 or TypeScript:\nimport * as cheerio from 'cheerio';\n\n// In other environments:\nconst cheerio = require('cheerio');\n\nconst $ = cheerio.load('<ul id=\"fruits\">...</ul>');\n\n$.html();\n//=> <html><head></head><body><ul id=\"fruits\">...</ul></body></html>\n```\n\n### Selectors\n\nOnce you've loaded the HTML, you can use jQuery-style selectors to find elements\nwithin the document.\n\n#### \\$( selector, [context], [root] )\n\n`selector` searches within the `context` scope which searches within the `root`\nscope. `selector` and `context` can be a string expression, DOM Element, array\nof DOM elements, or cheerio object. `root`, if provided, is typically the HTML\ndocument string.\n\nThis selector method is the starting point for traversing and manipulating the\ndocument. Like in jQuery, it's the primary method for selecting elements in the\ndocument.\n\n```js\n$('.apple', '#fruits').text();\n//=> Apple\n\n$('ul .pear').attr('class');\n//=> pear\n\n$('li[class=orange]').html();\n//=> Orange\n```\n\n### Rendering\n\nWhen you're ready to render the document, you can call the `html` method on the\n\"root\" selection:\n\n```js\n$.root().html();\n//=>  <html>\n//      <head></head>\n//      <body>\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//      </body>\n//    </html>\n```\n\nIf you want to render the\n[`outerHTML`](https://developer.mozilla.org/en-US/docs/Web/API/Element/outerHTML)\nof a selection, you can use the `outerHTML` prop:\n\n```js\n$('.pear').prop('outerHTML');\n//=> <li class=\"pear\">Pear</li>\n```\n\nYou may also render the text content of a Cheerio object using the `text`\nmethod:\n\n```js\nconst $ = cheerio.load('This is <em>content</em>.');\n$('body').text();\n//=> This is content.\n```\n\n### The \"DOM Node\" object\n\nCheerio collections are made up of objects that bear some resemblance to\n[browser-based DOM nodes](https://developer.mozilla.org/en-US/docs/Web/API/Node).\nYou can expect them to define the following properties:\n\n- `tagName`\n- `parentNode`\n- `previousSibling`\n- `nextSibling`\n- `nodeValue`\n- `firstChild`\n- `childNodes`\n- `lastChild`\n\n## Screencasts\n\n[https://vimeo.com/31950192](https://vimeo.com/31950192)\n\n> This video tutorial is a follow-up to Nettut's \"How to Scrape Web Pages with\n> Node.js and jQuery\", using cheerio instead of JSDOM + jQuery. This video shows\n> how easy it is to use cheerio and how much faster cheerio is than JSDOM +\n> jQuery.\n\n## Cheerio in the real world\n\nAre you using cheerio in production? Add it to the\n[wiki](https://github.com/cheeriojs/cheerio/wiki/Cheerio-in-Production)!\n\n## Sponsors\n\nDoes your company use Cheerio in production? Please consider\n[sponsoring this project](https://github.com/cheeriojs/cheerio?sponsor=1)! Your\nhelp will allow maintainers to dedicate more time and resources to its\ndevelopment and support.\n\n**Headlining Sponsors**\n\n<!-- BEGIN SPONSORS: headliner -->\n\n<a href=\"https://tidelift.com/subscription/pkg/npm-cheerio\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fgithub.com%2Ftidelift.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=0713e6ee5c7ab01e7559df695c1e8cd9\" title=\"Tidelift\" alt=\"Tidelift\"></img>\n          </a>\n<a href=\"https://github.com/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fgithub.com%2Fgithub.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=a1e87ca289de84eb32ea85432cf8ad11\" title=\"Github\" alt=\"Github\"></img>\n          </a>\n<a href=\"https://www.airbnb.com/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fgithub.com%2Fairbnb.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=384cad45e10faea516202ad10801f895\" title=\"AirBnB\" alt=\"AirBnB\"></img>\n          </a>\n\n<!-- END SPONSORS -->\n\n**Other Sponsors**\n\n<!-- BEGIN SPONSORS: sponsor -->\n\n<a href=\"https://cryptocasinos.com/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fcryptocasinos%2F99b168e%2Flogo.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=66c6bbd273ae37878a1153769aeb7957\" title=\"CryptoCasinos\" alt=\"CryptoCasinos\"></img>\n          </a>\n<a href=\"https://www.casinoonlineaams.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fcasinoonlineaamscom%2Fc59b0fd%2Flogo.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=6f9d59f0947d7b55b0a4fbd06406d2fc\" title=\"Casinoonlineaams.com\" alt=\"Casinoonlineaams.com\"></img>\n          </a>\n<a href=\"https://apify.com/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F24586296%3Fv%3D4%26s%3D128?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=73d130c03482028ce54fd0871484d6a8\" title=\"Apify\" alt=\"Apify\"></img>\n          </a>\n<a href=\"https://freebets.ltd.uk/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Ffreebets%2Fe21c41b%2Flogo.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=c7a5b478fd31853084925dabf9b33208\" title=\"freebets.ltd.uk\" alt=\"freebets.ltd.uk\"></img>\n          </a>\n<a href=\"https://casinoutansvensklicens.co/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fcasino-utan-svensk-licens3%2Ff7e9357%2Flogo.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=bbd28616e8de4d3e0609059e52db734b\" title=\"Casino utan svensk licens\" alt=\"Casino utan svensk licens\"></img>\n          </a>\n<a href=\"https://coolspins.net/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fcasino-utan-svensk-licens1%2F63947bf%2Flogo.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=5adf54d459567730d1526f1d68a2c964\" title=\"Casino Utan Svensk Licens\" alt=\"Casino Utan Svensk Licens\"></img>\n          </a>\n<a href=\"https://www.zenrows.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fzenrows%2F3199d4b%2Flogo.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=e38415a8afd74473287be5630a341033\" title=\"ZenRows\" alt=\"ZenRows\"></img>\n          </a>\n<a href=\"https://scommessesportivemania.com/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fscommessesportivemania-com%2Fe6941a3%2Favatar.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=01163c3c0aa2f757ab641e6e44ff0e6d\" title=\"Scommessesportivemania.com\" alt=\"Scommessesportivemania.com\"></img>\n          </a>\n<a href=\"https://casinosicuri.info/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fcasinosicuri-info%2F5dc691c%2Favatar.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=fd570730894e259b3af3a26a8fb3a8da\" title=\"Casinosicuri.info\" alt=\"Casinosicuri.info\"></img>\n          </a>\n\n<!-- END SPONSORS -->\n\n## Backers\n\n[Become a backer](https://github.com/cheeriojs/cheerio?sponsor=1) to show your\nsupport for Cheerio and help us maintain and improve this open source project.\n\n<!-- BEGIN SPONSORS: backer -->\n\n<a href=\"https://kafidoff.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fkafidoff-vasy%2Fd7ff85c%2Favatar.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=5f86412e7c79219385b275aaa4ee5e65\" title=\"Vasy Kafidoff\" alt=\"Vasy Kafidoff\"></img>\n          </a>\n<a href=\"https://medium.com/norch\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fespenklem%2F6075b19%2Favatar.png?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=c864d312e848f4e1ec19480e96503c06\" title=\"Espen Klem\" alt=\"Espen Klem\"></img>\n          </a>\n<a href=\"https://github.com/gauthamchandra\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F5430280%3Fu%3D1115bcd3ed7aa8b2a62ff28f62ee4c2b92729903%26v%3D4%26s%3D128?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=60101476ca98f2b4a3dd62f577a1ad66\" title=\"Gautham Chandra\" alt=\"Gautham Chandra\"></img>\n          </a>\n<a href=\"https://jarrodldavis.com\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F235875%3Fv%3D4%26s%3D128?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=653fd0868005d83df43e78488589ad4a\" title=\"Jarrod Davis\" alt=\"Jarrod Davis\"></img>\n          </a>\n<a href=\"http://www.dr-chuck.com/\" target=\"_blank\" rel=\"noopener noreferrer\">\n            <img height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Favatars.githubusercontent.com%2Fu%2F1197222%3Fu%3Dd6dc85c064736ab851c6d9e3318dcdd1be00fb2c%26v%3D4%26s%3D128?ixlib=js-3.8.0&w=128&h=128&fit=fillmax&fill=solid&s=e68caf732c2bbe4fcd0a59bcb751bd4d\" title=\"Charles Severance\" alt=\"Charles Severance\"></img>\n          </a>\n\n<!-- END SPONSORS -->\n\n## Special Thanks\n\nThis library stands on the shoulders of some incredible developers. A special\nthanks to:\n\n**&#8226; @fb55 for htmlparser2 & css-select:** Felix has a knack for writing\nspeedy parsing engines. He completely re-wrote both @tautologistic's\n`node-htmlparser` and @harry's `node-soupselect` from the ground up, making both\nof them much faster and more flexible. Cheerio would not be possible without his\nfoundational work\n\n**&#8226; @jQuery team for jQuery:** The core API is the best of its class and\ndespite dealing with all the browser inconsistencies the code base is extremely\nclean and easy to follow. Much of cheerio's implementation and documentation is\nfrom jQuery. Thanks guys.\n\n**&#8226; @tj:** The style, the structure, the open-source\"-ness\" of this\nlibrary comes from studying TJ's style and using many of his libraries. This\ndude consistently pumps out high-quality libraries and has always been more than\nwilling to help or answer questions. You rock TJ.\n\n## License\n\nMIT\n","readmeFilename":"Readme.md"}