{"id":13395387,"url":"https://github.com/cheeriojs/cheerio","last_synced_at":"2026-01-23T18:07:44.997Z","repository":{"id":37664845,"uuid":"2541284","full_name":"cheeriojs/cheerio","owner":"cheeriojs","description":"The fast, flexible, and elegant library for parsing and manipulating HTML and XML.","archived":false,"fork":false,"pushed_at":"2025-05-05T03:37:41.000Z","size":19310,"stargazers_count":29409,"open_issues_count":47,"forks_count":1667,"subscribers_count":357,"default_branch":"main","last_synced_at":"2025-05-05T09:43:31.791Z","etag":null,"topics":["cheerio","dom","hacktoberfest","html","htmlparser","htmlparser2","jquery","parser","scraper","selector"],"latest_commit_sha":null,"homepage":"https://cheerio.js.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cheeriojs.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["cheeriojs","fb55"],"open_collective":"cheerio"}},"created_at":"2011-10-09T04:23:20.000Z","updated_at":"2025-05-05T05:27:48.000Z","dependencies_parsed_at":"2024-01-22T20:15:20.167Z","dependency_job_id":"16ebf69c-02f9-4fd5-b6cd-9ce08391a1aa","html_url":"https://github.com/cheeriojs/cheerio","commit_stats":{"total_commits":3261,"total_committers":159,"mean_commits":20.50943396226415,"dds":"0.41214351425942963","last_synced_commit":"5c2a008adde0e642274069ccc33806f937fcf1d4"},"previous_names":["matthewmueller/cheerio"],"tags_count":65,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fcheerio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fcheerio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fcheerio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cheeriojs%2Fcheerio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cheeriojs","download_url":"https://codeload.github.com/cheeriojs/cheerio/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252474416,"owners_count":21753659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cheerio","dom","hacktoberfest","html","htmlparser","htmlparser2","jquery","parser","scraper","selector"],"created_at":"2024-07-30T17:01:55.850Z","updated_at":"2025-12-12T04:20:33.326Z","avatar_url":"https://github.com/cheeriojs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/cheeriojs","https://github.com/sponsors/fb55","https://opencollective.com/cheerio","https://tidelift.com/subscription/pkg/npm-cheerio"],"categories":["TypeScript","爬虫","GIT 仓库","JavaScript","Packages","包","Repository","🧩 HTML \u0026 XML Parsing","Web 后端","Awesome node-modules list","HTML","Libraries","JavaScript框架","js库(Browser/Nodejs)","命令行","目录","Networking","Miscellaneous","Core Libraries","scraper","Uncategorized","jQuery Tools, Libraries, and Frameworks","jquery","Tools","Node","Number","nodeJS","\u003ca name=\"TypeScript\"\u003e\u003c/a\u003eTypeScript","Node.js","DOM"],"sub_categories":["服务端 DOM","Miscellaneous","杂项","Server-side DOM","Ruby","其他","其他_文本生成、文本对话","redux 扩展","macros","Web","JavaScript/Node.js","Uncategorized","Mesh networks","JavaScript Libraries for Machine Learning","工具库","Related tools","Model"],"readme":"\u003ch1 align=\"center\"\u003echeerio\u003c/h1\u003e\n\n\u003ch5 align=\"center\"\u003eThe fast, flexible, and elegant library for parsing and manipulating HTML and XML.\u003c/h5\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/cheeriojs/cheerio/actions/workflows/ci.yml\"\u003e\n    \u003cimg src=\"https://github.com/cheeriojs/cheerio/actions/workflows/ci.yml/badge.svg\" alt=\"Build Status\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://coveralls.io/github/cheeriojs/cheerio\"\u003e\n    \u003cimg src=\"https://img.shields.io/coveralls/github/cheeriojs/cheerio/main\" alt=\"Coverage\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#backers\"\u003e\n    \u003cimg src=\"https://img.shields.io/opencollective/backers/cheerio\" alt=\"OpenCollective backers\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#sponsors\"\u003e\n    \u003cimg src=\"https://img.shields.io/opencollective/sponsors/cheerio\" alt=\"OpenCollective sponsors\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr\u003e\n\n[中文文档 (Chinese Readme)](https://github.com/cheeriojs/cheerio/wiki/Chinese-README)\n\n```js\nimport * as cheerio from 'cheerio';\nconst $ = cheerio.load('\u003ch2 class=\"title\"\u003eHello world\u003c/h2\u003e');\n\n$('h2.title').text('Hello there!');\n$('h2').addClass('welcome');\n\n$.html();\n//=\u003e \u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003ch2 class=\"title welcome\"\u003eHello there!\u003c/h2\u003e\u003c/body\u003e\u003c/html\u003e\n```\n\n## Installation\n\n`npm install cheerio`\n\n## Features\n\n**\u0026#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**\u0026#991; Blazingly fast:** Cheerio works with a very simple, consistent DOM\nmodel. As a result parsing, manipulating, and rendering are incredibly\nefficient.\n\n**\u0026#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// ESM or TypeScript:\nimport * as cheerio from 'cheerio';\n\n// In other environments:\nconst cheerio = require('cheerio');\n\nconst $ = cheerio.load('\u003cul id=\"fruits\"\u003e...\u003c/ul\u003e');\n\n$.html();\n//=\u003e \u003chtml\u003e\u003chead\u003e\u003c/head\u003e\u003cbody\u003e\u003cul id=\"fruits\"\u003e...\u003c/ul\u003e\u003c/body\u003e\u003c/html\u003e\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//=\u003e Apple\n\n$('ul .pear').attr('class');\n//=\u003e pear\n\n$('li[class=orange]').html();\n//=\u003e 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//=\u003e  \u003chtml\u003e\n//      \u003chead\u003e\u003c/head\u003e\n//      \u003cbody\u003e\n//        \u003cul id=\"fruits\"\u003e\n//          \u003cli class=\"apple\"\u003eApple\u003c/li\u003e\n//          \u003cli class=\"orange\"\u003eOrange\u003c/li\u003e\n//          \u003cli class=\"pear\"\u003ePear\u003c/li\u003e\n//        \u003c/ul\u003e\n//      \u003c/body\u003e\n//    \u003c/html\u003e\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//=\u003e \u003cli class=\"pear\"\u003ePear\u003c/li\u003e\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 \u003cem\u003econtent\u003c/em\u003e.');\n$('body').text();\n//=\u003e 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\u003e This video tutorial is a follow-up to Nettut's \"How to Scrape Web Pages with\n\u003e Node.js and jQuery\", using cheerio instead of JSDOM + jQuery. This video shows\n\u003e how easy it is to use cheerio and how much faster cheerio is than JSDOM +\n\u003e 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\u003c!-- BEGIN SPONSORS: headliner --\u003e\n\n\u003ca href=\"https://tidelift.com/subscription/pkg/npm-cheerio\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fgithub.com%2Ftidelift.png?ixlib=js-3.8.0\u0026w=128\u0026h=128\u0026fit=fillmax\u0026fill=solid\u0026s=0713e6ee5c7ab01e7559df695c1e8cd9\" title=\"Tidelift\" alt=\"Tidelift\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\u003ca href=\"https://github.com/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fgithub.com%2Fgithub.png?ixlib=js-3.8.0\u0026w=128\u0026h=128\u0026fit=fillmax\u0026fill=solid\u0026s=a1e87ca289de84eb32ea85432cf8ad11\" title=\"Github\" alt=\"Github\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\u003ca href=\"https://www.airbnb.com/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"128px\" width=\"128px\" src=\"https://humble.imgix.net/https%3A%2F%2Fgithub.com%2Fairbnb.png?ixlib=js-3.8.0\u0026w=128\u0026h=128\u0026fit=fillmax\u0026fill=solid\u0026s=384cad45e10faea516202ad10801f895\" title=\"AirBnB\" alt=\"AirBnB\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\n\u003c!-- END SPONSORS --\u003e\n\n**Other Sponsors**\n\n\u003c!-- BEGIN SPONSORS: sponsor --\u003e\n\n\u003ca href=\"https://betking.com.ua/games/all-slots/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"64px\" width=\"64px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Figrovye-avtomaty-ua%2F96bfde3%2Flogo.png?ixlib=js-3.8.0\u0026w=64\u0026h=64\u0026fit=fillmax\u0026fill=solid\u0026s=07091c88a0b859ecaa81ef10fadf3075\" title=\"Ігрові автомати\" alt=\"Ігрові автомати\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\u003ca href=\"https://onlinecasinosspelen.com\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"64px\" width=\"64px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fonlinecasinosspelen%2F4ce3830%2Flogo.png?ixlib=js-3.8.0\u0026w=64\u0026h=64\u0026fit=fillmax\u0026fill=solid\u0026s=60e5dd9f3993a754d0e5d47a43ff7462\" title=\"OnlineCasinosSpelen\" alt=\"OnlineCasinosSpelen\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\u003ca href=\"https://casinoZonderregistratie.net/\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"64px\" width=\"64px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fczrnet%2F24e6252%2Flogo.png?ixlib=js-3.8.0\u0026w=64\u0026h=64\u0026fit=fillmax\u0026fill=solid\u0026s=d9b81b3c39bca4d3a8f279e79c5eec8d\" title=\"CasinoZonderRegistratie.net\" alt=\"CasinoZonderRegistratie.net\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\u003ca href=\"https://Nieuwe-Casinos.net\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"64px\" width=\"64px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fnieuwecasinos%2Fee150d6%2Flogo.png?ixlib=js-3.8.0\u0026w=64\u0026h=64\u0026fit=fillmax\u0026fill=solid\u0026s=c2663f8b5dcfc983ef5641028d7b430b\" title=\"Nieuwe-Casinos.net\" alt=\"Nieuwe-Casinos.net\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\n\u003c!-- END SPONSORS --\u003e\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\u003c!-- BEGIN SPONSORS: backer --\u003e\n\n\u003ca href=\"https://kafidoff.com\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"64px\" width=\"64px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fkafidoff-vasy%2Fd7ff85c%2Favatar.png?ixlib=js-3.8.0\u0026w=64\u0026h=64\u0026fit=fillmax\u0026fill=solid\u0026s=a41c66c2f9b1d3a7a241e425e7aa2d09\" title=\"Vasy Kafidoff\" alt=\"Vasy Kafidoff\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\u003ca href=\"https://medium.com/norch\" target=\"_blank\" rel=\"noopener noreferrer\"\u003e\n            \u003cimg height=\"48px\" width=\"48px\" src=\"https://humble.imgix.net/https%3A%2F%2Fimages.opencollective.com%2Fespenklem%2F7e8cd40%2Favatar.png?ixlib=js-3.8.0\u0026w=48\u0026h=48\u0026fit=fillmax\u0026fill=solid\u0026s=f727bc0f59d1738188ec8e4499123149\" title=\"Espen Klem\" alt=\"Espen Klem\"\u003e\u003c/img\u003e\n          \u003c/a\u003e\n\n\u003c!-- END SPONSORS --\u003e\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheeriojs%2Fcheerio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcheeriojs%2Fcheerio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcheeriojs%2Fcheerio/lists"}