{"id":26638042,"url":"https://github.com/luminati-io/html-parsing-libraries","last_synced_at":"2026-04-14T10:33:01.135Z","repository":{"id":283783995,"uuid":"919507172","full_name":"luminati-io/HTML-parsing-libraries","owner":"luminati-io","description":"The best HTML parsing libraries for web scraping, comparing features like CSS selector and XPath support across popular tools like jsoup, Nokogiri, and Cheerio.","archived":false,"fork":false,"pushed_at":"2025-01-20T14:39:46.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-22T07:02:01.543Z","etag":null,"topics":["beautifulsoup","cheerio","cplusplus","csharp","html","html-agility-pack","java","javascript","jsoup","libxml2","nokogiri","parsers","php","php-html-parser","python","ruby","web-scraping"],"latest_commit_sha":null,"homepage":"https://brightdata.com/blog/web-data/best-html-parsers","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/luminati-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-20T14:15:43.000Z","updated_at":"2025-01-20T14:41:40.000Z","dependencies_parsed_at":"2025-03-22T07:02:05.271Z","dependency_job_id":"ed0a6642-4035-470f-a9e2-f4e4ef04865e","html_url":"https://github.com/luminati-io/HTML-parsing-libraries","commit_stats":null,"previous_names":["luminati-io/html-parsing-libraries"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/luminati-io/HTML-parsing-libraries","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2FHTML-parsing-libraries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2FHTML-parsing-libraries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2FHTML-parsing-libraries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2FHTML-parsing-libraries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/luminati-io","download_url":"https://codeload.github.com/luminati-io/HTML-parsing-libraries/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/luminati-io%2FHTML-parsing-libraries/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011293,"owners_count":26084928,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["beautifulsoup","cheerio","cplusplus","csharp","html","html-agility-pack","java","javascript","jsoup","libxml2","nokogiri","parsers","php","php-html-parser","python","ruby","web-scraping"],"created_at":"2025-03-24T17:24:57.779Z","updated_at":"2025-10-12T12:42:25.756Z","avatar_url":"https://github.com/luminati-io.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Best HTML Parsing Libraries for Web Scraping\n\n[![Promo](https://github.com/luminati-io/LinkedIn-Scraper/raw/main/Proxies%20and%20scrapers%20GitHub%20bonus%20banner.png)](https://brightdata.com/) \n\nDiscover top HTML parsers for [web scraping](https://github.com/luminati-io/Awesome-Web-Scraping) and data extraction, including `httpx`, `AIOHTTP`, and `urllib`.\n\n## What Is an HTML Parser?\n\nAn HTML parser processes HTML documents, converting them into a structured data format for easy navigation and manipulation. They analyze HTML code to build a tree-like structure representing the document's DOM. HTML parsers are essential for web scraping, allowing you to extract information like product names and prices from websites.\n\n## Key Considerations for HTML Parsers\n\n- **Pros and Cons**: Benefits and drawbacks of the library.\n- **Programming Language**: Language the library is written in.\n- **GitHub Stars**: Popularity indicator.\n- **CSS Selector Support**: Built-in CSS selector support.\n- **XPath Support**: Built-in XPath expression support.\n\n## Top 7 HTML Parsers\n\n### 1. [jsoup](https://jsoup.org/)\n\n- **Pros**: Implements WHATWG HTML specification, includes HTTP client, vast API.\n- **Cons**: Not the fastest.\n- **Language**: Java\n- **GitHub Stars**: 10.5k\n- **CSS Selector Support**: Yes\n- **XPath Support**: Yes\n\n\u003e 💡 Learn more about [**web scraping with jsoup**](https://brightdata.com/blog/how-tos/web-scraping-with-jsoup).\n\n### 2. [Nokogiri](https://nokogiri.org/index.html)\n\n- **Pros**: Secure by default, CSS3 selectors, full API documentation.\n- **Cons**: Not the most used.\n- **Language**: Ruby\n- **GitHub Stars**: 6.1k\n- **CSS Selector Support**: Yes\n- **XPath Support**: Yes\n\n\u003e 💡 Learn more about [**web scraping with Ruby**](https://brightdata.com/blog/how-tos/web-scraping-with-ruby).\n\n### 3. [Beautiful Soup](https://pypi.org/project/beautifulsoup4/)\n\n- **Pros**: Multiple parsers, widely used, code formatting.\n- **Cons**: No API documentation, no native XPath support.\n- **Language**: Python\n- **GitHub Stars**: —\n- **CSS Selector Support**: Yes\n- **XPath Support**: Possible with `lxml`\n\n\u003e 💡 Learn more about [**web scraping with Beautiful Soup**](https://brightdata.com/blog/how-tos/beautiful-soup-web-scraping).\n\n### 4. [Cheerio](https://cheerio.js.org/)\n\n- **Pros**: jQuery-like syntax, high performance.\n- **Cons**: Still in beta, no XPath support.\n- **Language**: JavaScript (Node.js)\n- **GitHub Stars**: 27.6k\n- **CSS Selector Support**: Yes\n- **XPath Support**: No\n\n\u003e 💡 Learn more about [**web scraping with Cheerio**](https://brightdata.com/blog/how-tos/cheerio-npm-web-scraping).\n\n### 5. [Html Agility Pack](https://html-agility-pack.net/)\n\n- **Pros**: Works with .NET languages, XSLT support.\n- **Cons**: Little documentation, no native CSS selector support.\n- **Language**: C#\n- **GitHub Stars**: 2.5k\n- **CSS Selector Support**: Possible via extension\n- **XPath Support**: Yes\n\n\u003e 💡 Learn more about [**web scraping with Html Agility Pack**](https://brightdata.com/blog/how-tos/web-scraping-with-c-sharp).\n\n### 6. [libxml2](https://gitlab.gnome.org/GNOME/libxml2)\n\n- **Pros**: Used by many libraries, extreme performance.\n- **Cons**: Complex API, limited to XPath.\n- **Language**: C\n- **GitHub Stars**: —\n- **CSS Selector Support**: No\n- **XPath Support**: Yes\n\n\u003e 💡 Learn more about [**web scraping with libxml2**](https://brightdata.com/blog/how-tos/web-scraping-in-c-plus-plus).\n\n### 7. [PHPHtmlParser](https://github.com/paquettg/php-html-parser)\n\n- **Pros**: Parses broken HTML, complete API.\n- **Cons**: Not actively maintained, no documentation.\n- **Language**: PHP\n- **GitHub Stars**: 2.3k\n- **CSS Selector Support**: Yes\n- **XPath Support**: No\n\n\u003e 💡 Learn more about [**web scraping with PHP**](https://brightdata.com/blog/how-tos/web-scraping-php).\n\n## Summary Table\n\n| HTML Parser       | Language | GitHub Stars | CSS Selector | XPath |\n|-------------------|----------|--------------|--------------|-------|\n| jsoup             | Java     | 10.5k        | ✅           | ✅    |\n| Nokogiri          | Ruby     | 6.1k         | ✅           | ✅    |\n| Beautiful Soup    | Python   | —            | ✅           | Possible via `lxml` |\n| Cheerio           | JavaScript | 27.6k      | ✅           | ❌    |\n| Html Agility Pack | C#       | 2.5k         | Possible via extension | ✅ |\n| libxml2           | C        | —            | ❌           | ✅    |\n| PHPHtmlParser     | PHP      | 2.3k         | ✅           | ❌    |\n\n## Conclusion\n\nThis guide explored the best HTML parsing libraries. Your choice depends on your programming language and project needs. Remember, websites may use anti-bot technologies, but tools like [Bright Data's proxy services](https://brightdata.com/proxy-types) or [Web Scrapers](https://brightdata.com/products/web-scraper) can help you retrieve HTML for parsing.\n\nLearn how to scrape specific websites:\n\n- [**Amazon**](https://github.com/luminati-io/LinkedIn-Scraper)\n- [**LinkedIn**](https://github.com/luminati-io/LinkedIn-Scraper)\n- [**Google Maps**](https://github.com/luminati-io/Google-Maps-Scraper)\n- [**Google News**](https://github.com/luminati-io/Google-News-Scraper)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluminati-io%2Fhtml-parsing-libraries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluminati-io%2Fhtml-parsing-libraries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluminati-io%2Fhtml-parsing-libraries/lists"}