Extracting data from saved HTML in Python: Beautiful Soup, JustHTML, lxml and parsel
Beautiful Soup is the most maintainable base for a repeatable extraction script, as long as you name its parser. JustHTML is the newcomer to consider when broken markup changes your results.
Beautiful Soup
Python search methods and CSS selectors in one documented interface, with a pure-Python install and a parser you can change without rewriting your searches.
Name the parser: it decides the tree, and the fast choices do not follow HTML5 tree rules. Slowest at volume; old names such as findAll are due to become errors.
Why Beautiful Soup is our PickTeam behind Beautiful Soup? Get your award badge
JustHTML
A pure-Python parser first released in November 2025, built to produce browser-standard trees from broken markup, with CSS selectors and text extraction.
Pass sanitize=False for extraction. Young, built mainly by one developer, and three major versions in 2026.
Why JustHTML earned Rising StarWho is this article for? Python users writing a script to pull fields such as names, prices and links from HTML pages already saved on disk, at the scale of hundreds or a few thousand pages per run.
About 25 min read
What Preferred Pick, Rising Star and Ready to Rock mean
The quick list
All four are free. Compare how you write field rules, how each handles broken markup and what their 2026 releases change.
All four are free, open-source Python packages with no account or per-page charge, checked November 12, 2026. Your costs are setup, code maintenance and checking extracted records. Licenses: MIT for Beautiful Soup and JustHTML; BSD-3-Clause for lxml, with bundled libraries under their own licenses, and for parsel.
The comparison at a glance
Compare how you write field rules, how each library handles broken markup, what it takes to install and the 2026 changes your script will meet.
Order follows our verdict for a repeatable extraction script, not measured speed or correctness. All tools remain selectable.
Hides matching answers for the selected tools. Unknowns and unverified claims stay visible.
| Feature | Beautiful Soup | JustHTML | lxml | parsel |
|---|---|---|---|---|
| Best fit | Preferred Pick: a repeatable extraction script for pages saved on disk, with the parser named | Rising Star: badly formed pages, browser-style parsing in pure Python | XPath rules, or large batches where speed matters | CSS and XPath through one selector object, with ::text and ::attr shortcuts |
| How you write field rules | Python search methods (tag, attribute, text, your own functions) and CSS through Soup Sieve | CSS selectors: query() and query_one() | XPath 1.0; CSS through the separate cssselect package | CSS (translated to XPath) and XPath 1.0 through one Selector; ::text and ::attr; regular expressions; JMESPath for JSON |
| Broken-markup handling | Depends on the parser you name: html.parser and lxml do not follow HTML5 tree rules; html5lib does, very slowly, and has had no release since June 2020 | HTML5 tree construction; project reports passing all 1,917 non-script web-platform cases (October 4, 2026) | libxml2 tokenizer follows HTML5 since 2.14; tree construction does not. Docs warn seriously broken parts may be dropped | HTML parsed by lxml, so lxml’s rules apply; the pages we read give no separate broken-markup guarantee |
| Defaults that can remove data | None beyond the parser’s repair rules | Sanitizes by default: drops script content (such as JSON-LD), comments, data-* and other non-allowlisted attributes, and absolute image URLs. Use sanitize=False | None documented; recovery may drop seriously broken parts | None documented on the pages we read; lxml’s recovery can drop seriously broken parts |
| Install footprint | Pure-Python wheel; html.parser needs nothing else | Pure Python; no runtime dependencies | Compiled libxml2/libxslt; wheels for the widest platform range here | Pure-Python wheel that builds on lxml, whose compiled wheels cover the widest platform range here |
| Current release, checked November 12, 2026 | 4.15.0, June 7, 2026; Python 3.7 or later | 3.17.0, November 9, 2026; Python 3.10 or later | 6.1.3, September 2, 2026; Python 3.8 or later; 7.0 in beta | 1.12.1, September 28, 2026; Python 3.10 or later |
| Change to plan for | Names deprecated in 4.13.0, such as findAll, are due to become errors after 4.15.0; html.parser output changed in October 2025 Python security releases | 1.0 in January, 2.0 in May and 3.0 in June 2026, which replaced the parser core | 7.0 removes Python 3.8 support; libxml2 is volunteer-maintained and not recommended for untrusted data | 1.12.0 (September 25, 2026) changed input detection (an XML declaration now means XML; only JSON objects and arrays count as JSON) and xpath() keyword arguments; 1.11.0 dropped Python 3.9 |
Python extraction from HTML already saved on disk; none of these libraries runs JavaScript, so a field missing from the saved file cannot be extracted. Public-source research checked October 19 and November 12, 2026: no installs, parsing, benchmarks or security audit by us. All four are free and open source. Keep the saved HTML, name the parser and versions, and check a known record count after every upgrade. Next substantive review: December 18, 2026, or sooner after a major release.
All features and sources 18 criteria
Open the groups that matter to you. They compare the same selected tools. “Planned” means future work, not an available feature. Sources include the published conditions.
Querying and extraction
Show 11 criteria
| Feature | Beautiful Soup | JustHTML | lxml | parsel |
|---|---|---|---|---|
| Best fit | Preferred Pick: a repeatable extraction script for pages saved on disk, with the parser named | Rising Star: badly formed pages, browser-style parsing in pure Python | XPath rules, or large batches where speed matters | CSS and XPath through one selector object, with ::text and ::attr shortcuts |
| How you write field rules | Python search methods (tag, attribute, text, your own functions) and CSS through Soup Sieve | CSS selectors: query() and query_one() | XPath 1.0; CSS through the separate cssselect package | CSS (translated to XPath) and XPath 1.0 through one Selector; ::text and ::attr; regular expressions; JMESPath for JSON |
| Broken-markup handling | Depends on the parser you name: html.parser and lxml do not follow HTML5 tree rules; html5lib does, very slowly, and has had no release since June 2020 | HTML5 tree construction; project reports passing all 1,917 non-script web-platform cases (October 4, 2026) | libxml2 tokenizer follows HTML5 since 2.14; tree construction does not. Docs warn seriously broken parts may be dropped | HTML parsed by lxml, so lxml’s rules apply; the pages we read give no separate broken-markup guarantee |
| Defaults that can remove data | None beyond the parser’s repair rules | Sanitizes by default: drops script content (such as JSON-LD), comments, data-* and other non-allowlisted attributes, and absolute image URLs. Use sanitize=False | None documented; recovery may drop seriously broken parts | None documented on the pages we read; lxml’s recovery can drop seriously broken parts |
| Text and attribute extraction | get_text() with separator and strip options; tag attributes | to_text() joins with a space by default; element attrs | text_content(); element attributes | get() and getall() on ::text; re(); attrib and ::attr for attributes |
| Tree cleanup before extraction | Remove, replace and unwrap nodes | Transforms: unwrap, drop, edit attributes, linkify | HTML element editing methods | drop() removes an element; no wider tree editing is documented on the pages we read |
| XML | With lxml installed, through the "xml" parser | Not offered; HTML only | Separate XML API with its own parsing rules | CSS and XPath for XML as well as HTML; JSON through JMESPath |
| Large inputs | SoupStrainer parses only matching parts; not with html5lib | Streaming API documented | Feed and event-driven parsing documented | Not documented on the pages we read |
| Encoding handling | Unicode, Dammit detection; the manual says it sometimes guesses wrong | Tested against html5lib encoding fixtures, per the project | Parser encoding controls; misplaced meta tags can cause encoding problems | 1.12.0 fixed body handling for UTF-16 and other non-UTF-8 encodings |
| Other documented capability | Python function filters | Command-line extraction by selector to text or Markdown | Link and form helpers | JMESPath on JSON inside script tags; remove_namespaces() |
| Published speed evidence | Slowest in the selectolax project benchmark and a July 2026 third-party test; its manual rates html.parser decent and lxml very fast | The project says it will not beat C or Rust parsers on raw throughput | Very fast, per the Beautiful Soup manual; behind selectolax in the July 2026 third-party test | No speed figure on the pages we read; 1.12.0 cached compiled XPath expressions and 1.12.1 fixed memory growth with lxml 5.4.0 or later |
These selected tools have matching answers in this group. Turn off “Show differences only” to see them.
Sources for querying and extraction
Checked October 19 and November 12, 2026: Beautiful Soup manual and Soup Sieve; parsel PyPI page and history; JustHTML README, comparison, selectors, text and default policy; lxml HTML interface, CSS selectors and parsing; libxml2 release notes; selectolax README benchmark; third-party benchmark, July 22, 2026. Conformance figures are JustHTML’s own public harness, not our test. Speed figures are other people’s measurements on their own pages.
Dependencies, maintenance and risk
Show 7 criteria
| Feature | Beautiful Soup | JustHTML | lxml | parsel |
|---|---|---|---|---|
| Install footprint | Pure-Python wheel; html.parser needs nothing else | Pure Python; no runtime dependencies | Compiled libxml2/libxslt; wheels for the widest platform range here | Pure-Python wheel that builds on lxml, whose compiled wheels cover the widest platform range here |
| Current release, checked November 12, 2026 | 4.15.0, June 7, 2026; Python 3.7 or later | 3.17.0, November 9, 2026; Python 3.10 or later | 6.1.3, September 2, 2026; Python 3.8 or later; 7.0 in beta | 1.12.1, September 28, 2026; Python 3.10 or later |
| Change to plan for | Names deprecated in 4.13.0, such as findAll, are due to become errors after 4.15.0; html.parser output changed in October 2025 Python security releases | 1.0 in January, 2.0 in May and 3.0 in June 2026, which replaced the parser core | 7.0 removes Python 3.8 support; libxml2 is volunteer-maintained and not recommended for untrusted data | 1.12.0 (September 25, 2026) changed input detection (an XML declaration now means XML; only JSON objects and arrays count as JSON) and xpath() keyword arguments; 1.11.0 dropped Python 3.9 |
| License | MIT | MIT; credits html5ever and html5lib-tests authors | BSD-3-Clause; bundled libraries under their own licenses | BSD-3-Clause |
| Who maintains it | Leonard Richardson | Emil Stenström, with nearly all commits; built with AI coding agents | lxml development team; libxml2 by volunteers | Scrapy project; 58 contributors listed on GitHub |
| 2026 security record | No beautifulsoup4 advisory in OSV; Soup Sieve fixed selector denial-of-service issues in 2.8.4 and 2.9.0 (untrusted selectors) and in 4.0 (November 2026), one of which affects untrusted documents; 4.1 needs Python 3.11.5 or later | 12 advisories, March to November, mostly sanitizer and Markdown output; parser crashes from deep nesting and from non-ASCII digits in character references, the latter patched in 3.17.0 | XML entity fixes in 6.1.0 (CVE-2026-41066) and 6.1.3 | No GitHub advisory; relies on lxml, whose record is XML entity fixes in 6.1.0 and 6.1.3 |
| Moving to another library later | Keep saved HTML and CSV/JSON output; rewrite search code | Keep saved HTML and output; rewrite queries; check sanitizer settings | Keep saved HTML and output; rewrite XPath | Keep saved HTML and output; CSS and XPath rules carry over to lxml |
These selected tools have matching answers in this group. Turn off “Show differences only” to see them.
Sources for dependencies, maintenance and risk
Package records on PyPI: beautifulsoup4, justhtml, lxml, parsel, soupsieve, cssselect, html5lib. Change records: Beautiful Soup 4.13.0 notes, 4.15.0 changelog as packaged by NetBSD, Python 3.12.12, JustHTML changelog, lxml changelog, parsel history, libxml2 README. Security: OSV, JustHTML advisories, Soup Sieve advisories, lxml CVE-2026-41066, parsel advisories. Contributor counts come from GitHub. Published Python ranges do not guarantee a wheel or a successful build on every platform.
What matters when choosing
Beautiful Soup is our Practical Pick for a Python user writing a repeatable script that pulls fields such as product names, prices and links out of HTML pages already saved on disk. It is free, installs as a pure-Python package and gives you two ways to describe a field: its own Python search methods and CSS selectors through the Soup Sieve package. Its manual is the most complete of the four, and you can change the parser underneath without rewriting your searches. The most important compromise is that Beautiful Soup does not parse HTML itself. The tree you search comes from the parser you name, and none of the practical choices builds the tree a browser would from badly broken markup: Python’s built-in html.parser and lxml do not follow the HTML5 tree rules, and html5lib, which does, is “very slow” by the manual’s own rating and has had no release since June 2020. Beautiful Soup manual, package record, html5lib release history
Name the parser in your code, keep a page saved on disk with a known number of records, and check the count after every parser, Python or library upgrade. Three changes make that check necessary now. Beautiful Soup says 4.15.0 is the last release that accepts names deprecated in 4.13.0, such as findAll, and that a later point release will raise an error instead. Python’s October 2025 security releases changed how html.parser handles comments, script content and tag syntax, so the same script can build a different tree on a different Python patch version. Soup Sieve, the package behind its CSS selectors, fixed several denial-of-service issues in November 2026 (versions 4.0 and 4.1), including a High-rated one triggered by deeply nested documents. 4.15.0 changelog as packaged by NetBSD, Beautiful Soup 4.13.0 notes, Python 3.12.12 release notes, Soup Sieve advisories
If your pages are badly formed and you want browser-style parsing without compiled code, consider JustHTML, our Rising Star. It is a pure-Python HTML5 parser first released in November 2025, with CSS selectors and text extraction, and its project reports passing every non-script tree-construction case in the web-platform tests. Pass sanitize=False when extracting: by default it removes script content, comments and any attribute not on a short allowlist, such as data-* attributes, and it drops absolute image URLs. It is also young, built mainly by one developer working with AI coding agents, and it went through three major versions in 2026. Choose lxml if your rules are written in XPath or you process large batches. Beautiful Soup’s manual calls it very fast and suggests using it directly if CSS selectors are all you need, but its HTML parsing comes from libxml2, whose volunteer maintainers say it is not recommended for untrusted data. parsel, the selector library of the Scrapy project, gives you CSS and XPath in one object with ::text and ::attr shortcuts, but it parses with lxml and so shares lxml’s limits. JustHTML, default policy, lxml parsing, libxml2 README, parsel
These are researched judgments from documentation, release records and public reports checked October 19 and November 12, 2026. We did not install or run any library; speed and conformance figures are other people’s measurements. None of these libraries runs JavaScript, so a field missing from the saved file cannot be extracted by any of them. Two conditions would change our recommendation: rules written in XPath or batches large enough that speed decides the job (choose lxml), or broken markup that changes what you extract (choose JustHTML with sanitizing off). Whichever you choose, keep the saved HTML and write results to CSV or JSON, so a later change of library means rewriting queries rather than recovering data.
Beautiful Soup
Preferred Pick · a repeatable script for pages saved on disk
Choose Beautiful Soup for an extraction script you will rerun and maintain, when clear search code matters more than speed. Name the parser and check a known record count after every upgrade.
Reasons to choose it
- Python search methods and CSS selectors in one interface
- Pure-Python install that works with Python’s built-in parser
- The most complete manual of the four
What to watch
- The tree depends on the parser you name; the fast ones do not follow HTML5 tree rules
- Slowest in published benchmarks
- Names such as findAll are due to become errors after 4.15.0
Beautiful Soup wraps a parser and gives you one search interface over the result. Its manual documents searches by tag, attribute, text and your own Python functions, CSS selection through Soup Sieve, text extraction with get_text(), and tree editing and output. That range lets a script express each field rule in whichever form is clearest, and lets you switch parser without rewriting searches. The package is beautifulsoup4, imported as bs4. We verified that version 4.15.0, released June 7, 2026, requires Python 3.7 or later, ships as a pure-Python wheel, depends on Soup Sieve and is MIT-licensed under Leonard Richardson’s name. Manual, package record
The tree depends on the parser. The manual shows one invalid snippet producing three different trees under html.parser, lxml and html5lib, rates lxml “very fast”, html.parser “decent” and html5lib “very slow”, and recommends lxml for speed. JustHTML’s project, a competitor, reports that Beautiful Soup with its default parser matches almost none of the web-platform tree-construction cases. Those cases are deliberately broken edge cases, not ordinary pages, but they are a reason to check record counts rather than assume a page parsed the way your browser shows it. Choose another tool if speed at volume decides the job: the selectolax project benchmark and a July 2026 third-party test both put Beautiful Soup slowest. Manual, JustHTML comparison, selectolax benchmark, third-party benchmark
Read the full Beautiful Soup analysis and sources
Plan for the deprecation cut-off. Beautiful Soup 4.13.0, released February 2, 2025, began issuing warnings for methods and attributes kept from versions 2 and 3, such as findAll. The 4.15.0 changelog says it is the last release to support them and the last to officially support Python 3.7; a later point release is to replace the warnings with NotImplementedError before the features are removed. Replace old names, such as findAll with find_all, before upgrading. The official changelog did not load for our automated check, so we read the 4.15.0 entry as reproduced in a NetBSD package update. The manual’s page title still says 4.14.3, while its text says it covers 4.15.0. 4.13.0 notes, 4.15.0 changelog as packaged
If you use html.parser to avoid native dependencies, your results also depend on Python. Python 3.12.12, released October 9, 2025, changed HTMLParser to follow HTML5 rules for start and end tags and comments, stopped it losing data when a <script> element is never closed, and fixed quadratic processing of crafted input. Beautiful Soup 4.15.0 separately changed its html.parser handling of numeric character references to avoid a crash on certain Python versions. Pin the Python version with the script, or rerun your record check when it changes. Python 3.12.12, 4.15.0 changelog as packaged
The manual says its encoding detection “guesses correctly most of the time, but sometimes it makes mistakes”, so check decoded names and prices on a sample. SoupStrainer limits parsing to the parts you need, but not with html5lib, which always parses the whole document. The manual also says that if CSS selectors are all you need, you should skip Beautiful Soup and use lxml directly because it is a lot faster. Manual
CSS selection depends on Soup Sieve, a separate package. Soup Sieve fixed selector-parsing denial-of-service issues in 2026, in versions 2.8.4 and 2.9.0. Version 2.9.0 needs Python 3.10, and Soup Sieve 3.0, released October 10, 2026, needs Python 3.11; on older Python, pip installs an older Soup Sieve. The 2026 selector-string issues matter only if your script accepts selector strings from other people. The November fixes are different: the High-rated one (a slowdown with descendant selectors such as a b) is triggered by deeply nested documents, so pages saved from the web count. It is fixed only in Soup Sieve 4.0 and later, which need Python 3.11.5 or later; on older Python, upgrade Python or use child combinators (a > b) instead of descendant ones. Soup Sieve releases, September advisory, November advisory
Used Beautiful Soup? Share your experience to help other readers choose.
JustHTML
Rising Star · a newcomer worth considering
Why Rising Star? First released in November 2025, it is the only library in this comparison that combines browser-standard parsing with a pure-Python install, and its documentation and public conformance results support the extraction job. Its youth and default sanitizing are the limits. This is not our broader Ready to Rock endorsement.
Consider JustHTML when broken markup changes what you extract and you want browser-standard parsing without compiled code. Pass sanitize=False for extraction and pin the version.
Reasons to choose it
- Project reports passing all non-script web-platform tree-construction cases
- No runtime dependencies or compiled code
- CSS selectors, text extraction and a command-line extractor
What to watch
- Default sanitizing drops scripts, comments and data-* attributes
- Three major versions in 2026; one main developer
- Slower than C-based parsers, by its own account
JustHTML is a pure-Python HTML5 parser by Emil Stenström, first published on PyPI on November 30, 2025. It is designed to build the tree the HTML5 standard specifies for browsers, then lets you query it with CSS selectors (query() and query_one()), extract text with to_text(), and edit or serialize the result; a command-line mode extracts text from a selector. We verified that version 3.17.0, released November 9, 2026, requires Python 3.10 or later, has no runtime dependencies or compiled code, and is MIT-licensed; its license also credits the html5ever developers, whose design it drew on, and the html5lib test authors. Package record, README, selectors, text extraction
Its useful difference is browser-standard parsing without a native extension. The project reports passing all 1,917 non-script tree-construction cases of the web-platform tests on October 4, 2026, using a public harness; that is its own measurement, not ours. Its strongest reason not to choose it is the default sanitizer. JustHTML(html) drops script and style content and comments, keeps only a short list of attributes, and allows only relative image URLs, so a script reading data-* attributes, JSON-LD or absolute image links will silently get less than the page holds unless you pass sanitize=False. Comparison and conformance note, default policy
Read the full JustHTML analysis and sources
It is young and has changed quickly. Version 1.0 in January 2026 declared the interface stable, 2.0 in May removed several aliases and options, and 3.0 in June replaced the parser core and changed parser error reporting. The releases since October still fix tree-construction edge cases. Nearly all commits are the developer’s own. Simon Willison, who ported it to JavaScript, reports that it was built with coding agents over a couple of months and at one point rewritten after close inspection of html5ever. Pin the version and rerun your record check on upgrade. Changelog, Willison, December 15, 2025
The project has published 12 security advisories since March 2026, mostly about its sanitizer and Markdown output. Those matter when cleaned HTML goes back into a web page, not for extraction with sanitizing off. Two affect parsing: uncontrolled recursion on deeply nested HTML (March), and an uncaught error when a numeric character reference contains a non-ASCII digit, rated High and published on November 9, 2026. The second crashes the parser on a four-byte input and is fixed in 3.17.0, so upgrade past 3.16. Mozilla’s support-site code replaced the Bleach sanitizer with JustHTML in February 2026; that is adoption for sanitizing, not evidence about extraction. Security advisories, November 9 advisory, 3.17.0 release notes, Mozilla Kitsune change
The project says it will not beat C or Rust parsers on raw throughput and recommends a compiled parser for very large volumes of trusted HTML. It does not offer XPath or XML processing. Choose lxml if speed at scale decides the job, and Beautiful Soup if its search methods and longer record matter more than browser-standard parsing. Comparison
Used JustHTML? Share your experience to help other readers choose.
lxml
Also consider · XPath or large batches
Choose lxml when your rules are written in XPath or volume makes speed matter. Check record counts on badly broken pages, and keep HTML and XML parsing separate.
Reasons to choose it
- XPath 1.0, plus CSS through cssselect
- Very fast, per Beautiful Soup’s own manual
- Prebuilt wheels for the widest range of platforms here
What to watch
- Its docs warn that seriously broken parts may be dropped
- libxml2 is volunteer-maintained and not recommended for untrusted data
- lxml 7.0, now in beta, drops Python 3.8
lxml gives Python an HTML interface over the libxml2 C library: document and fragment parsing, XPath 1.0, text extraction with text_content(), link and form helpers, and tree editing. CSS selectors need the separate cssselect package, which translates them into XPath. Beautiful Soup’s manual calls lxml very fast and recommends it for speed. We verified that lxml 6.1.3, released September 2, 2026, requires Python 3.8 or later, is BSD-3-Clause licensed and has prebuilt wheels for a wide range of platforms, including 32-bit ARM, PowerPC and RISC-V Linux. HTML interface, CSS selectors, package record, Beautiful Soup manual
The compromise is how it treats broken markup and who maintains the parser underneath. lxml’s documentation says broken HTML depends on libxml2’s recovery, that there is no guarantee the tree contains all the data, and that seriously broken parts may be dropped, with misplaced meta tags a known source of encoding problems. libxml2 made its HTML tokenizer follow HTML5 in version 2.14 (March 2025), but its tree construction still does not. Its README says it is written by hobbyists and maintained by volunteers, handles security reports on a best-effort basis and is “NOT recommended” for untrusted data. Releases have continued, most recently 2.15.4 in September 2026. Parsing and recovery, libxml2 release notes, libxml2 README
Read the full lxml analysis and sources
lxml’s 2026 security fixes concern XML. Version 6.1.0 in April changed the defaults of iterparse() and ETCompatXMLParser to block external entity injection (CVE-2026-41066), and 6.1.3 stopped external parameter entities being parsed by default. Keep HTML and XML parsing as separate, explicit code paths. 6.1.0 notes, 6.1.3 notes, CVE record
lxml 7.0 is in beta (7.0.0b1, August 22, 2026). Its notes remove Python 3.8 support and add tree locking, which makes some operations faster and others slower. cssselect 1.6.0, released October 9, 2026, requires Python 3.11; older Python gets an older cssselect. Pin both in your requirements. lxml changelog, cssselect releases
Choose Beautiful Soup if its search methods are easier to maintain in your codebase; you can still name lxml as its parser for speed. Choose JustHTML if browser-standard parsing of broken markup matters more than XPath.
Used lxml? Share your experience to help other readers choose.
parsel
XPath and CSS in one selector object
Consider parsel when you want XPath and CSS selectors in one object, with ::text and ::attr shortcuts, and you are happy to inherit lxml’s parsing rules. Check record counts on badly broken pages.
Reasons to choose it
- CSS and XPath 1.0 in one Selector, plus regular expressions
- JMESPath for JSON embedded in a page
- Maintained by the Scrapy project, with 1.12.1 released on September 28, 2026
What to watch
- Uses lxml’s parser, so no HTML5 tree rules and seriously broken parts may be dropped
- 1.12.0 changed how input type is detected and how xpath() takes keyword arguments
- Its full documentation was not read
parsel is the selector library of the Scrapy project. Its README says it extracts data from HTML, XML and JSON, and that it supports CSS and XPath expressions for HTML and XML, JMESPath for JSON and regular expressions. A Selector built from text exposes css() and xpath(), with ::text and ::attr() in CSS, and get() and getall() to read results. We verified that version 1.12.1, released September 28, 2026, is a pure-Python wheel that requires Python 3.10 or later, and is BSD-3-Clause licensed. Its changelog shows it builds on lxml. PyPI record, history, repository
Choose it if you want one object for both CSS and XPath rules and like the ::text shortcut, which is a shorter way to write what Beautiful Soup does with get_text() and lxml does with text_content(). It also reads JSON embedded in a page through JMESPath, for example the data inside a script tag. Its limits are lxml’s: the HTML parsing comes from libxml2, whose tokenizer follows HTML5 but whose tree building does not, and lxml’s documentation warns that seriously broken parts may be dropped. We found nothing on parsel’s own pages that promises better recovery, so check a known record count. lxml parsing
Read the full parsel analysis and sources
It has changed recently. Version 1.12.0, released September 25, 2026, changed input detection so that only JSON objects and arrays count as JSON and input starting with an XML declaration is treated as XML, and it changed xpath() keyword arguments so custom functions must be registered another way; 1.12.0 also removed the packaging dependency, and version 1.11.0 in January dropped Python 3.9 and removed Selector.remove(). Version 1.12.1 fixed memory use that grew with every xpath() and css() call on lxml 5.4.0 or later. GitHub lists 58 contributors, and we found no security advisory for it; its exposure to lxml’s record is the same as lxml’s. History, advisories, repository
We read parsel’s README, changelog and repository pages but not its full documentation, so our view of it rests on less than for the other three. Choose lxml if you want XPath without a wrapper, and Beautiful Soup if maintainable search code matters more than selector shortcuts.
Used parsel? Share your experience to help other readers choose.
Which product are we missing?
Know a product that belongs in this article? Tell us what it does differently and why it deserves a closer look. Newcomers welcome.
Readers and product teams can suggest candidates. Suggestions inform our research; they do not guarantee inclusion or a recommendation.
Opens an email draft with this article attached as a link. Nothing is sent until you send it.
No email app? Send the product name, website, and this article’s title to admin@practicalpicks.guide.
What people are saying
Public discussion is a check on project claims, not a measured reliability score. JustHTML’s December 2025 Hacker News thread mixed interest in a pure-Python parser with challenges. One commenter asked whether it is effectively an AI-assisted port of html5ever; the developer said the first version was written against the test suite and a later rewrite followed html5ever’s design for speed. Another reported lower pass rates when also checking expected parse errors, and the developer replied that error expectations are not standardized and fixed problems the commenter found. A third criticised the readability of part of the code. Hacker News discussion, Willison’s account
A July 22, 2026 benchmark by Serpent API, which sells a search-results API, parsed one saved Bing results page 300 times per library. It reported selectolax at 0.45 ms per parse, lxml at 1.19 ms and Beautiful Soup at 3.35 ms with lxml and 5.28 ms with html.parser; all four configurations extracted the ten expected titles, with selectolax running two words together. It used older versions (selectolax 0.3.27, lxml 5.3.0, Beautiful Soup 4.12.3) and one page, so treat it as an example, not a ranking. Benchmark
Reddit discussions from 2020 and 2021, read September 7, 2026, show confusion about Beautiful Soup wrapping lxml and mixed preferences; they are too old and self-selected to rank anything. Our October 19 and November 12 searches for vulnerabilities, crashes, abandonment and disputes involving these projects found nothing beyond the items in this article that changed our conclusions; a search that finds nothing is not proof that nothing exists. Beautiful Soup and lxml discussion, preference discussion
How we researched
This is public-source research. We did not install, import or run any library, parse any file, or reproduce any benchmark or conformance test. No project supplied access, payment or input, and we use no affiliate links. We first compared Beautiful Soup, lxml and selectolax on September 7, 2026, and rechecked every material claim on October 19, 2026. On November 12, 2026 we rechecked releases, licenses, security advisories and maintenance for every library here, and read package records for parsel, pyquery and the newer projects below. We read package metadata from PyPI, project documentation and changelogs, GitHub repository, advisory and release pages, the OSV vulnerability database, Python’s release notes and libxml2’s repository. Beautiful Soup’s official changelog did not load for our automated check, so we read its 4.15.0 entry as reproduced in a NetBSD package update.
We wrote this for a Python user extracting fields from pages already saved on disk, at the scale of hundreds or a few thousand pages per run, who wants a script that keeps working. All of these libraries are free, so price did not separate them. We fixed five criteria and their weights before comparing: how well each library expresses field rules (25%), how it handles broken markup (20%), setup and portability (15%), change and maintenance risk (25%) and documentation (15%). Beautiful Soup scored highest at 3.93 of 5, JustHTML 3.68, lxml 3.50 and parsel 3.43. Giving broken markup much more weight favors JustHTML; adding throughput as a criterion favors lxml. Beautiful Soup leads JustHTML by a quarter of a point, and that order does not depend on price, because every library is free. We did not evaluate frameworks that also fetch pages, such as Scrapy or Scrapling, or tools built to extract whole article text.
Other libraries we scored but left out of the chart, because they placed below the four shown: turbohtml 3.35, pyquery 3.30, markupever 3.23 and selectolax 3.15. pyquery offers jQuery-style CSS selectors over lxml, so it shares lxml’s parsing rules. selectolax wraps the Lexbor engine and had the fastest results in its own benchmark; its 1.0 release on October 3, 2026 removed a backend and changed several behaviors, and 1.0.2 followed on October 22, so it is the library to revisit once 1.0 has a longer record. We read html5lib, html5-parser and Python’s html.parser as parser backends without a selector layer of their own, and Resiliparse as a web-archive toolkit, and did not score them.
We also searched for new entrants on November 12, 2026 through PyPI release records, GitHub’s Python HTML-parser topic, Hacker News, package-listing sites and the comparison pages of the newer projects themselves. JustHTML still meets our Rising Star threshold: its first release, on November 30, 2025, falls within the 24 months before this check, it is available now, it runs on Windows and macOS, its documentation shows the extraction task, and no serious advisory is unpatched in its current release. We also screened turbohtml, a compiled HTML toolkit first released in June 2026 which has published 47 security advisories since then, a heavy load for a script you must maintain, and markupever, a Rust-based parser first released in March 2025 that is still pre-1.0 and changed behavior in two releases within five weeks. Both scored lower than JustHTML.
| Tool | Public sources | What remains uncertain |
|---|---|---|
| Beautiful Soup | Manual, PyPI record, 4.13.0 notes, 4.15.0 changelog as packaged by NetBSD, Python 3.12.12 notes, Soup Sieve releases and advisories. | Text of the official changelog, when the error-raising point release ships, how often parser differences change real extractions. |
| JustHTML | README, documentation, changelog, license, PyPI record, release notes, security advisories, Hacker News discussion, Willison’s account, Mozilla’s code change. | Conformance and speed beyond the project’s own runs, long-term maintenance by one developer, stability of the 3.x interface. |
| lxml | HTML, CSS and parsing documentation, PyPI record, changelog, GitHub advisories, libxml2 README and release notes. | How often recovery drops data on real pages saved on disk, libxml2’s long-term maintenance, lxml 7.0 final behavior. |
| parsel | README, PyPI record, history, repository and advisory pages. | Its full documentation was not read, how its parsing differs from lxml’s in practice. |
None of this establishes parsing speed, correctness or security on your pages. Next substantive review is due December 18, 2026, or sooner after a major release of any of the four, or of selectolax. Found a changed release or behavior? Contact the editors.
Sources and evidence
Sources were checked October 19, 2026 unless another date is given; PyPI records and advisory pages were rechecked on November 12, 2026. Project material establishes documented interfaces and published releases, not behavior in your environment. Benchmarks and conformance figures are the publishers’ own measurements. Community posts are attributed opinions, not representative samples.
- Beautiful Soup: manual (title says 4.14.3, text says 4.15.0); PyPI record, 4.15.0, June 7, 2026; 4.13.0 notes, February 2, 2025; 4.15.0 changelog as packaged by NetBSD, June 11, 2026, used because the official changelog blocked automated retrieval; Soup Sieve API, releases, September 2026 advisory and November 2026 advisories, checked November 12; html5lib releases.
- Python: 3.12.12 release notes, October 9, 2025.
- JustHTML: PyPI record, 3.17.0, November 9, 2026; README; comparison and conformance note, October 4, 2026, a competitor’s comparison of the other three; selectors; text extraction; default sanitization policy; changelog; security advisories and November 9, 2026 advisory; Mozilla Kitsune change, merged February 10, 2026; Simon Willison, December 15, 2025.
- lxml: HTML interface; CSS selectors; parsing and recovery; installation; PyPI record, 6.1.3, September 2, 2026; 6.1.0 notes; 6.1.3 notes; changelog including 7.0 betas; CVE-2026-41066 record; cssselect releases; libxml2 README and release notes.
- parsel: PyPI record, 1.12.1, September 28, 2026; history; repository; advisories.
- Libraries scored but not charted: selectolax PyPI record, 1.0.2, October 22, 2026, repository and benchmark and changelog; turbohtml PyPI record, 1.15.10, November 7, 2026, repository and advisories; pyquery PyPI record, 2.1.0, July 27, 2026 and repository; markupever repository and releases.
- Independent and community evidence: Serpent API benchmark, July 22, 2026, published by a company that sells a search-results API; Hacker News discussion of JustHTML, December 2025; Reddit Beautiful Soup and lxml discussion, June 2020 and preference discussion, January 2021, last read September 7, 2026. Vulnerability searches used OSV.
This is a researched comparison, not a product review. Method: evidence standard, editorial picks.